Sha256: c9f0de1800ce866b176b1555f738265029de6077f77850024c64f1e59595fe71

Contents?: true

Size: 1.52 KB

Versions: 36

Compression:

Stored size: 1.52 KB

Contents

require_relative "base_decorator"
require "pact_broker/api/pact_broker_urls"
require "pact_broker/pacts/build_verifiable_pact_notices"
require "pact_broker/pacts/metadata"

module PactBroker
  module Api
    module Decorators
      class VerifiablePactDecorator < BaseDecorator
        include PactBroker::Pacts::Metadata

        property :shortDescription, getter: -> (context) { PactBroker::Pacts::VerifiablePactMessages.new(context[:represented], nil).pact_version_short_description }

        nested :verificationProperties do
          include PactBroker::Api::PactBrokerUrls

          property :pending,
            if: ->(context) { context[:options][:user_options][:include_pending_status] }
          property :wip,
            if: -> (context) { context[:represented].wip }
          property :notices,
            getter: -> (context) { context[:decorator].notices(context[:options][:user_options]) }

          def notices(user_options)
            metadata = represented.wip ? { wip: true } : nil
            pact_url = pact_version_url_with_metadata(represented, metadata, user_options[:base_url])
            PactBroker::Pacts::BuildVerifiablePactNotices.call(represented, pact_url, user_options)
          end
        end

        link :self do | user_options |
          metadata = build_metadata_for_pact_for_verification(represented)
          {
            href: pact_version_url_with_metadata(represented, metadata, user_options[:base_url]),
            name: represented.name
          }
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
pact_broker-2.93.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.92.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.91.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.90.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.89.1 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.89.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.88.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.87.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.86.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.85.1 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.85.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.84.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.83.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.82.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.81.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb
pact_broker-2.80.0 lib/pact_broker/api/decorators/verifiable_pact_decorator.rb