Class: Lightspeed::Client
- Inherits:
-
Object
- Object
- Lightspeed::Client
- Defined in:
- lib/lightspeed/client.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
Class Method Summary collapse
Instance Method Summary collapse
- #accounts ⇒ Object
- #categories ⇒ Object
- #customers ⇒ Object
- #delete(url) ⇒ Object
- #get(url, params: {}, relations: []) ⇒ Object
-
#initialize(access_token:, account_id:, configuration: Lightspeed::Configuration.new) ⇒ Client
constructor
A new instance of Client.
- #items ⇒ Object
- #post(url, body: {}) ⇒ Object
- #put(url, body: {}) ⇒ Object
- #sales ⇒ Object
Constructor Details
#initialize(access_token:, account_id:, configuration: Lightspeed::Configuration.new) ⇒ Client
Returns a new instance of Client.
25 26 27 28 29 |
# File 'lib/lightspeed/client.rb', line 25 def initialize(access_token:, account_id:, configuration: Lightspeed::Configuration.new) @access_token = access_token @account_id = account_id @configuration = configuration end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
19 20 21 |
# File 'lib/lightspeed/client.rb', line 19 def access_token @access_token end |
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
19 20 21 |
# File 'lib/lightspeed/client.rb', line 19 def account_id @account_id end |
Class Method Details
Instance Method Details
#accounts ⇒ Object
55 |
# File 'lib/lightspeed/client.rb', line 55 def accounts; API::Accounts.new(self); end |
#categories ⇒ Object
59 |
# File 'lib/lightspeed/client.rb', line 59 def categories; API::Categories.new(self); end |
#customers ⇒ Object
57 |
# File 'lib/lightspeed/client.rb', line 57 def customers; API::Customers.new(self); end |
#delete(url) ⇒ Object
43 44 45 46 47 |
# File 'lib/lightspeed/client.rb', line 43 def delete(url) response = conn.delete(url) rate_limit_wait(response) response end |
#get(url, params: {}, relations: []) ⇒ Object
31 32 33 34 35 |
# File 'lib/lightspeed/client.rb', line 31 def get(url, params: {}, relations: []) response = conn.get(url, params.merge(load_relations: "[#{relation_names(relations)}]")) rate_limit_wait(response) response end |
#post(url, body: {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/lightspeed/client.rb', line 37 def post(url, body: {}) response = conn.post(url, body) rate_limit_wait(response) response end |
#put(url, body: {}) ⇒ Object
49 50 51 52 53 |
# File 'lib/lightspeed/client.rb', line 49 def put(url, body: {}) response = conn.put(url, body) rate_limit_wait(response) response end |