class FubClient::Client

Constants

API_URL
API_VERSION

Attributes

api_key[W]
her_api[R]

Public Class Methods

new() click to toggle source
# File lib/fub_client/client.rb, line 11
def initialize
  init_her_api
end

Public Instance Methods

api_key() click to toggle source
# File lib/fub_client/client.rb, line 15
def api_key
  @api_key ||= ENV['FUB_API_KEY']
end
api_uri() click to toggle source
# File lib/fub_client/client.rb, line 19
def api_uri
  @api_uri ||= URI::HTTPS.build(host: API_URL, path: "/#{API_VERSION}")
end

Private Instance Methods

init_her_api() click to toggle source
# File lib/fub_client/client.rb, line 25
def init_her_api
  @her_api = Her::API.new
  @her_api.setup url: self.api_uri.to_s do |c|
    # Request
    c.use FubClient::Middleware::Authentication
    c.use Faraday::Request::UrlEncoded
  
    # Response
    c.use FubClient::Middleware::Parser
  
    # Adapter
    c.use Faraday::Adapter::NetHttp
  end
end