Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

harvested2

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harvested2

  • 5.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Harvested: A Ruby Harvest API V2

Build Status

This is a Ruby wrapper for the Harvest API V2

Installation

gem install harvested2

Requirements

  • Personal Access Token or OAuth2 application credentials

You can get them at https://id.getharvest.com/developers

Examples

harvest = Harvest.client(access_token: 'token', account_id: '123')
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 object's all finder method, for example to find all the projects for client ID 12345:

harvest = Harvest.client(access_token: 'token', account_id: '123')
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 V2 page.

You can find more examples at Harvested Examples

Permissions

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

Hardy Client

The team 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(access_token: 'token', account_id: '123')
harvest.projects.all # This will wait for the Rate Limit reset if you have gone over your limit

Ruby support

Harvested's tests currently support Ruby version 2.1+

FAQs

Package last updated on 11 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc