Skip to content

Commit

Permalink
feat: deprecate provider relation in provider pacts resource in prefe…
Browse files Browse the repository at this point in the history
…rence for pb:provider
  • Loading branch information
bethesque committed Jun 27, 2018
1 parent 14131c5 commit eda8cbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lib/pact_broker/api/decorators/provider_pacts_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class ProviderPactsDecorator < BaseDecorator
}
end

link :provider do | context |
link :'pb:provider' do | context |
{
href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:provider_name])),
title: context[:provider_name]
name: context[:provider_name]
}
end

Expand All @@ -32,6 +32,14 @@ class ProviderPactsDecorator < BaseDecorator
end
end

link :provider do | context |
{
href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:provider_name])),
title: context[:provider_name],
name: "DEPRECATED - please use the pb:provider relation"
}
end

links :'pacts' do | context |
represented.collect do | pact |
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module Decorators
{
base_url: 'http://example.org',
resource_url: 'http://example.org/provider-pacts',
title: 'title'
title: 'title',
provider_name: 'foo'
}
end

Expand All @@ -30,9 +31,9 @@ module Decorators
:href=> "http://example.org/provider-pacts",
:title => "title"
},
:provider => {
:href => "http://example.org/pacticipants/",
:title => nil
:"pb:provider" => {
:href => "http://example.org/pacticipants/foo",
:name => "foo"
},
:"pb:pacts" =>[{
:href => "pact_url",
Expand Down

0 comments on commit eda8cbf

Please sign in to comment.