alphagov/trade-tariff-backend — pull request #122 by sauliusg (2013-10-29 14:55:55+00:00)
Title: Refactor API before public launch

This change is for https://www.pivotaltracker.com/story/show/36718669 and partly covers https://www.pivotaltracker.com/story/show/58242830

Should be merged with pull request on frontend app:

The change:

* moves formatting logic from frontend app to backend
* hides TARIC/CHIEF specific entities and names in the API.
* improves spec coverage, fixes some flaky specs
* should have positive effect on api response speed, because we're sending formatted duty expressions instead of all their components.

Also:

Updates rabl because it added support for partial local variables
Updates therubyracer to avoid gem installation errors, same was done in
static

API response now contain less TARIC and CHIEF related terms that require some additional knowledge to make use, basically you get what you see on Tariff commodity page, e.g.:

```json
{
id: 2999305,
origin: "eu",
effective_start_date: "2008-01-01T00:00:00+00:00",
effective_end_date: null,
import: true,
measure_type: {
id: "119",
description: "Airworthiness tariff suspension"
},
duty_expression: {
base: "0.00 %",
national_measurement_units: null
},
legal_act: {
generating_regulation_code: "R1147/02",
url: "http://eur-lex.europa.eu/Result.do?code=32002R1147&RechType=RECH_celex",
suspended: false
},
measure_conditions: [
{
condition: "Presentation of a certificate/licence/document",
document_code: "A119",
requirement: "Certificate of authenticity: Airworthiness certificate or declaration in the commercial invoice containing the elements of the airworthiness certificate issued or a document annexed to the invoice.",
action: "Apply the mentioned duty",
duty_expression: ""
}
],
geographical_area: {
id: "1011",
description: "ERGA OMNES",
children_geographical_areas: []
},
excluded_countries: [ ],
footnotes: [
{
code: "CD333",
description: "Airworthiness tariff suspension is conditional upon presentation of an airworthiness certificate or invoice declaration or a document annexed thereto (Reg. (EC) nr. 1147/2002, OJ L170/2002).",
formatted_description: "Airworthiness tariff suspension is conditional upon presentation of an airworthiness certificate or invoice declaration or a document annexed thereto (Reg. (EC) nr. 1147/2002, OJ L170/2002)."
}
],
order_number: null
}
```