<commit_before># Moneybird [![Build Status](https://travis-ci.org/maartenvanvliet/moneybird.svg?branch=master)](https://travis-ci.org/maartenvanvliet/moneybird) [![Code Climate](https://codeclimate.com/github/maartenvanvliet/moneybird/badges/gpa.svg)](https://codeclimate.com/github/maartenvanvliet/moneybird) [![Test Coverage](https://codeclimate.com/github/maartenvanvliet/moneybird/badges/coverage.svg)](https://codeclimate.com/github/maartenvanvliet/moneybird/coverage)

Gem to talk to the Moneybird REST API. Right now you'll need to get a 'bearer' token for the client to work, oauth2 support may added later. This gem is still under construction and any methods may still change signature without notice until 1.0 is released.

The library is modelled after http://developer.moneybird.com/ Any inconsistencies or errors in the documentation may also be present in the library.

Feel free to file Pull Requests

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'moneybird'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install moneybird

## Usage

```ruby
# Client uses bearer token (see: http://developer.moneybird.com/authentication/)
Moneybird::Client.new('<PASSWORD>')

# List administrations
administrations = client.administrations

administration = administrations.first

# List invoices
administration.sales_invoices.all

# List contacts
administration.contacts.all

# Find contact
administration.contacts.find(moneybird_id)

# Find contact by customer id
administration.contacts.find_by_customer_id(customer_id)

# Create contact
administrations.contacts.create(company_name: 'ACME', firstname: 'Foo', lastname: 'Bar')

# Update contact
contact = administration.contacts.all.first
contact.company_name = 'Something new'
administrations.contacts.save(contact)

# Delete contact
administrations.contacts.delete(contact)<commit_msg>Administration is singular<commit_after># Moneybird [![Build Status](https://travis-ci.org/maartenvanvliet/moneybird.svg?branch=master)](https://travis-ci.org/maartenvanvliet/moneybird) [![Code Climate](https://codeclimate.com/github/maartenvanvliet/moneybird/badges/gpa.svg)](https://codeclimate.com/github/maartenvanvliet/moneybird) [![Test Coverage](https://codeclimate.com/github/maartenvanvliet/moneybird/badges/coverage.svg)](https://codeclimate.com/github/maartenvanvliet/moneybird/coverage)

Gem to talk to the Moneybird REST API. Right now you'll need to get a 'bearer' token for the client to work, oauth2 support may added later. This gem is still under construction and any methods may still change signature without notice until 1.0 is released.

The library is modelled after http://developer.moneybird.com/ Any inconsistencies or errors in the documentation may also be present in the library.

Feel free to file Pull Requests

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'moneybird'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install moneybird

## Usage

```ruby
# Client uses bearer token (see: http://developer.moneybird.com/authentication/)
Moneybird::Client.new('fe3f7f9e239e7d925f9caf695028e60fd3e5c2085f7aebb983cea731dea6b44f')

# List administrations
administrations = client.administrations

administration = administrations.first

# List invoices
administration.sales_invoices.all

# List contacts
administration.contacts.all

# Find contact
administration.contacts.find(moneybird_id)

# Find contact by customer id
administration.contacts.find_by_customer_id(customer_id)

# Create contact
administration.contacts.create(company_name: 'ACME', firstname: 'Foo', lastname: 'Bar')

# Update contact
contact = administration.contacts.all.first
contact.company_name = 'Something new'
administrations.contacts.save(contact)

# Delete contact
administrations.contacts.delete(contact)
{'fraction_non_alphanumeric': 0.09984480082772892, 'fraction_numerical': 0.010605276771857217, 'mean_word_length': 5.893048128342246, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2688507', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1149, 'n_words': 305}