Sha256: 2d711678a2cc1f34e8c5f29f256dd303b3ac82287a010fc2803c5d1fa07db4d8

Contents?: true

Size: 984 Bytes

Versions: 64

Compression:

Stored size: 984 Bytes

Contents

require_relative 'base_decorator'
require_relative 'pact_version_decorator'

module PactBroker

  module Api

    module Decorators


      class ProviderPactsDecorator < BaseDecorator

        link :self do | context |
          suffix = context[:tag] ? " with tag '#{context[:tag]}'" : ""
          {
            href: context[:resource_url],
            title: "Latest pact versions for the provider #{context[:provider_name]}#{suffix}"
          }
        end

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

        links :'pacts' do | context |
          represented.collect do | pact |
            {
              :href => pact_url(context[:base_url], pact),
              :title => pact.name,
              :name => pact.consumer.name
            }
          end
        end

      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pact_broker-1.9.0 lib/pact_broker/api/decorators/provider_pacts_decorator.rb
pact_broker-1.9.0.rc1 lib/pact_broker/api/decorators/provider_pacts_decorator.rb
pact_broker-1.8.1 lib/pact_broker/api/decorators/provider_pacts_decorator.rb
pact_broker-1.8.0 lib/pact_broker/api/decorators/provider_pacts_decorator.rb