Jortt API Client
Clone or download
Latest commit 50329f8 Nov 22, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add the invoice credit action Nov 22, 2018
spec Write a dummy spec for credit invoices Nov 22, 2018
.gitignore Initial commit Mar 28, 2014
.ruby-version Upgrade dependencies Jan 26, 2018
.travis.yml Bye bye rubocop Jan 26, 2018
Gemfile Rename gem to jortt Aug 19, 2015
LICENSE.txt Initial commit Mar 28, 2014
README.md Merge pull request #11 from jorttbv/get-invoice-by-id Jun 26, 2017
Rakefile Bye bye rubocop Jan 26, 2018
jortt.gemspec Bye bye rubocop Jan 26, 2018

README.md

Jortt REST API client

Inline docs Code Climate Code Coverage Build Status

A Ruby interface to the Jortt REST API.

Usage

To create a jortt client:

jortt = Jortt.client(
  app_name: "application-name-as-chosen-on-jortt.nl",
  api_key: "api-key-as-provided-by-jortt.nl"
)

Customers

All customers (jortt.customers.all(page: 2, per_page: 25)) returns:

[{
  company_name: 'Jortt',
  address: {
    street: "Transistorstraat 71C",
    postal_code: "1322 CK",
    city: "Almere",
    country_code: "NL"
  }
},
{
  company_name: 'Zilverline',
  address: {
    street: "Cruquiusweg",
    ...
  }
},
...
page: 2,
per_page: 25
]

Searching customers (jortt.customers.search('Jortt')) returns:

[{
  company_name: 'Jortt',
  address: {
    street: "Transistorstraat 71C",
    postal_code: "1322 CK",
    city: "Almere",
    country_code: "NL"
  }
},
{
  company_name: 'ttroj',
  address: {
    street: "Jorttweg",
    ...
  }
}]

Adding customers:

jortt.customers.create(
  company_name: "Jortt B.V.",
  attn: "Vibiemme", # Optional
  extra_information: "The best cofee maker!", # Optional
  address: {
    street: "Transistorstraat 71C",
    postal_code: "1322 CK",
    city: "Almere",
    country_code: "NL"
  }
)

Invoices

Get invoices by ID (jortt.invoices.get('934d59dd-76f6-4716-9e0f-82a618e1be21')) returns:

{
  "invoice_id": "934d59dd-76f6-4716-9e0f-82a618e1be21",
  "recipient": {
    "company_name": "Zilverline B.V.",
    "attn": null,
    "address": {
      "street": "Cruquisweg 109F",
      "city": "Amsterdam",
      "postal_code": "1111SX",
      "country": {
        "code": "NL",
        "name": "Nederland"
      }
    },
    "email": "ben@jortt.nl",
    "customer_id": "e1c5e15b-e34e-423e-a291-4ed43226a190",
    "extra_information": null,
    ...
  }
  ...
}

Searching invoices (jortt.invoices.search('201606-012')) returns:

[
  {
    "invoice_id": "934d59dd-76f6-4716-9e0f-82a618e1be21",
    "recipient": {
      "company_name": "Zilverline B.V.",
      "attn": null,
      "address": {
        "street": "Cruquisweg 109F",
        "city": "Amsterdam",
        "postal_code": "1111SX",
        "country": {
          "code": "NL",
          "name": "Nederland"
        }
      },
      "email": "ben@jortt.nl",
      "customer_id": "e1c5e15b-e34e-423e-a291-4ed43226a190",
      "extra_information": null,
      "shift_vat": null,
      "vat_number": null,
      "payment_term": 30
    },
    "recipient_in_eu": true,
    "organization": {
      "company_name": "Jortt BV",
      "company_name_line_2": null,
      "address": {
        "street": "Straat 1",
        "city": "Amsterdam",
        "postal_code": "1000 AA",
        "country": {
          "code": "NL",
          "name": "Nederland"
        }
      },
      "phonenumber": null,
      "bank_information": {
        "bic": "RABONL2U",
        "iban": "NL50RABO0150000001",
        "in_the_name_of": "Jortt B.V.",
        "description": null
      },
      "coc_number": "unique number",
      "vat_number": "NL821898279B01",
      "profession": null,
      "healthcare_data": null,
      "free_of_vat": false,
      "finance_email": "Jortt BV <compleet@jortt.nl>"
    },
    "line_items": [
      {
        "description": "Scrum",
        "vat": "0.21",
        "amount": "-100.0",
        "total_amount_ex_vat": "-100.0",
        "currency": "EUR",
        "quantity": "1.0"
      }
    ],
    "invoice_currency": null,
    "invoice_total": "-100.0",
    "invoice_total_incl_vat": "-121.0",
    "invoice_number": "201607-011",
    "invoice_status": "paid",
    "invoice_due_date": "2016-08-06",
    "invoice_date": "2016-07-07",
    "invoice_delivery_period": "2016-07-01",
    "invoice_remarks": null,
    "invoice_language": "nl",
    "invoice_reference": null
  }
]

Adding invoices:

jortt.invoices.create(
  customer_id: "123456789", # Optional
  delivery_period: "31-12-1234", # Optional
  reference: "my-reference", # Optional
  line_items: [
    {vat: 21, amount: 1359.50, quantity: 1, description: "Scrum Training"}
  ]
)

Sending invoices:

jortt.invoice(:invoice_id).send_invoice(
  mail_data: {
    to: 'ben@jortt.nl', # optional
    subject: 'Thank you for your assignment', # optional
    body: 'I hereby send you the invoice', # optional
  },
  invoice_date: Date.today, # optional
  payment_term: 7, # optional
  language: 'nl', # optional
  send_method: 'email', # optional
)

Documentation

Check https://app.jortt.nl/api-documentatie for more info.

Development

Running tests

bundle install and then rake spec or rspec spec.

Building the gem

rake build and then rake install to test it locally (irb followed by require 'jortt/client' and do your stuff).

Releasing the gem

Make a fix, commit and push. Make sure the build is green. Then bump the version (edit lib/jortt/client/version.rb). Now rake release and follow the instructions (you need a rubygems.org account and permissions ;-)).

Otherwise gem build jortt.gemspec and gem push jortt-[version].gem.