From ccdd46fa5611a5518219cd8c12cd531e5282e9a4 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 6 Jul 2018 16:55:40 +1000 Subject: [PATCH] feat: deprecate pacts relation in favour of pb:pacts in latest pacts resource --- .../api/decorators/pact_collection_decorator.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/pact_broker/api/decorators/pact_collection_decorator.rb b/lib/pact_broker/api/decorators/pact_collection_decorator.rb index e4f6bc3e9..a02918d0e 100644 --- a/lib/pact_broker/api/decorators/pact_collection_decorator.rb +++ b/lib/pact_broker/api/decorators/pact_collection_decorator.rb @@ -24,12 +24,23 @@ def create_representable_pact pact latest_pacts_url(options[:base_url]) end + # This is the LATEST pact URL + links :'pb:pacts' do | options | + represented.collect do | pact | + { + :href => latest_pact_url(options[:base_url], pact), + :title => "Latest pact between #{pact.consumer.name} and #{pact.provider.name}", + } + end + end + # This is the LATEST pact URL links :pacts do | options | represented.collect do | pact | { :href => latest_pact_url(options[:base_url], pact), :title => "Latest pact between #{pact.consumer.name} and #{pact.provider.name}", + :name => "DEPRECATED - please use the pb:pacts relation" } end end