alphagov / trade-tariff-backend

Enabling the population and distribution via API of UK Customs tariffs and duties
MIT License
7 stars 6 forks source link

Refactor API before public launch #122

Closed saulius closed 11 years ago

saulius commented 11 years ago

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: https://github.com/alphagov/trade-tariff-frontend/pull/89

N.B. would be good to deploy these changes separately from currently undeployed changes, test on preview first

The change:

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.:

{
  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
}
matthewford commented 11 years ago

This is looking good for the v1 of the API we can discuss with users if they need anything else, but I'm happy with this output.