Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/morgoth/centrum_faktur
Ruby client for Centrum Faktur API
https://github.com/morgoth/centrum_faktur
Last synced: about 4 hours ago
JSON representation
Ruby client for Centrum Faktur API
- Host: GitHub
- URL: https://github.com/morgoth/centrum_faktur
- Owner: morgoth
- License: mit
- Created: 2011-06-14T17:10:07.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-05-11T21:18:47.000Z (over 11 years ago)
- Last Synced: 2024-12-15T07:41:41.389Z (11 days ago)
- Language: Ruby
- Homepage: https://github.com/morgoth/centrum_faktur
- Size: 144 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Centrum Faktur
Ruby client for [Centrum Faktur API](http://centrumfaktur.pl/api/)
## Installation
```
gem install centrum_faktur
```
## UsageRequest returns Array or Hash, where keys are strings.
When other format than `json` (default) or `yaml` is specified, response is not parsed.
So for `xml` and `pickle` requests, string is returned.```ruby
require "centrum_faktur"
client = CentrumFaktur::Client.new(login: "your_login", password: "your-password", subdomain: "your-subodomain")
`````` ruby
client.invoice.show("/api/1.0/invoices/1/", format: :xml)
```Writing invoice to pdf can be done as follows:
``` ruby
File.open("my-invoice.pdf", "w") { |file| file.write(client.invoice.show("/api/1.0/invoices/1/", format: :pdf)) }
```All params that respond to `strftime` (i.e. Date, Time) will be normalized to format
required by API, that is: `"YYYY-MM-DD"`### Account
Only listing accounts is supported via API
``` ruby
client.account.list
```### Comment
Listing all comments:
``` ruby
client.comment.list
```Or listing comments for given resource:
``` ruby
client.comment.list("/api/1.0/estimates/1/comments/")
```Creating comment:
You must pass path to resource comment and required attributes:
``` ruby
client.comment.create("/api/1.0/estimates/1/comments/", {body: "cool", is_public: false})
```### Estimate
Listing all estimates:
``` ruby
client.estimate.list
```Monitoring estimate changes (with optional filter param):
``` ruby
client.estimate.list_updates(updated_since: "2012-01-12")
```Creating estimate (check required attributes in API description):
``` ruby
client.estimate.create({})
```Updating estimate:
``` ruby
client.estimate.update("/api/1.0/estimates/1/", {})
```Removing estimate:
``` ruby
client.estimate.destroy("/api/1.0/estimates/1/")
```### Invoice
Listing all invoices:
``` ruby
client.invoice.list
```Monitoring invoice changes:
``` ruby
client.invoice.list_updates
```Displaying invoice:
``` ruby
client.invoice.show("/api/1.0/invoices/1/")
```Creating invoice (check required attributes in API description):
``` ruby
client.invoice.create({})
```Updating invoice:
``` ruby
client.invoice.update("/api/1.0/invoices/1/", {})
```Removing invoice:
``` ruby
client.invoice.destroy("/api/1.0/invoices/1/")
```### User ###
Only listing users is supported via API
``` ruby
client.user.list
```## Continuous Integration
[![Build Status](https://api.travis-ci.org/morgoth/centrum_faktur.png)](https://travis-ci.org/morgoth/centrum_faktur)## Copyright
Created during development for [Ragnarson](http://ragnarson.com/)
Copyright © Wojciech Wnętrzak. See LICENSE for details.