Sha256: 78339c57e59129c71167f2a271ef57c717c8cbe9391ba59126793f7813548ad7

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require_relative 'base_decorator'
require_relative 'version_decorator'

module PactBroker
  module Api
    module Decorators

      class VerificationsDecorator < BaseDecorator

        property :success, exec_context: :decorator, if: :any_verifications?
        collection :entries, as: :'verification-results', embedded: true, :extend => PactBroker::Api::Decorators::VerificationDecorator

        link :self do | context |
          {
            href: context.fetch(:resource_url),
            title: "Latest verification results for consumer #{context.fetch(:consumer_name)} version #{context.fetch(:consumer_version_number)}"
          }
        end

        def success
          represented.collect(&:success).all?
        end

        def any_verifications? context
          represented.any?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-2.0.0.beta.6 lib/pact_broker/api/decorators/verifications_decorator.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/api/decorators/verifications_decorator.rb