Git Product home page Git Product logo

harvest-client's Introduction

A Harvest Java Client

CircleCI Download codecov Known Vulnerabilities

harvest-client is a Java client for the Harvest REST API (https://help.getharvest.com/api-v2/)

Javadoc

Introduction

With harvest-client you can use the Harvest v2 API with a nice Java interface:

// Load configuration from application.conf in src/main/resources of your application
Harvest harvest = new Harvest();
// list all users
List<User> users = harvest.users().list();

for (User user : users) {
    log.debug("Found user: {}", user);
}
// create new user
User userInfo = ImmutableUser.builder()
                .firstName("first")
                .lastName("last")
                .email("[email protected]")
                .build();

User newUser = harvest.users().create(userInfo);

Have a look in the test folders for examples. Each API endpoint has a Create, List and Update test class.

Download

Download

Gradle

compile 'ch.aaap:harvest-client:$version'

Maven

<dependency>
  <groupId>ch.aaap</groupId>
  <artifactId>harvest-client</artifactId>
  <version>$version</version>
</dependency>

Getting started with Development

Prerequisites

  • Java 8 (or higher)
  • Gradle

Run the build end tests

  • Clone or fork this repository
  • Get a personal access token from Harvest
    • Attention: unit tests assume admin access. Don't run them against a production account!
  • Configuring your Harvest account id and authentication token:
    • You will need 2 Harvest accounts with admin access (it's a limitation of the current Harvest API)
    • Either copy reference.conf to src/test/resources/admin{1,2}.conf and insert your credentials
    • Or set the following environment properties:
        $ export HARVEST_ACCOUNT_ID_ADMIN1=YOUR_ACCT_ID_1
        $ export HARVEST_AUTH_TOKEN_ADMIN1=YOUR_AUTH_TOKEN_1
        $ export HARVEST_ACCOUNT_ID_ADMIN2=YOUR_ACCT_ID_2
        $ export HARVEST_AUTH_TOKEN_ADMIN2=YOUR_AUTH_TOKEN_2
  • Run gradle build in the root directory of the repository

Debugging

You can see the actual HTTP request and response by setting the log level for ch.aaap.harvestclient.core.Harvest.http to TRACE

Log4j2

<Logger name="ch.aaap.harvestclient.core.Harvest.http" level="trace" additivity="false">
    <AppenderRef ref="Console"/>
</Logger>

Found an Harvest Bug?

Check out TestSetupUtil.prepareForHarvestBugReport() to setup your logs before sending them to Harvest.

Contributing

We welcome contributions in the form of pull requests or bug reports! Please read Developers before submitting a pull request. If you plan a big change, please open an issue first so you can get early feedback on your design.

harvest-client's People

Contributors

dan-m avatar mnembrini avatar

Watchers

 avatar  avatar  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.