class Lightspeed::Client
Attributes
throttler[RW]
Public Class Methods
new(oauth_token_holder: nil, oauth_token: nil)
click to toggle source
# 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
Public Instance Methods
accounts()
click to toggle source
Returns a list of accounts that you have access to.
# File lib/lightspeed/client.rb, line 21 def accounts @accounts ||= Lightspeed::Accounts.new(context: self) end
delete(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 37 def delete(**args) perform_request(**args, method: :delete) end
get(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 25 def get(**args) perform_request(**args, method: :get) end
oauth_token()
click to toggle source
# File lib/lightspeed/client.rb, line 41 def oauth_token @oauth_token_holder.oauth_token end
post(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 29 def post(**args) perform_request(**args, method: :post) end
put(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 33 def put(**args) perform_request(**args, method: :put) end
refresh_oauth_token()
click to toggle source
# File lib/lightspeed/client.rb, line 45 def refresh_oauth_token @oauth_token_holder.refresh_oauth_token end
Private Instance Methods
perform_request(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 51 def perform_request(**args) @throttler.perform_request request(**args) end
request(**args)
click to toggle source
# File lib/lightspeed/client.rb, line 55 def request **args Lightspeed::Request.new(self, **args) end