module Harvest
Constants
- VERSION
Public Class Methods
Creates a standard client that will raise all errors it encounters
Options¶ ↑
-
Basic Authentication
-
OAuth
-
:access_token
- An OAuth 2.0 access token
-
Examples¶ ↑
Harvest.client(subdomain: 'mysubdomain', username: 'myusername', password: 'mypassword') Harvest.client(access_token: 'myaccesstoken')
@return [Harvest::Base]
# File lib/harvested.rb, line 44 def client(subdomain: nil, username: nil, password: nil, access_token: nil) Harvest::Base.new(subdomain: subdomain, username: username, password: password, access_token: access_token) end
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
-
OAuth
-
:access_token
- An OAuth 2.0 access token
-
-
:retry
- How many times the hardy client should retry errors. Set to5
by default.
Examples¶ ↑
Harvest.hardy_client(subdomain: 'mysubdomain', username: 'myusername', password: 'mypassword', retry: 3) Harvest.hardy_client(access_token: 'myaccesstoken', 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/harvested.rb, line 78 def hardy_client(subdomain: nil, username: nil, password: nil, access_token: nil, retries: 5) Harvest::HardyClient.new(client(subdomain: subdomain, username: username, password: password, access_token: access_token), retries) end