diff --git a/lib/pact_broker/api.rb b/lib/pact_broker/api.rb index f33827a59..add1f605f 100644 --- a/lib/pact_broker/api.rb +++ b/lib/pact_broker/api.rb @@ -44,8 +44,8 @@ module PactBroker add ['pacticipants', :name], Api::Resources::Pacticipant, {resource_name: "pacticipant"} add ['pacticipants', :pacticipant_name, 'versions'], Api::Resources::Versions, {resource_name: "pacticipant_versions"} add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number], Api::Resources::Version, {resource_name: "pacticipant_version"} - add ['pacticipants', :pacticipant_name, 'versions', 'latest', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"} - add ['pacticipants', :pacticipant_name, 'versions', 'latest'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"} + add ['pacticipants', :pacticipant_name, 'latest-version', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"} + add ['pacticipants', :pacticipant_name, 'latest-version'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"} add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number, 'tags', :tag_name], Api::Resources::Tag, {resource_name: "pacticipant_version_tag"} add ['pacticipants', :pacticipant_name, 'labels', :label_name], Api::Resources::Label, {resource_name: "pacticipant_label"} diff --git a/lib/pact_broker/api/resources/index.rb b/lib/pact_broker/api/resources/index.rb index 608440e2b..04156d270 100644 --- a/lib/pact_broker/api/resources/index.rb +++ b/lib/pact_broker/api/resources/index.rb @@ -54,12 +54,12 @@ def to_json templated: true }, 'pb:latest-version' => { - href: base_url + '/pacticipants/{pacticipant}/versions/latest', + href: base_url + '/pacticipants/{pacticipant}/latest-version', title: 'Latest pacticipant version', templated: true }, 'pb:latest-tagged-version' => { - href: base_url + '/pacticipants/{pacticipant}/versions/latest/{tag}', + href: base_url + '/pacticipants/{pacticipant}/latest-version/{tag}', title: 'Latest pacticipant version with the specified tag', templated: true }, diff --git a/lib/pact_broker/api/resources/version.rb b/lib/pact_broker/api/resources/version.rb index dfa9943f3..c87f7a8f1 100644 --- a/lib/pact_broker/api/resources/version.rb +++ b/lib/pact_broker/api/resources/version.rb @@ -34,7 +34,7 @@ def delete_resource def version if path_info[:tag] @version ||= version_service.find_by_pacticpant_name_and_latest_tag(path_info[:pacticipant_name], path_info[:tag]) - elsif path_info[:number] + elsif path_info[:pacticipant_version_number] @version ||= version_service.find_by_pacticipant_name_and_number path_info else @version ||= version_service.find_latest_by_pacticpant_name path_info diff --git a/spec/service_consumers/hal_relation_proxy_app.rb b/spec/service_consumers/hal_relation_proxy_app.rb index f2a91d876..095a543ad 100644 --- a/spec/service_consumers/hal_relation_proxy_app.rb +++ b/spec/service_consumers/hal_relation_proxy_app.rb @@ -5,9 +5,9 @@ class HalRelationProxyApp # the consumer does not need to know the actual URLs. PATH_REPLACEMENTS = { '/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production' => - '/pacticipants/Condor/versions/latest/production', + '/pacticipants/Condor/latest-version/production', '/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor' => - '/pacticipants/Condor/versions/latest' + '/pacticipants/Condor/latest-version' } RESPONSE_BODY_REPLACEMENTS = {