0.0
No release in over a year
Interact with the Harvest Forecast API from your Ruby application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0

Runtime

>= 0
 Project Readme

Forecasting

Gem Version Tests

A Ruby gem to interact with the Harvest Forecast API. Please note that there is currently no official public API. This API client has been made by inspecting network requests using the Forecast website. This library is based on the excellent Harvesting gem.

Installation

Add this line to your application's Gemfile:

gem 'forecasting'

And then execute:

$ bundle

Or install it yourself as:

$ gem install forecasting

Usage

In order to start using this gem you will need your personal token and an account id:

You can find these details over here: https://id.getharvest.com/developers

If you don't specify values for access_token or account_id, it will default to these environment variables:

  • ENV['FORECAST_ACCESS_TOKEN']
  • ENV['FORECAST_ACCOUNT_ID']
# $ export FORECST_ACCESS_TOKEN=xxx
# $ export FORECAST_ACCOUNT_ID=12345678
client = Forecasting::Client.new
client.whoami
=> #<Forecasting::Models::User:0x000000010488e370 @attributes={"id"=>212737, ... }>

If the access token or account id is invalid a Forecasting::AuthenticationError will be raised:

client = Forcasting::Client.new(access_token: "foo", account_id: "bar")
client.whoami
=> #<Forecasting::AuthenticationError: {"reason":"non-existent-token","account_id":"bar"}>

With a valid access token and account id:

client = Forecasting::Client.new(access_token: "<your token here>", account_id: "<your account id here>")
user = client.whoami
#<Forecasting::Models::User:0x000000010e238ac0 @attributes={"id"=>212737, ... }>

user.id
# => 212737

Releases

To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

License

The gem is available as open source under the terms of the MIT License.