Sha256: fe6eeeb87e914289a2aed5128d69e42e95199bc0910009d07562c5f67bb017fa

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

require_relative 'base_decorator'
require_relative 'version_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

13 entries across 13 versions & 1 rubygems

Version Path
pact_broker-2.4.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.3.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.2.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.1.1 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.1.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.5 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.4 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.3 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.2 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.1 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.0 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/api/decorators/verification_summary_decorator.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/api/decorators/verification_summary_decorator.rb