Class: Lightspeed::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/lightspeed/client.rb

Constant Summary collapse

API_BASE =
"https://api.merchantos.com/API/"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, account_id:) ⇒ Client

Returns a new instance of Client.



18
19
20
21
# File 'lib/lightspeed/client.rb', line 18

def initialize(access_token:, account_id:)
  @access_token = access_token
  @account_id = 
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



12
13
14
# File 'lib/lightspeed/client.rb', line 12

def access_token
  @access_token
end

#account_idObject (readonly)

Returns the value of attribute account_id.



12
13
14
# File 'lib/lightspeed/client.rb', line 12

def 
  @account_id
end

Class Method Details

.tokens(client_id:, client_secret:, refresh_token:) ⇒ Object



14
15
16
# File 'lib/lightspeed/client.rb', line 14

def self.tokens(client_id:, client_secret:, refresh_token:)
  API::Tokens.new(client_id, client_secret, refresh_token)
end

Instance Method Details

#accountsObject



35
# File 'lib/lightspeed/client.rb', line 35

def accounts; API::Accounts.new(self); end

#categoriesObject



39
# File 'lib/lightspeed/client.rb', line 39

def categories; API::Categories.new(self); end

#customersObject



37
# File 'lib/lightspeed/client.rb', line 37

def customers; API::Customers.new(self); end

#delete(url) ⇒ Object



31
32
33
# File 'lib/lightspeed/client.rb', line 31

def delete(url)
  conn.delete(url)
end

#get(url, params: {}, relations: []) ⇒ Object



23
24
25
# File 'lib/lightspeed/client.rb', line 23

def get(url, params: {}, relations: [])
  conn.get(url, params.merge(load_relations: "[#{relation_names(relations)}]"))
end

#itemsObject



38
# File 'lib/lightspeed/client.rb', line 38

def items; API::Items.new(self); end

#post(url, body: {}) ⇒ Object



27
28
29
# File 'lib/lightspeed/client.rb', line 27

def post(url, body: {})
  conn.post(url, body)
end

#salesObject



36
# File 'lib/lightspeed/client.rb', line 36

def sales; API::Sales.new(self); end