Class: KcSdkApp::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/kc-sdk-app/api.rb,
lib/kc-sdk-app/api/apps.rb,
lib/kc-sdk-app/api/base.rb,
lib/kc-sdk-app/api/orders.rb

Defined Under Namespace

Classes: Apps, Base, Orders

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token: KcSdkApp.configuration.access_token) ⇒ Api

Returns a new instance of Api.



11
12
13
14
15
# File 'lib/kc-sdk-app/api.rb', line 11

def initialize(access_token: KcSdkApp.configuration.access_token)
  self.access_token = access_token
  self.orders = KcSdkApp::Api::Orders.new(self)
  self.apps = KcSdkApp::Api::Apps.new(self)
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



7
8
9
# File 'lib/kc-sdk-app/api.rb', line 7

def access_token
  @access_token
end

#appsObject

Returns the value of attribute apps.



9
10
11
# File 'lib/kc-sdk-app/api.rb', line 9

def apps
  @apps
end

#ordersObject

Returns the value of attribute orders.



8
9
10
# File 'lib/kc-sdk-app/api.rb', line 8

def orders
  @orders
end

Instance Method Details

#resourceObject



17
18
19
20
21
22
23
# File 'lib/kc-sdk-app/api.rb', line 17

def resource
  @resource ||= RestClient::Resource.new(
    "#{KcSdkApp.configuration.api_url}/api/app",
    log: KcSdkApp.configuration.logger,
    headers: { 'Authorization': "Bearer #{self.access_token}" }
  )
end