Class: Vend::Oauth2::Client

Inherits:
Client
  • Object
show all
Includes:
Logable
Defined in:
lib/vend/oauth2/client.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{}

Instance Attribute Summary collapse

Attributes included from Logable

#logger

Attributes inherited from Client

#options, #password, #username

Instance Method Summary collapse

Methods inherited from Client

#Customer, #Outlet, #PaymentType, #Product, #Register, #RegisterSale, #Supplier, #Tax, #User, #base_url

Constructor Details

#initialize(store, auth_token, options = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
# File 'lib/vend/oauth2/client.rb', line 10

def initialize(store, auth_token, options = {})
  @store = store
  @auth_token = auth_token
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



8
9
10
# File 'lib/vend/oauth2/client.rb', line 8

def auth_token
  @auth_token
end

#storeObject

Returns the value of attribute store.



8
9
10
# File 'lib/vend/oauth2/client.rb', line 8

def store
  @store
end

Instance Method Details

#http_clientObject



16
17
18
# File 'lib/vend/oauth2/client.rb', line 16

def http_client
  @http_client ||= Vend::HttpClient.new(http_client_options)
end

#http_client_optionsObject



20
21
22
23
24
# File 'lib/vend/oauth2/client.rb', line 20

def http_client_options
  options.merge(
    auth_token: @auth_token, base_url: base_url
  )
end