We strive to make the ABRA Flexi REST API easy for developers to use. That's why there's a mode that simplifies working with Ruby on Rails, or more precisely, Active Resource.
⚠️ Ruby on Rails support is currently experimental.
Enabling the mode
The mode is enabled with the ?mode=ruby parameter in the URL. The output XML will then contain results in the format expected by Active Resource, and support for pluralizing evidence names (Invoice → Invoices) will be enabled:
# GET /invoices.xml?mode=ruby
Invoice.find(:all, :params => { :mode => 'ruby' })
The mode parameter accepts only one value — lowercase ruby. Any other value results in a 400 error with the message No enum constant …, so even a typo is immediately detected.
What changes in the output
The standard output has a root element of winstrom:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<faktura-vydana>
<id>1</id>
</faktura-vydana>
</winstrom>
With the ?mode=ruby parameter, the root element is named after the evidence, so the response matches the way Active Resource maps collections to classes:
<?xml version="1.0" encoding="utf-8"?>
<faktura-vydana version="1.0">
<faktura-vydana>
<id>1</id>
</faktura-vydana>
</faktura-vydana>
English evidence names
Some evidences have an English alias that can be used in the URL instead of the Czech name. Without the mode parameter, the server responds with a 301 redirect to the canonical address; with ?mode=ruby, it returns the data directly with a 200 status, which is important for Active Resource.
URL alias | Evidence |
|
|
|
|
|
|
|
|
|
|
|
|
🚨 There are only a few aliases, and they are neither complete nor consistent — for most evidences, no English name exists and 404 will be returned. In your integrations, always use the Czech evidence names; treat the alias only as a convenience for Active Resource.
A complete list of evidences along with their canonical names is returned by:
GET https://demo.flexibee.eu/c/demo/evidence-list.json
