Sha256: 1e4d72a18886899773b90827d2e82093110560567a1fdcd33d329b5e07c2f983

Contents?: true

Size: 1.27 KB

Versions: 17

Compression:

Stored size: 1.27 KB

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/configuration'
require 'pact_broker/domain/verification'
require 'pact_broker/api/contracts/verification_contract'
require 'pact_broker/api/decorators/verification_summary_decorator'

module PactBroker
  module Api
    module Resources
      class LatestVerificationsForConsumerVersion < BaseResource

        def allowed_methods
          ["GET", "OPTIONS"]
        end

        def content_types_provided
          [["application/hal+json", :to_json]]
        end

        def resource_exists?
          !!version
        end

        def to_json
          summary = verification_service.verification_summary_for_consumer_version(identifier_from_path)
          decorator_for(summary).to_json(user_options: decorator_context(identifier_from_path))
        end

        def policy_name
          :'verifications::verifications'
        end

        private

        def version
          version_service.find_by_pacticipant_name_and_number(
            pacticipant_name: consumer_name,
            pacticipant_version_number: consumer_version_number
          )
        end

        def decorator_for summary
          PactBroker::Api::Decorators::VerificationSummaryDecorator.new(summary)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pact_broker-2.74.1 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.74.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.73.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.72.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.71.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.70.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.69.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.68.1 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.68.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.67.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.66.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.65.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.64.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.63.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.62.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.61.0 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb
pact_broker-2.60.1 lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb