Skip to content

Commit

Permalink
chore: update environment relations
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Mar 22, 2021
1 parent ca78590 commit 5e34a7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions lib/pact_broker/api/decorators/environment_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class EnvironmentDecorator < BaseDecorator
href: environment_url(represented, options[:base_url])
}
end

link :'pb:environments' do | user_options |
{
title: "Environments",
href: environments_url(user_options.fetch(:base_url))
}
end
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions lib/pact_broker/api/decorators/environments_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ class EnvironmentsDecorator < BaseDecorator

collection :entries, :as => :environments, :class => PactBroker::Deployments::Environment, :extend => PactBroker::Api::Decorators::EnvironmentDecorator, embedded: true

link :self do | options |
{
title: 'Environments',
href: options[:resource_url]
}
end

links :'pb:environments' do | user_options |
represented.collect do | environment |
{
Expand All @@ -18,13 +25,6 @@ class EnvironmentsDecorator < BaseDecorator
}
end
end

link :self do | options |
{
title: 'Environments',
href: options[:resource_url]
}
end
end
end
end
Expand Down

0 comments on commit 5e34a7e

Please sign in to comment.