Reaper generates IIF files from invoice data stored in Harvest
Reaper is configured with environment variables. The following environment variables are required:
HARVEST_OAUTH_ID
- the OAuth ID of your Harvest applicationHARVEST_OAUTH_SECRET
- the OAuth Secret of your Harvest applicationSECRET_TOKEN
- the secret token used by Rails for verifying signed cookies
Optional variables:
AIRBRAKE_KEY
- An Airbrake API keyGOOGLE_ANALYTICS_ID
- A Google Analytics tracking IDTYPEKIT_URL
- Your Typekit URL, for the optimal typography experienceUSERVOICE_TOKEN
- The last part of your Uservoice URLNEW_RELIC_LICENSE_KEY
- A NewRelic license keyNEW_RELIC_APP_NAME
- The name you'd like to use in NewRelicWEB_CONCURRENCY
- The number of Unicorn workers to spawn
Be sure you have SQLite3 installed, Postgres installed, a JS runtime, and can install Nokogiri.
Then, prepare your environment by running bundle install
.
Run guard
to run specs.
To configure Harvest for local development without using environment variables, run:
cp config/settings.yml config/settings/development.local.yml
cp config/settings.yml config/settings/test.local.yml
Then, obtain a Client ID and Client Secret by creating an OAuth2 Client in your Harvest account's settings, at https://yourharvestorganization.harvestapp.com/oauth2_clients.
Use http://localhost:PORT
for the Website URL and http://localhost:PORT/auth/harvest/callback
for the Redirect URI values.
Copy the Client ID and Client secret into the aforementioned YAML files, and you'll be able to hack on Reaper.
If, for whatever reason, you need to regenerate the VCR cassettes, you'll need to have a harvest.access_token
setting, ideally in config/settings/test.local.yml
.
To get such a token, first follow the above steps to configure your local app as an OAuth2 Client.
Then, sign up for your local app, and once you've been redirected back to Reaper, run rails runner 'puts User.order(:updated_at).last.access_token'
.
You should see a long string of text: this is your access token.
If you'd like to use the Vagrant box in the repo, be sure to install the vagrant-berkshelf and vagrant-omnibus Vagrant plugins.
Once you've got those installed, a vagrant up
ought to do the trick.
When a user authenticates via Harvest, we retrieve the first page of their outstanding invoices (at most 50 invoices). For the first 40 of those, we retrieve detailed invoice information, which allows us to access the invoice's line items.
A user then selects invoices to export, and clicks the Export button. We generate an IIF file from these invoices and their associated line items.
An IIF File has a header row, followed by a list of invoices. Each invoice may have a subsequent list of line items. A line with an invoice begins with TRNS, and a line with a line item begins with SPL. An invoice and its line items are followed by a line containing only ENDTRNS.
Reaper is licensed under the GPLv3. See LICENSE for details.