Project

fs_api

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby-Api library for factuursturen.nl
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 10.0
~> 3.2
~> 1.21
 Project Readme

Gem Version Build StatusCode Climate

FsApi

Gem to interface with the factuursturen.nl invoicing API

Still some issues, upon api calls the server sends back json with stringified floats/integers/booleans ("true", "1" etc.), for the booleans a conversion is in place, for the others there isn't yet.

Use the docs at https://www.factuursturen.nl/docs/api_v1.pdf for more information on the api. Note that there are inconsistencies between the docs and what the api actually does. E.g. required fields that are not required.

Installation

Add this line to your application's Gemfile:

gem 'fs_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fs_api

Usage

Initialization

api_client = FsApi::Client.new(username, api_key)

or

FsApi.configure do |config|
  config.api_key = '...'
  config.username = '...'
end

api_client = FsApi.new

After initialization

# Retrieve all products
api_client.products.all

# Retrieve all clients
api_client.clients.all

# Retrieve all invoices
api_client.invoices.all

# Find an invoice
api_client.invoices.find(invoice_number)

# Create an invoice
invoice = api_client.invoices.build({clientnr: '1'})
api_client.invoices.save(invoice)

# or shorthand
invoice = api_client.invoices.create({clientnr: '1'})

# Returns false when it fails
api_client.invoices.save(invoice)

# Has the errors of the last api operation
invoice.errors

# Delete an invoice
api_client.invoices.delete(invoice)

# Search in all fields of invoices
api_client.invoices.search('john')

# Search in city field of invoices
api_client.invoices.search(city: 'john')

Todo

  • Handle rate limiting
  • Refactor base service so services can choose to implement parts
  • Implement saved invoices resource
  • Implement search
  • Implement invoice payment registration

Contributing

  1. Fork it ( https://github.com/maartenvanvliet/fs_api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request