diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0ab8c07..a6ac0131 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,9 +98,9 @@ jobs: with: pact_artifact: pacts - imminence_pact: + places_manager_pact: needs: generate_pacts - uses: alphagov/imminence/.github/workflows/pact-verify.yml@main + uses: alphagov/places-manager/.github/workflows/pact-verify.yml@main with: pact_artifact: pacts @@ -129,7 +129,7 @@ jobs: - collections_pact - email_alert_api_pact - frontend_pact - - imminence_pact + - places_manager_pact - link_checker_api_pact - locations_api_pact - publishing_api_pact diff --git a/lib/gds_api.rb b/lib/gds_api.rb index 3e5cd2e6..15d77851 100644 --- a/lib/gds_api.rb +++ b/lib/gds_api.rb @@ -6,7 +6,7 @@ require "gds_api/calendars" require "gds_api/content_store" require "gds_api/email_alert_api" -require "gds_api/imminence" +require "gds_api/places_manager" require "gds_api/licence_application" require "gds_api/link_checker_api" require "gds_api/local_links_manager" @@ -82,11 +82,11 @@ def self.email_alert_api(options = {}) ) end - # Creates a GdsApi::Imminence adapter + # Creates a GdsApi::places-manager adapter # - # @return [GdsApi::Imminence] - def self.imminence(options = {}) - GdsApi::Imminence.new(Plek.find("imminence"), options) + # @return [GdsApi::PlacesManager] + def self.places_manager(options = {}) + GdsApi::PlacesManager.new(Plek.find("places-manager"), options) end # Creates a GdsApi::LicenceApplication diff --git a/lib/gds_api/imminence.rb b/lib/gds_api/places_manager.rb similarity index 94% rename from lib/gds_api/imminence.rb rename to lib/gds_api/places_manager.rb index 5a437302..41807dc6 100644 --- a/lib/gds_api/imminence.rb +++ b/lib/gds_api/places_manager.rb @@ -1,6 +1,6 @@ require_relative "base" -class GdsApi::Imminence < GdsApi::Base +class GdsApi::PlacesManager < GdsApi::Base def api_url(type, params) vals = %i[limit lat lng postcode local_authority_slug].select { |p| params.include? p } querystring = URI.encode_www_form(vals.map { |p| [p, params[p]] }) diff --git a/lib/gds_api/test_helpers/imminence.rb b/lib/gds_api/test_helpers/places_manager.rb similarity index 57% rename from lib/gds_api/test_helpers/imminence.rb rename to lib/gds_api/test_helpers/places_manager.rb index 4b01c41a..d84b6175 100644 --- a/lib/gds_api/test_helpers/imminence.rb +++ b/lib/gds_api/test_helpers/places_manager.rb @@ -2,32 +2,32 @@ module GdsApi module TestHelpers - module Imminence + module PlacesManager # Generally true. If you are initializing the client differently, # you could redefine/override the constant or stub directly. - IMMINENCE_API_ENDPOINT = Plek.find("imminence") + PLACES_MANAGER_API_ENDPOINT = Plek.find("places-manager") - def stub_imminence_has_places(latitude, longitude, details) + def stub_places_manager_has_places(latitude, longitude, details) query_hash = { "lat" => latitude, "lng" => longitude, "limit" => "5" } response_data = { status: "ok", content: "places", places: details["details"], } - stub_imminence_places_request(details["slug"], query_hash, response_data) + stub_places_manager_places_request(details["slug"], query_hash, response_data) end - def stub_imminence_has_multiple_authorities_for_postcode(addresses, slug, postcode, limit) + def stub_places_manager_has_multiple_authorities_for_postcode(addresses, slug, postcode, limit) query_hash = { "postcode" => postcode, "limit" => limit } response_data = { status: "address-information-required", content: "addresses", addresses:, } - stub_imminence_places_request(slug, query_hash, response_data) + stub_places_manager_places_request(slug, query_hash, response_data) end - def stub_imminence_has_places_for_postcode(places, slug, postcode, limit, local_authority_slug) + def stub_places_manager_has_places_for_postcode(places, slug, postcode, limit, local_authority_slug) query_hash = { "postcode" => postcode, "limit" => limit } query_hash.merge!(local_authority_slug:) if local_authority_slug response_data = { @@ -35,11 +35,11 @@ def stub_imminence_has_places_for_postcode(places, slug, postcode, limit, local_ content: "places", places:, } - stub_imminence_places_request(slug, query_hash, response_data) + stub_places_manager_places_request(slug, query_hash, response_data) end - def stub_imminence_places_request(slug, query_hash, return_data, status_code = 200) - stub_request(:get, "#{IMMINENCE_API_ENDPOINT}/places/#{slug}.json") + def stub_places_manager_places_request(slug, query_hash, return_data, status_code = 200) + stub_request(:get, "#{PLACES_MANAGER_API_ENDPOINT}/places/#{slug}.json") .with(query: query_hash) .to_return(status: status_code, body: return_data.to_json, headers: {}) end diff --git a/test/pacts/imminence_api_pact_test.rb b/test/pacts/places_manager_api_pact_test.rb similarity index 93% rename from test/pacts/imminence_api_pact_test.rb rename to test/pacts/places_manager_api_pact_test.rb index f66cac6f..bd432d47 100644 --- a/test/pacts/imminence_api_pact_test.rb +++ b/test/pacts/places_manager_api_pact_test.rb @@ -1,14 +1,14 @@ require "test_helper" -require "gds_api/imminence" +require "gds_api/places_manager" -describe "GdsApi::Imminence pact tests" do +describe "GdsApi::PlacesManager pact tests" do include PactTest describe "#places" do - let(:api_client) { GdsApi::Imminence.new(imminence_api_host) } + let(:api_client) { GdsApi::PlacesManager.new(places_manager_api_host) } it "responds with all responses for the given dataset" do - imminence_api + places_manager_api .given("a service exists called number-plate-supplier with places") .upon_receiving("the request to retrieve relevant places for the current dataset for a lat/lon") .with( @@ -56,7 +56,7 @@ end it "responds with a choice of addresses for disambiguation of split postcodes" do - imminence_api + places_manager_api .given("a service exists called register office exists with places, and CH25 9BJ is a split postcode") .upon_receiving("the request to retrieve relevant places for the current dataset for CH25 9BJ") .with( diff --git a/test/imminence_api_test.rb b/test/places_manager_api_test.rb similarity index 96% rename from test/imminence_api_test.rb rename to test/places_manager_api_test.rb index 8d45448e..c59d1477 100644 --- a/test/imminence_api_test.rb +++ b/test/places_manager_api_test.rb @@ -1,13 +1,13 @@ require "test_helper" -require "gds_api/imminence" +require "gds_api/places_manager" -class ImminenceApiTest < Minitest::Test - ROOT = Plek.find("imminence") +class PlacesManagerApiTest < Minitest::Test + ROOT = Plek.find("places-manager") LATITUDE = 52.1327584352089 LONGITUDE = -0.4702813074674147 def api_client - GdsApi::Imminence.new(ROOT) + GdsApi::PlacesManager.new(ROOT) end def dummy_place diff --git a/test/support/pact_helper.rb b/test/support/pact_helper.rb index 2be0ab92..62ad6948 100644 --- a/test/support/pact_helper.rb +++ b/test/support/pact_helper.rb @@ -5,7 +5,7 @@ BANK_HOLIDAYS_API_PORT = 3003 ACCOUNT_API_PORT = 3004 LINK_CHECKER_API_PORT = 3005 -IMMINENCE_API_PORT = 3006 +PLACES_MANAGER_API_PORT = 3006 LOCATIONS_API_PORT = 3008 ASSET_MANAGER_API_PORT = 3009 EMAIL_ALERT_API_PORT = 3010 @@ -30,8 +30,8 @@ def link_checker_api_host "http://localhost:#{LINK_CHECKER_API_PORT}" end -def imminence_api_host - "http://localhost:#{IMMINENCE_API_PORT}" +def places_manager_api_host + "http://localhost:#{PLACES_MANAGER_API_PORT}" end def locations_api_host @@ -77,9 +77,9 @@ def email_alert_api_host end end - has_pact_with "Imminence API" do - mock_service :imminence_api do - port IMMINENCE_API_PORT + has_pact_with "PlacesManager API" do + mock_service :places_manager_api do + port PLACES_MANAGER_API_PORT end end