Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update data source for World Location methods #1203

Merged
merged 3 commits into from
Jul 19, 2023
Merged

Conversation

brucebolt
Copy link
Member

@brucebolt brucebolt commented Jul 18, 2023

These methods currently returns data retrieved from the Whitehall API, which is being deprecated.

Therefore updating the method to get the data from the World Content Item.

We need to transform the response to ensure the output remains as backwards compatible with previous versions of this gem as possible. However a breaking change has been introduced, as pagination of the World Locations endpoint has been removed.

The following applications use the affected methods and will be updated in the following PRs (once this a new version of this gem has been released):

Trello card

This method currently returns data retrieved from the Whitehall API,
which is being deprecated.

Therefore updating the method to get the data from the World Content
Item.

We need to transform the response to ensure the output remains backwards
compatible with previous versions of this gem.

====

Example:

Response using Whitehall API

```
=> {"id"=>"https://www.gov.uk/api/world-locations/france",
 "title"=>"France",
 "format"=>"World location",
 "updated_at"=>"2017-08-28T09:40:55.000+01:00",
 "web_url"=>"https://www.gov.uk/world/france",
 "analytics_identifier"=>"WL48",
 "details"=>{"slug"=>"france", "iso2"=>"FR"},
 "organisations"=>{"id"=>"https://www.gov.uk/api/world-locations/france/organisations", "web_url"=>"https://www.gov.uk/world/france#organisations"},
 "content_id"=>"5e9f00ce-7706-11e4-a3cb-005056011aef",
 "_response_info"=>{"status"=>"ok", "links"=>[{"href"=>"https://www.gov.uk/api/world-locations/france", "rel"=>"self"}]}}
```

Response using World Content Item

```
 => {"id"=>"https://www.gov.uk/world/france",
  "title"=>"France",
  "format"=>"World location",
  "updated_at"=>"2017-08-28T09:40:55.000+01:00",
  "web_url"=>"https://www.gov.uk/world/france",
  "analytics_identifier"=>"WL48",
  "details"=>{"slug"=>"france", "iso2"=>"FR"},
  "organisations"=>{"id"=>"https://www.gov.uk/world/france#organisations", "web_url"=>"https://www.gov.uk/world/france#organisations"},
  "content_id"=>"5e9f00ce-7706-11e4-a3cb-005056011aef"}
```
This method currently returns data retrieved from the Whitehall API,
which is being deprecated.

Therefore updating the method to get the data from the World Content
Item.

This is a breaking change as we have removed the pagination from the
response. This is to avoid multiple requests to the content item, when
all the results are included anyway.
@brucebolt brucebolt marked this pull request as ready for review July 19, 2023 08:46
@brucebolt brucebolt merged commit ade2e5f into main Jul 19, 2023
36 checks passed
@brucebolt brucebolt deleted the update-world-method branch July 19, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants