Class: Lightspeed::Client
- Inherits:
-
Object
- Object
- Lightspeed::Client
- Defined in:
- lib/lightspeed/client.rb
Instance Attribute Summary collapse
-
#throttler ⇒ Object
Returns the value of attribute throttler.
Instance Method Summary collapse
-
#accounts ⇒ Object
Returns a list of accounts that you have access to.
- #delete(**args) ⇒ Object
- #get(**args) ⇒ Object
-
#initialize(oauth_token_holder: nil, oauth_token: nil) ⇒ Client
constructor
A new instance of Client.
- #oauth_token ⇒ Object
- #post(**args) ⇒ Object
- #put(**args) ⇒ Object
- #refresh_oauth_token ⇒ Object
Constructor Details
#initialize(oauth_token_holder: nil, oauth_token: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/lightspeed/client.rb', line 11 def initialize(oauth_token_holder: nil, oauth_token: nil) @oauth_token_holder = oauth_token_holder @throttler = Lightspeed::RequestThrottler.new raise "Passing an oauth token is no longer supported. Pass a token holder instead." if oauth_token end |
Instance Attribute Details
#throttler ⇒ Object
Returns the value of attribute throttler.
9 10 11 |
# File 'lib/lightspeed/client.rb', line 9 def throttler @throttler end |
Instance Method Details
#accounts ⇒ Object
Returns a list of accounts that you have access to.
19 20 21 |
# File 'lib/lightspeed/client.rb', line 19 def accounts @accounts ||= Lightspeed::Accounts.new(context: self) end |
#delete(**args) ⇒ Object
35 36 37 |
# File 'lib/lightspeed/client.rb', line 35 def delete(**args) perform_request(args.merge(method: :delete)) end |
#get(**args) ⇒ Object
23 24 25 |
# File 'lib/lightspeed/client.rb', line 23 def get(**args) perform_request(args.merge(method: :get)) end |
#oauth_token ⇒ Object
39 40 41 |
# File 'lib/lightspeed/client.rb', line 39 def oauth_token @oauth_token_holder.oauth_token end |
#post(**args) ⇒ Object
27 28 29 |
# File 'lib/lightspeed/client.rb', line 27 def post(**args) perform_request(args.merge(method: :post)) end |
#put(**args) ⇒ Object
31 32 33 |
# File 'lib/lightspeed/client.rb', line 31 def put(**args) perform_request(args.merge(method: :put)) end |
#refresh_oauth_token ⇒ Object
43 44 45 |
# File 'lib/lightspeed/client.rb', line 43 def refresh_oauth_token @oauth_token_holder.refresh_oauth_token end |