class Lionshare::Wrapper::Base
Attributes
client[R]
root_url[R]
Public Class Methods
new()
click to toggle source
# File lib/lionshare/wrapper/base.rb, line 4 def initialize @root_url = Settings.config.api_url + prefix @client = HTTP::Client.new(headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }) end
Private Class Methods
prefix(value)
click to toggle source
# File lib/lionshare/wrapper/base.rb, line 23 def self.prefix(value) define_method :prefix do value end end
Private Instance Methods
wrap(response)
click to toggle source
# File lib/lionshare/wrapper/base.rb, line 14 def wrap(response) body = response.body.to_s if response.status == 200 body && !body.empty? ? JSON.parse(body) : nil else body end end