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.
13 14 15 16 17 18 |
# File 'lib/lightspeed/client.rb', line 13 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.
11 12 13 |
# File 'lib/lightspeed/client.rb', line 11 def throttler @throttler end |
Instance Method Details
#accounts ⇒ Object
Returns a list of accounts that you have access to.
21 22 23 |
# File 'lib/lightspeed/client.rb', line 21 def accounts @accounts ||= Lightspeed::Accounts.new(context: self) end |
#delete(**args) ⇒ Object
37 38 39 |
# File 'lib/lightspeed/client.rb', line 37 def delete(**args) perform_request(**args, method: :delete) end |
#get(**args) ⇒ Object
25 26 27 |
# File 'lib/lightspeed/client.rb', line 25 def get(**args) perform_request(**args, method: :get) end |
#oauth_token ⇒ Object
41 42 43 |
# File 'lib/lightspeed/client.rb', line 41 def oauth_token @oauth_token_holder.oauth_token end |
#post(**args) ⇒ Object
29 30 31 |
# File 'lib/lightspeed/client.rb', line 29 def post(**args) perform_request(**args, method: :post) end |
#put(**args) ⇒ Object
33 34 35 |
# File 'lib/lightspeed/client.rb', line 33 def put(**args) perform_request(**args, method: :put) end |
#refresh_oauth_token ⇒ Object
45 46 47 |
# File 'lib/lightspeed/client.rb', line 45 def refresh_oauth_token @oauth_token_holder.refresh_oauth_token end |