Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maartenvanvliet/fs_api
Api library to interface with factuursturen.nl
https://github.com/maartenvanvliet/fs_api
Last synced: about 2 months ago
JSON representation
Api library to interface with factuursturen.nl
- Host: GitHub
- URL: https://github.com/maartenvanvliet/fs_api
- Owner: maartenvanvliet
- License: mit
- Created: 2015-11-25T16:18:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-23T10:06:19.000Z (about 7 years ago)
- Last Synced: 2024-10-31T14:28:19.575Z (2 months ago)
- Language: Ruby
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Gem Version](https://badge.fury.io/rb/fs_api.svg)](https://badge.fury.io/rb/fs_api) [![Build Status](https://travis-ci.org/maartenvanvliet/fs_api.svg)](https://travis-ci.org/maartenvanvliet/fs_api)[![Code Climate](https://codeclimate.com/github/maartenvanvliet/fs_api/badges/gpa.svg)](https://codeclimate.com/github/maartenvanvliet/fs_api)
# FsApi
Gem to interface with the [factuursturen.nl](https://www.factuursturen.nl/?a=1552)
invoicing APIStill 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:
```ruby
gem 'fs_api'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install fs_api
## Usage
### Initialization
```ruby
api_client = FsApi::Client.new(username, api_key)
```or
```ruby
FsApi.configure do |config|
config.api_key = '...'
config.username = '...'
endapi_client = FsApi.new
```### After initialization
```ruby
# 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