BadBill - Billomat API Client
(developed for internal use at rrbone)
Simple but working API client for the Billomat API.
See the API documentation for full documentation of all resources.
Features
- Fast and easy access to all resources the API provides (not all resources are Ruby classes, yet)
- Full documentation.
- Test coverage as best as I can.
- Production-ready (it's for a job project).
What's working right now
The basic BadBill class allows access to all resources. It includes no syntactic sugar to work with, instead it just returns the data as a hash. This works for basic usage.
The following resources are currently implemented as its own class:
-
clients (
BadBill::Client
) -
invoices (
BadBill::Invoice
) -
invoice-payments (
BadBill::InvoicePayment
) -
invoice-items (
BadBill::InvoiceItem
) -
invoice-comments (
BadBill::InvoiceComment
) -
recurring (
BadBill::Recurring
)
Implementing new resources is easy. Pull Requests for others are welcome.
Requirements
Installation
BadBill is just a gem install badbill
away. Get an API key for the Billomat API on your profile page.
Examples
Basic Usage
bill = BadBill.new "billo", "18e40e14"
# => #<BadBill:0x00000001319d30 ...>
bill.get 'settings'
# => {"settings"=>
# {"invoice_intro"=>"",
# "invoice_note"=>"",
# ...}}
bill.put 'settings', settings: { invoice_intro: "Intro" }
# => {"settings"=>
# {"invoice_intro"=>"Intro",
# "invoice_note"=>"",
# ...}}
Using defined resource classes
BadBill.new "billo", "18e40e14"
BadBill::Invoice.all
# => [#<BadBill::Invoice:0x000000024caf98 @id="1" @data={...}>], ...]
invoice = BadBill::Invoice.find(1)
invoice.pdf
# => {"id"=>"1",
# "created"=>"2012-09-17T13:58:42+02:00",
# "invoice_id"=>"322791",
# "filename"=>"Invoice 322791.pdf",
# "mimetype"=>"application/pdf",
# "filesize"=>"90811",
# "base64file"=>"JVBERi0xLjM..."}
invoice.delete
# => true
BadBill::Invoice.create client_id: 1, date: "2012-09-18", note: "Thank you for your order", ...
Documentation
Documentation is online at rubydoc.info.
Generate locale documentation with rake doc
(yard required).
Required Parameters and possible values won't be documentated here. See the API documentation for that.
Contribute
See CONTRIBUTING.md for info.
License
See LICENSE for info.