Ruby client for Centrum Faktur API
gem install centrum_faktur
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"
Only listing accounts is supported via API
client.account.listListing all comments:
client.comment.listOr 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})Listing all estimates:
client.estimate.listMonitoring 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/")Listing all invoices:
client.invoice.listMonitoring invoice changes:
client.invoice.list_updatesDisplaying 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/")Only listing users is supported via API
client.user.listCreated during development for Ragnarson
Copyright © Wojciech Wnętrzak. See LICENSE for details.
