From d5f565a9c144176268fe37409ecd155a5fd24174 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 18 May 2022 09:12:59 +1000 Subject: [PATCH] chore: update deployed and released version policy methods [pf] --- lib/pact_broker/api/resources/deployed_version.rb | 10 ++++++++-- .../deployed_versions_for_version_and_environment.rb | 6 +----- lib/pact_broker/api/resources/released_version.rb | 10 ++++++++-- .../released_versions_for_version_and_environment.rb | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/pact_broker/api/resources/deployed_version.rb b/lib/pact_broker/api/resources/deployed_version.rb index d5b3e1c57..94c09eeeb 100644 --- a/lib/pact_broker/api/resources/deployed_version.rb +++ b/lib/pact_broker/api/resources/deployed_version.rb @@ -58,11 +58,17 @@ def from_merge_patch_json end def policy_name - :'versions::version' + :'versions::deployed_version' + end + + def policy_record_context + { + pacticipant: deployed_version&.pacticipant + } end def policy_record - deployed_version&.version + deployed_version&.environment end private diff --git a/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb b/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb index c86073b5b..4d993c885 100644 --- a/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +++ b/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb @@ -40,11 +40,7 @@ def to_json end def policy_name - :'versions::deployed_version' - end - - def policy_record - environment + :'versions::deployed_versions' end private diff --git a/lib/pact_broker/api/resources/released_version.rb b/lib/pact_broker/api/resources/released_version.rb index 1d092bc0f..e14f611e6 100644 --- a/lib/pact_broker/api/resources/released_version.rb +++ b/lib/pact_broker/api/resources/released_version.rb @@ -48,11 +48,17 @@ def from_merge_patch_json end def policy_name - :'versions::version' + :'versions::released_version' + end + + def policy_record_context + { + pacticipant: released_version&.pacticipant + } end def policy_record - released_version&.version + released_version&.environment end private diff --git a/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb b/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb index 95060a982..f6ce8fa17 100644 --- a/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +++ b/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb @@ -45,7 +45,7 @@ def to_json end def policy_name - :'versions::released_version' + :'versions::released_versions' end def policy_record