Sha256: f154220d8825a6a59770cc79da521d9d895c6b71f9d47d43bef47c11616d8492

Contents?: true

Size: 1.62 KB

Versions: 39

Compression:

Stored size: 1.62 KB

Contents

require_relative "base_decorator"
require_relative "version_decorator"
require_relative "pagination_links"

module PactBroker
  module Api
    module Decorators
      class VersionsDecorator < BaseDecorator

        collection :entries, as: :versions, embedded: true, :extend => PactBroker::Api::Decorators::VersionDecorator

        link :self do | context |
          href = append_query_if_present(context[:resource_url], context[:query_string])
          {
            href: href,
            title: "All application versions of #{context[:pacticipant_name]}"
          }
        end

        include PaginationLinks

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

        links :'pb:versions' do | context |
          represented.collect do | version |
            {
              :href => version_url(context[:base_url], version),
              :title => version.version_and_updated_date
            }
          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
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
pact_broker-2.107.1 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.107.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.106.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.105.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.104.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.103.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.102.2 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.102.1 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.102.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.101.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.100.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.99.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.98.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.97.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.96.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.95.1 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.95.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.94.0 lib/pact_broker/api/decorators/versions_decorator.rb
pact_broker-2.93.4 lib/pact_broker/api/decorators/versions_decorator.rb