No commit activity in last 3 years
No release in over 3 years
This is the official Ruby client for the Billimatic API. See http://www.billimatic.com.br for more information.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.11
~> 0.8
~> 1.0.5
~> 1.6.1
 Project Readme

Billimatic API Ruby Client

This is the official Ruby client for the Billimatic API.

Gem Version Build Status Test Coverage Code Climate Grade Inline docs

Installation

Add this line to your application's Gemfile:

gem 'billimatic-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install billimatic-client

Configuration

Use Billimatic.configure to setup your environment:
require 'billimatic'

Billimatic.configure do |config|
  config.host = 'https://sandbox.billimatic.com.br' # defaults to 'https://app.billimatic.com.br'
  config.user_agent = 'My App v1.0' # optional, but you should pass a custom user-agent identifying your app
end

Usage

Given your token, create an instance of Billimatic::Client, as below:
client = Billimatic.client("YOUR_TOKEN_HERE")
Now you have acess to every API endpoint:

Endpoints

HTTP method Endpoint Client method
GET /api/v1/organizations/search?cnpj=:cnpj client.organizations.search(cnpj: cnpj)
POST /api/v1/organizations client.organizations.create(attributes_hash)
PUT /api/v1/organizations/:id client.organizations.update(id, attributes_hash)
DELETE /api/v1/organizations/:id client.organizations.destroy(id)
HTTP method Endpoint Client method
GET /api/v1/organizations/:organization_id/plans client.plans.list(organization_id: id)
POST /api/v1/organizations/:organization_id/plans client.plans.create(attributes_hash, organization_id: id)
PUT /api/v1/organizations/:organization_id/plans/:id client.plans.update(id, attributes_hash, organization_id: id)
DELETE /api/v1/organizations/:organization_id/plans/:id client.plans.destroy(id, organization_id: id)
HTTP method Endpoint Client method
GET /api/v1/subscriptions/token/:token client.subscriptions.show(token: token)
POST /api/v1/subscriptions client.subscriptions.create(attributes_hash)
PATCH /api/v1/subscriptions/:token/change_plan client.subscriptions.change_plan(token: token, new_plan_id: id)
PATCH /api/v1/subscriptions/:token/cancel # cancel_date and cancel_reason are optional arguments
client.subscriptions.cancel(token: token, cancel_date: date, cancel_reason: reason)
HTTP method Endpoint Client method
GET /api/v1/organizations/:organization_id/contracts client.contracts.list(organization_id: id)
GET /api/v1/organizations/:organization_id/contracts/:id client.contracts.show(id, organization_id: id)
GET /api/v1/contracts/search?name=:name client.contracts.search(name: name)
POST /api/v1/contracts client.contracts.create(attributes_hash)
PUT /api/v1/contracts/:id client.contracts.update(id, attributes_hash)
DELETE /api/v1/contracts/:id client.contracts.destroy(id)
HTTP method Endpoint Client method
GET /api/v1/contracts/:contract_id/invoices/search?issue_date_from=:issue_date_from&issue_date_to=:issue_date_to client.invoices.search(contract_id: id, issue_date_from: 'dd-mm-yyyy', issue_date_to: 'dd-mm-yyyy')
GET /api/v1/contracts/:contract_id/invoices/late client.invoices.late(contract_id: id)
PATCH /api/v1/contracts/:contract_id/invoices/:id/block client.invoices.block(id, contract_id: id)
PATCH /api/v1/contracts/:contract_id/invoices/:id/approve client.invoices.approve(id, contract_id: id)
POST /api/v1/contracts/:contract_id/invoices client.invoices.create(attributes_hash, contract_id: id)
GET /api/v1/contracts/:contract_id/invoices/:id client.invoices.show(id, contract_id: id)
PUT /api/v1/contracts/:contract_id/invoices/:id client.invoices.update(id, attributes_hash, contract_id: id)
DELETE /api/v1/contracts/:contract_id/invoices/:id client.invoices.destroy(id, contract_id: id)
HTTP method Endpoint Client method
GET /api/v1/organizations/:organization_id/invoice_templates client.invoice_templates.list(organization_id: id)
GET /api/v1/organizations/:organization_id/invoice_templates/:id client.invoice_templates.show(id, organization_id: id)
HTTP method Endpoint Client method
GET /api/v1/contracts/:contract_id/invoice_rules client.invoice_rules.list(contract_id: id)
POST /api/v1/contracts/:contract_id/invoice_rules client.invoice_rules.create(attributes_hash, contract_id: id)
PUT /api/v1/contracts/:contract_id/invoice_rules/:id client.invoice_rules.update(id, attributes_hash, contract_id: id)
DELETE /api/v1/contracts/:contract_id/invoice_rules/:id client.invoice_rules.destroy(id, contract_id: id)
HTTP method Endpoint Client method
GET /api/v1/companies/search?cnpj=:cnpj client.companies.search(cnpj)
GET /api/v1/companies client.companies.list
POST /api/v1/companies client.companies.create(attributes_hash)
GET /api/v1/companies/:id client.companies.show(id)
PATCH /api/v1/companies/:id client.companies.update(id, attributes_hash)
DELETE /api/v1/companies/:id client.companies.destroy(id)
HTTP method Endpoint Client method
GET /api/v1/people/search?cpf=:cpf client.people.search(cpf: cpf)
GET /api/v1/people client.people.list
POST /api/v1/people client.people.create(attributes_hash)
GET /api/v1/people/:id client.people.show(id)
PUT /api/v1/people/:id client.people.update(id, attributes_hash)
DELETE /api/v1/people/:id client.people.destroy(id)
HTTP method Endpoint Client method
GET /api/v1/service_items/search?name=:name client.service_items.search(name: name)
GET /api/v1/service_items client.service_items.list
POST /api/v1/service_items client.service_items.create(attributes_hash)
PUT /api/v1/service_items/:id client.service_items.update(id, attributes_hash)
DELETE /api/v1/service_items/:id client.service_items.destroy(id)
HTTP method Endpoint Client method
GET /api/v1/organizations/:organization_id/email_templates/:id client.email_templates.list(organization_id: id)

Url helpers

Some url helpers are available:

Checkout

Billimatic.url_helpers.checkout_url(token: "some-subscription-token")

Subscription dashboard

Billimatic.url_helpers.subscription_dashboard_url(token: "some-subscription-token")

Change plan

Billimatic.url_helpers.change_plan_url(token: "some-subscription-token", plan_id: 52)

Callbacks

TODO

Contributing

  1. Fork it ( https://github.com/[my-github-username]/billimatic-client-ruby/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