diff --git a/Gemfile.lock b/Gemfile.lock index eb5bd72d40..c69759ca4f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,7 +138,7 @@ GEM parslet ffi (1.16.3) find_a_port (1.0.1) - gds-api-adapters (95.1.0) + gds-api-adapters (96.0.0) addressable link_header null_logger @@ -236,7 +236,7 @@ GEM method_source (1.0.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0507) mini_mime (1.1.5) mini_portile2 (2.8.6) minitest (5.22.3) diff --git a/app/controllers/place_controller.rb b/app/controllers/place_controller.rb index 3a6d5af8e6..40af8e50ea 100644 --- a/app/controllers/place_controller.rb +++ b/app/controllers/place_controller.rb @@ -66,7 +66,7 @@ def places_from_imminence imminence_response = Frontend.imminence_api.places_for_postcode( content_item_hash["details"]["place_type"], postcode, - Frontend::IMMINENCE_QUERY_LIMIT, + Frontend::PLACES_MANAGER_QUERY_LIMIT, local_authority_slug, ) imminence_response_from_data(postcode, imminence_response, nil) diff --git a/config/initializers/imminence.rb b/config/initializers/imminence.rb index 314c7aa194..c2825a4eba 100644 --- a/config/initializers/imminence.rb +++ b/config/initializers/imminence.rb @@ -1,5 +1,5 @@ -require "gds_api/imminence" +require "gds_api/places_manager" -Frontend.imminence_api = GdsApi::Imminence.new(Plek.new.find("imminence")) +Frontend.imminence_api = GdsApi::PlacesManager.new(Plek.new.find("places-manager")) -Frontend::IMMINENCE_QUERY_LIMIT = 10 +Frontend::PLACES_MANAGER_QUERY_LIMIT = 10 diff --git a/startup.sh b/startup.sh index 32280d9b4e..c487062579 100755 --- a/startup.sh +++ b/startup.sh @@ -9,7 +9,7 @@ if [[ $1 == "--live" ]] ; then PLEK_SERVICE_LICENSIFY_URI=${PLEK_SERVICE_LICENSIFY_URI-https://licensify.publishing.service.gov.uk} \ PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.gov.uk/api} \ PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-https://assets.publishing.service.gov.uk} \ - PLEK_SERVICE_IMMINENCE_URI=${PLEK_SERVICE_IMMINENCE_URI-https://imminence.publishing.service.gov.uk} \ + PLEK_SERVICE_PLACES_MANAGER_URI=${PLEK_SERVICE_PLACES_MANAGER_URI-https://places-manager.publishing.service.gov.uk} \ ./bin/dev else echo "ERROR: other startup modes are not supported" diff --git a/test/functional/place_controller_test.rb b/test/functional/place_controller_test.rb index 2bdb7008dc..715350f809 100644 --- a/test/functional/place_controller_test.rb +++ b/test/functional/place_controller_test.rb @@ -1,15 +1,15 @@ require "test_helper" -require "gds_api/test_helpers/imminence" +require "gds_api/test_helpers/places_manager" class PlaceControllerTest < ActionController::TestCase - include GdsApi::TestHelpers::Imminence + include GdsApi::TestHelpers::PlacesManager valid_postcode = "SW1A 2AA" invalid_postcode = "1234 2AA" setup do content_store_has_random_item(base_path: "/slug", schema: "place", details: { "place_type" => "slug" }) - stub_imminence_has_places_for_postcode([{ + stub_places_manager_has_places_for_postcode([{ "access_notes" => "The London Passport Office is fully accessible to wheelchair users. ", "address1" => nil, "address2" => "89 Eccleston Square", @@ -27,9 +27,9 @@ class PlaceControllerTest < ActionController::TestCase "town" => "London", "url" => "http://www.example.com/london_ips_office", }], "slug", valid_postcode, 10, nil) - query_hash = { "postcode" => invalid_postcode, "limit" => Frontend::IMMINENCE_QUERY_LIMIT } + query_hash = { "postcode" => invalid_postcode, "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT } return_data = { "error" => ImminenceResponse::INVALID_POSTCODE } - stub_imminence_places_request("slug", query_hash, return_data, 400) + stub_places_manager_places_request("slug", query_hash, return_data, 400) end context "GET show" do diff --git a/test/integration/place_test.rb b/test/integration/place_test.rb index 917dd65237..12a89c846b 100644 --- a/test/integration/place_test.rb +++ b/test/integration/place_test.rb @@ -1,8 +1,8 @@ require "integration_test_helper" -require "gds_api/test_helpers/imminence" +require "gds_api/test_helpers/places_manager" class PlacesTest < ActionDispatch::IntegrationTest - include GdsApi::TestHelpers::Imminence + include GdsApi::TestHelpers::PlacesManager setup do @payload = { @@ -119,7 +119,7 @@ class PlacesTest < ActionDispatch::IntegrationTest context "given a valid postcode" do setup do - stub_imminence_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::IMMINENCE_QUERY_LIMIT, nil) + stub_places_manager_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::PLACES_MANAGER_QUERY_LIMIT, nil) visit "/passport-interview-office" fill_in "Enter a postcode", with: "SW1A 1AA" @@ -206,7 +206,7 @@ class PlacesTest < ActionDispatch::IntegrationTest setup do @places = [] - stub_imminence_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::IMMINENCE_QUERY_LIMIT, nil) + stub_places_manager_has_places_for_postcode(@places, "find-passport-offices", "SW1A 1AA", Frontend::PLACES_MANAGER_QUERY_LIMIT, nil) visit "/passport-interview-office" fill_in "Enter a postcode", with: "SW1A 1AA" @@ -264,9 +264,9 @@ class PlacesTest < ActionDispatch::IntegrationTest context "given an invalid postcode" do setup do - query_hash = { "postcode" => "BAD POSTCODE", "limit" => Frontend::IMMINENCE_QUERY_LIMIT } + query_hash = { "postcode" => "BAD POSTCODE", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT } return_data = { "error" => "invalidPostcodeError" } - stub_imminence_places_request("find-passport-offices", query_hash, return_data, 400) + stub_places_manager_places_request("find-passport-offices", query_hash, return_data, 400) visit "/passport-interview-office" fill_in "Enter a postcode", with: "BAD POSTCODE" @@ -292,10 +292,10 @@ class PlacesTest < ActionDispatch::IntegrationTest context "given a valid postcode with no locations returned" do setup do - query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::IMMINENCE_QUERY_LIMIT } + query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT } return_data = { "error" => "validPostcodeNoLocation" } - stub_imminence_places_request("find-passport-offices", query_hash, return_data, 400) + stub_places_manager_places_request("find-passport-offices", query_hash, return_data, 400) visit "/passport-interview-office" fill_in "Enter a postcode", with: "JE4 5TP" @@ -322,7 +322,7 @@ class PlacesTest < ActionDispatch::IntegrationTest { "address" => "House 3", "local_authority_slug" => "ceechester" }, ] - stub_imminence_has_multiple_authorities_for_postcode(addresses, "find-passport-offices", "CH25 9BJ", Frontend::IMMINENCE_QUERY_LIMIT) + stub_places_manager_has_multiple_authorities_for_postcode(addresses, "find-passport-offices", "CH25 9BJ", Frontend::PLACES_MANAGER_QUERY_LIMIT) visit "/passport-interview-office" fill_in "Enter a postcode", with: "CH25 9BJ" @@ -334,10 +334,10 @@ class PlacesTest < ActionDispatch::IntegrationTest end end - context "given an internal error response from imminence" do + context "given an internal error response from places manager" do setup do - query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::IMMINENCE_QUERY_LIMIT } - stub_imminence_places_request("find-passport-offices", query_hash, {}, 500) + query_hash = { "postcode" => "JE4 5TP", "limit" => Frontend::PLACES_MANAGER_QUERY_LIMIT } + stub_places_manager_places_request("find-passport-offices", query_hash, {}, 500) visit "/passport-interview-office" fill_in "Enter a postcode", with: "JE4 5TP"