1
Fork 0
blog/_posts/2012-09-21-badbilla-billomat-api-client.md

2 KiB

permalink title published_date layout data
/{{ year }}/{{ month }}/{{ day }}/badbilla-billomat-api-client BadBill - a Billomat API client 2012-09-21 12:58:00 +0200 post.liquid
route
blog

I'm happy to announce the release of my Billomat API client:

BadBill

BadBill is a simple API client for the Billomat API. It allows access to all resources the API offers.

For now only clients and invoices are pure Ruby classes, but all other resources are available trough an easy interface returning Hash-like objects.

My goals for this project:

  • 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).

I'm sure it may include bugs and it's not ready for all use-cases, but as this is open-source now I accept all ideas, improvements, bug reports and pull-requests. Just go to the Github repository and start hacking. ;)

Install it via Rubygems:

gem install badbill

Read the documentation online: BadBill documentation

And now for some code examples:

Basic interface:

bill = BadBill.new "billo", "18e40e14"
# => #<BadBill:0x00000001319d30 ...>
bill.get 'settings'
# => {"settings"=>
#   {"invoice_intro"=>"",
#    "invoice_note"=>"",
#    ...}}

Using defined resources 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