Sha256: 331a882db804c86c111ba68b71589144dad33107d6770784e5b5bb2f18310ff1
Contents?: true
Size: 500 Bytes
Versions: 11
Compression:
Stored size: 500 Bytes
Contents
class BookingSync::Engine::APIClient < BookingSync::API::Client def initialize(token, options = {}) super @account = options[:account] end def call(method, path, data = nil, options = nil) tries ||= 1 super rescue BookingSync::API::Unauthorized => e token_expired = e.headers["www-authenticate"].include?("The access token expired") if token_expired && (tries -= 1) >= 0 @token = @account.refresh_token!.token retry else raise end end end
Version data entries
11 entries across 11 versions & 1 rubygems