module Harvest
Constants
- VERSION
Public Class Methods
client(access_token: nil, account_id: nil, client_id: nil)
click to toggle source
Creates a standard client that will raise all errors it encounters
Options¶ ↑
-
Basic Authentication V2
Examples¶ ↑
Harvest.client(access_token: 'token', account_id: '123') Harvest.client(access_token: 'myaccesstoken', client_id: '1')
@return [Harvest::Base]
# File lib/harvested2.rb, line 50 def client(access_token: nil, account_id: nil, client_id: nil) Harvest::Base.new(access_token: access_token, account_id: account_id, client_id: client_id) end
hardy_client(access_token: nil, account_id: nil, client_id: nil, retries: 5)
click to toggle source
Creates a hardy client that will retry common HTTP errors it encounters and sleep() if it determines it is over your rate limit
Options¶ ↑
-
Basic Authentication
Examples¶ ↑
Harvest.hardy_client(access_token: 'token', account_id: '123', retry: 3) Harvest.hardy_client(access_token: 'myaccesstoken', client_id: '1', retries: 3)
Errors¶ ↑
The hardy client will retry the following errors
-
Net::HTTPError
-
Net::HTTPFatalError
-
Errno::ECONNRESET
Rate Limits¶ ↑
The hardy client will make as many requests as it can until it detects it has gone over the rate limit. Then it will +sleep()+ for the how ever long it takes for the limit to reset. You can find more information about the Rate Limiting at www.getharvest.com/api
@return [Harvest::HardyClient] a Harvest::Base
wrapped in a Harvest::HardyClient
@see Harvest::Base
# File lib/harvested2.rb, line 88 def hardy_client(access_token: nil, account_id: nil, client_id: nil, retries: 5) Harvest::HardyClient.new(client( access_token: access_token, account_id: account_id, client_id: client_id), retries) end