A Ruby interface to the Crunch Accounting API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
templates
test
.gitignore
.travis.yml
Gemfile
Guardfile
LICENSE.txt
README.md
Rakefile
crunch-api.gemspec

README.md

Crunch::Api

Gem Version Build Status

A Ruby interface to the Crunch Accounting API

Installation

Add this line to your application's Gemfile:

gem 'crunch-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install crunch-api

Quick Start Guide

Hurry up and show me how to call the service already...

First you need to register your application with Crunch Accounting using OAuth

Next require the gem:

require 'crunch-api'

Then, copy and paste your OAuth credentials into the configuration:

CrunchApi.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.oauth_token = YOUR_OAUTH_TOKEN
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end

And there you go, you're all set to access some Crunchy goodness

CrunchApi::Supplier.for_id(123)

For more examples of how to use this gem, see the Usage Examples below

Usage Examples

All examples require OAuth configuration to be set in order to authenticate

Get all suppliers

CrunchApi::Supplier.all

Get a specific supplier

CrunchApi::Supplier.for_id(123)

Create a new supplier

CrunchApi::Supplier.create(name: 'Test Supplier')

Update an existing supplier

# using a hash of attributes
CrunchApi::Supplier.update(123, name: 'Test Supplier')

# using an existing supplier
supplier = CrunchApi::Supplier.for_id(123)

CrunchApi::Supplier.update(1, supplier)

Delete a supplier

CrunchApi::Supplier.delete(123)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request