Sha256: 8ae1fcf55ecb063bc2b6db38075cfb523346fe2e9cd339ece4fa6780ff9fb738

Contents?: true

Size: 1.09 KB

Versions: 114

Compression:

Stored size: 1.09 KB

Contents

require_relative 'base_decorator'
require_relative 'version_decorator'
require_relative 'verification_decorator'
require 'ostruct'

module PactBroker
  module Api
    module Decorators

      class VerificationSummaryDecorator < BaseDecorator

        property :success
        property :provider_summary, as: :providerSummary do
          property :successful
          property :failed
          property :unknown
        end

        collection :verifications, as: :verificationResults, 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 provider_summary
          OpenStruct.new(
            successful: represented.select(&:success).collect(&:provider_name),
            failed: represented.select{|verification| !verification.success }.collect(&:provider_name))
        end

      end
    end
  end
end

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
pact_broker-2.65.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.64.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.63.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.62.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.61.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.60.1 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.60.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.59.2 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.59.1 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.59.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.58.3 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.58.2 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.58.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.57.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.56.1 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.56.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.55.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.54.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.53.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.52.2 lib/pact_broker/api/decorators/verification_summary_decorator.rb