Skip to content

Commit

Permalink
feat(versions resource): deprecate versions and pacticipant links in …
Browse files Browse the repository at this point in the history
…favour of pb:versions and pb:pacticipants
  • Loading branch information
bethesque committed Sep 18, 2017
1 parent 477021c commit 94f395e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/pact_broker/api/decorators/versions_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -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
Expand Down

0 comments on commit 94f395e

Please sign in to comment.