Class: BookingSync::Engine::APIClient
- Inherits:
-
API::Client
- Object
- API::Client
- BookingSync::Engine::APIClient
- Defined in:
- lib/bookingsync/engine/api_client.rb
Instance Method Summary collapse
- #call(method, path, data = nil, options = nil) ⇒ Object
-
#initialize(token, options = {}) ⇒ APIClient
constructor
A new instance of APIClient.
Constructor Details
#initialize(token, options = {}) ⇒ APIClient
Returns a new instance of APIClient.
2 3 4 5 |
# File 'lib/bookingsync/engine/api_client.rb', line 2 def initialize(token, = {}) super @account = [:account] end |
Instance Method Details
#call(method, path, data = nil, options = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bookingsync/engine/api_client.rb', line 7 def call(method, path, data = nil, = nil) tries ||= 1 super rescue BookingSync::API:: => error if refresh_token?(error) && (tries -= 1) >= 0 @token = @account.refresh_token!.token retry else raise end end |