Skip to content

Commit

Permalink
Merge pull request #1994 from alphagov/add-work-around-for-local-mapit
Browse files Browse the repository at this point in the history
Use My Society's Mapit when running locally
  • Loading branch information
leenagupte committed Oct 19, 2020
2 parents 6757c0e + e22d4a5 commit 5071d5b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/services/location_lookup_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def areas

def response
@response ||= begin
JSON.parse(GdsApi.mapit.location_for_postcode(postcode).to_json)
JSON.parse(mapit.location_for_postcode(postcode).to_json)
rescue GdsApi::HTTPNotFound, GdsApi::HTTPClientError => e
{
error: {
Expand All @@ -59,4 +59,10 @@ def response
}
end
end

def mapit
return GdsApi.mapit unless Rails.env.development?

GdsApi::Mapit.new("https://mapit.mysociety.org/")
end
end

0 comments on commit 5071d5b

Please sign in to comment.