Fetching contributors…
Cannot retrieve contributors at this time
79 lines (46 sloc) 3.28 KB

Harvested: A Ruby Harvest API

This is a Ruby wrapper for the Harvest API.


gem install harvested


harvest = Harvest.client('yoursubdomain', 'yourusername', 'yourpassword')
harvest.projects() # list out projects

client = => "Billable Company LTD.")
client = harvest.clients.create(client)
harvest.clients.find( # returns a Harvest::Client

You can find more examples in /examples and in the documentation for Harvest::Base

Hardy Client

The guys at Harvest built a great API, but there are always dangers in writing code that depends on an API. For example, HTTP Timeouts, Occasional Bad Gateways, and Rate Limiting issues need to be accounted for.

Using Harvested#client your code needs to handle all these situations. However you can also use Harvested#hardy_client which will retry errors and wait for Rate Limit resets.

harvest = Harvest.hardy_client('yoursubdomain', 'yourusername', 'yourpassword')
harvest.projects() # This will wait for the Rate Limit reset if you have gone over your limit

Ruby support

Harvested's tests are currently passing for 1.8.7, 1.9.2, JRuby 1.6.2, and Rubinius


How to Contribute

If you find what looks like a bug:

  1. Check the GitHub issue tracker to see if anyone else has had the same issue.
  2. If you don’t see anything, create an issue with information on how to reproduce it.

If you want to contribute an enhancement or a fix:

  1. Fork the project on github
  2. Make your changes with tests
  3. Commit the changes without messing with the Rakefile, VERSION, or history
  4. Send me a pull request

Note on running tests: most specs run against a live Harvest account. To run the suite, sign up for a free trial account and fill out /spec/support/harvest_credentials.yml (a sample harvest_credentials.example.yml has been included).

DO NOT USE YOUR NORMAL CREDENTIALS IN /spec/support/harvest_credentials.yml!!! The test suite blasts all the data before running (similiar to DatabaseCleaner).

The tests use VCR to cache the test responses. This is a great boon for running the tests offline. While uncommon, sometimes the Harvest API will send an erroneous response and VCR will cache it, then subsequent runs will use the incorrect cached response. In order to ignore VCR you can run the specs by passing CACHE=false (e.g. CACHE=false bundle rake spec).

Using rvm you can run the tests against the popular ruby runtimes by running:


Each runtime needs to be installed in rvm along with the bundler gem.


  • Write Documentation
  • Allow Timer Toggling

Notes on Harvest Estimates

Estimates aren't currently supported due to lack of an API. If this opens up, harvested will include them.


Copyright (c) 2010-2011 Zach Moazeni. See LICENSE for details.