Giter VIP home page Giter VIP logo

harvested's Introduction

Harvested: A Ruby Harvest API

This is a Ruby wrapper for the Harvest API.

Installation

gem install harvested

Examples

harvest = Harvest.client(subdomain: 'yoursubdomain', username: 'yourusername', password: 'yourpassword')
harvest.projects.all   # list out projects

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

You can also pass query options in as the last parameter on any objects all finder method, for example to find all the projects for client ID 12345:

harvest = Harvest.client(subdomain: 'yoursubdomain', username: 'yourusername', password: 'yourpassword')
harvest.projects.all(nil, :client => 12345)

Note, the first parameter is a User ID field that is optional, but needs to be specified as nil if not included.

You can pass in any hash of query attributes you wish as per the Harvest API page.

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

Permissions

For most operations you need to be an Admin on the Harvest account. You can do few select things as normal users and project managers, but you will likely get errors.

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(subdomain: 'yoursubdomain', username: 'yourusername', password: 'yourpassword')
harvest.projects.all   # This will wait for the Rate Limit reset if you have gone over your limit

Ruby support

Harvested's tests are currently supports ruby 2.0+

Links

Who are you?

My name is Zach Moazeni. I work for an awesome company. And we're hiring!

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. http://github.com/zmoazeni/harvested/issues/
  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 http://github.com/zmoazeni/harvested
  2. Make your changes with tests
  3. Commit the changes without messing with the Rakefile, or Version
  4. Make an entry to HISTORY.md
  5. 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 API responses. This is a great boon for running the tests offline. While uncommon, sometimes the Harvest API will send an erroneous response, VCR will cache it, and subsequent runs will use the incorrect cached response. In order to clear the cached responses, you can run the specs with the VCR_REFRESH environmental variable set to true (e.g. VCR_REFRESH=true bundle exec rake spec).

Notes on Harvest Estimates

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

harvested's People

Contributors

zmoazeni avatar prsimp avatar markrickert avatar jvdp avatar awd avatar trevoke avatar petemcw avatar manlycode avatar davefp avatar gfrivolt avatar parndt avatar tkwong avatar

Watchers

Mackenzie "Max" Seeley avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.