From 94f395ee8b18683c2def90b560682c278039f86b Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 18 Sep 2017 10:01:07 +1000 Subject: [PATCH] feat(versions resource): deprecate versions and pacticipant links in favour of pb:versions and pb:pacticipants --- .../api/decorators/versions_decorator.rb | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/pact_broker/api/decorators/versions_decorator.rb b/lib/pact_broker/api/decorators/versions_decorator.rb index f13b0189c..b074992e5 100644 --- a/lib/pact_broker/api/decorators/versions_decorator.rb +++ b/lib/pact_broker/api/decorators/versions_decorator.rb @@ -2,12 +2,8 @@ require_relative 'version_decorator' module PactBroker - module Api - module Decorators - - class VersionsDecorator < BaseDecorator collection :entries, as: :versions, embedded: true, :extend => PactBroker::Api::Decorators::VersionDecorator @@ -19,14 +15,14 @@ class VersionsDecorator < BaseDecorator } end - link :pacticipant do | context | + link :'pb:pacticipant' do | context | { href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:pacticipant_name])), title: context[:pacticipant_name] } end - links :'versions' do | context | + links :'pb:versions' do | context | represented.collect do | version | { :href => version_url(context[:base_url], version), @@ -35,6 +31,21 @@ class VersionsDecorator < BaseDecorator end end + link :pacticipant do | context | + { + href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:pacticipant_name])), + title: 'Deprecated - please use pb:pacticipant' + } + end + + links :'versions' do | context | + represented.collect do | version | + { + :href => version_url(context[:base_url], version), + :title => 'Deprecated - please use pb:versions' + } + end + end end end end