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