Ruby client for Centrum Faktur API
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
centrum_faktur.gemspec

README.md

Centrum Faktur

Ruby client for Centrum Faktur API

Installation

gem install centrum_faktur

Usage

Request returns Array or Hash, where keys are strings. When other format than json (default) or yaml is specified, response is not parsed. So for xml and pickle requests, string is returned.

require "centrum_faktur"
client = CentrumFaktur::Client.new(login: "your_login", password: "your-password", subdomain: "your-subodomain")
client.invoice.show("/api/1.0/invoices/1/", format: :xml)

Writing invoice to pdf can be done as follows:

File.open("my-invoice.pdf", "w") { |file| file.write(client.invoice.show("/api/1.0/invoices/1/", format: :pdf)) }

All params that respond to strftime (i.e. Date, Time) will be normalized to format required by API, that is: "YYYY-MM-DD"

Account

Only listing accounts is supported via API

client.account.list

Comment

Listing all comments:

client.comment.list

Or listing comments for given resource:

client.comment.list("/api/1.0/estimates/1/comments/")

Creating comment:

You must pass path to resource comment and required attributes:

client.comment.create("/api/1.0/estimates/1/comments/", {body: "cool", is_public: false})

Estimate

Listing all estimates:

client.estimate.list

Monitoring estimate changes (with optional filter param):

client.estimate.list_updates(updated_since: "2012-01-12")

Creating estimate (check required attributes in API description):

client.estimate.create({})

Updating estimate:

client.estimate.update("/api/1.0/estimates/1/", {})

Removing estimate:

client.estimate.destroy("/api/1.0/estimates/1/")

Invoice

Listing all invoices:

client.invoice.list

Monitoring invoice changes:

client.invoice.list_updates

Displaying invoice:

client.invoice.show("/api/1.0/invoices/1/")

Creating invoice (check required attributes in API description):

client.invoice.create({})

Updating invoice:

client.invoice.update("/api/1.0/invoices/1/", {})

Removing invoice:

client.invoice.destroy("/api/1.0/invoices/1/")

User

Only listing users is supported via API

client.user.list

Continuous Integration

Build Status

Copyright

Created during development for Ragnarson

Copyright © Wojciech Wnętrzak. See LICENSE for details.