class Credova::Client

Attributes

access_token[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/credova/client.rb, line 13
def initialize(options = {})
  requires!(options, :username, :password)
  @options = options

  authenticate!
end

Public Instance Methods

application() click to toggle source
# File lib/credova/client.rb, line 20
def application
  @application ||= Credova::Application.new(self)
end
ffl() click to toggle source
# File lib/credova/client.rb, line 24
def ffl
  @ffl ||= Credova::FFL.new(self)
end
retailer() click to toggle source
# File lib/credova/client.rb, line 28
def retailer
  @retailer ||= Credova::Retailer.new(self)
end

Private Instance Methods

authenticate!() click to toggle source
# File lib/credova/client.rb, line 34
def authenticate!
  response = post_request(
    'token',
    ['username=', @options[:username], '&password=', @options[:password]].join,
    content_type_header('application/x-www-form-urlencoded')
  )

  self.access_token = response.fetch(:jwt)
end