Sha256: eec8f79cd65b90e4251d2db1a162ecb26eb427f9ca1df8bc23a56d66e56f09f0
Contents?: true
Size: 857 Bytes
Versions: 19
Compression:
Stored size: 857 Bytes
Contents
require 'credova/api' require 'credova/application' require 'credova/ffl' require 'credova/retailer' module Credova class Client < Base include Credova::API attr_accessor :access_token def initialize(options = {}) requires!(options, :username, :password) @options = options authenticate! end def application @application ||= Credova::Application.new(self) end def ffl @ffl ||= Credova::FFL.new(self) end def retailer @retailer ||= Credova::Retailer.new(self) end private 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 end end
Version data entries
19 entries across 19 versions & 1 rubygems