Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/badboy/badbill

A client for the Billomat API
https://github.com/badboy/badbill

Last synced: about 2 months ago
JSON representation

A client for the Billomat API

Awesome Lists containing this project

README

        

BadBill - Billomat API Client
===================

(developed for internal use at [rrbone](http://www.rrbone.net))

Simple but working API client for the [Billomat API][apidocu].

See the [API documentation][apidocu] 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](http://www.billomat.com/en/api/clients/) (`BadBill::Client`)
* [invoices](http://www.billomat.com/en/api/invoices/) (`BadBill::Invoice`)
* [invoice-payments](http://www.billomat.com/en/api/invoices/payments/) (`BadBill::InvoicePayment`)
* [invoice-items](http://www.billomat.com/en/api/invoices/items/) (`BadBill::InvoiceItem`)
* [invoice-comments](http://www.billomat.com/en/api/invoices/comments) (`BadBill::InvoiceComment`)
* [recurring](http://www.billomat.com/en/api/recurrings/) (`BadBill::Recurring`)

Implementing new resources is easy. Pull Requests for others are welcome.

## Requirements

* [yajl-ruby](https://github.com/brianmario/yajl-ruby)
* [faraday](https://github.com/technoweenie/faraday)
* [faraday_middleware](https://github.com/pengwynn/faraday_middleware)
* [hashie](https://github.com/intridea/hashie)

## 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"
# => #
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
# => [#], ...]

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](http://rubydoc.info/github/badboy/badbill/master/frames).

Generate locale documentation with `rake doc` ([yard](http://yardoc.org/) required).
Required Parameters and possible values won't be documentated here. See the [API documentation][apidocu] for that.

## Contribute

See [CONTRIBUTING.md](/badboy/badbill/blob/master/CONTRIBUTING.md) for info.

## License

See [LICENSE](/badboy/badbill/blob/master/LICENSE) for info.

[apidocu]: http://www.billomat.com/en/api/