Sha256: 1c4f6895cad07be2b3a0f4f362d16d6fc458a7d5e3ecbb405ffd1f530cd23b9b

Contents?: true

Size: 1.1 KB

Versions: 12

Compression:

Stored size: 1.1 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_decorator'

module PactBroker
  module Api
    module Resources

      class Verification < BaseResource

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

        # Remember to update latest_verification_id_for_pact_version_and_provider_version
        # if/when DELETE is implemented
        def allowed_methods
          ["GET", "OPTIONS"]
        end

        def resource_exists?
          !!verification
        end

        def to_json
          decorator_for(verification).to_json(user_options: {base_url: base_url})
        end

        private

        def verification
          @verification ||= verification_service.find(identifier_from_path)
        end

        def decorator_for model
          PactBroker::Api::Decorators::VerificationDecorator.new(model)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.31.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.30.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.29.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.6 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.5 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.4 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.3 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.2 lib/pact_broker/api/resources/verification.rb
pact_broker-2.27.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.26.1 lib/pact_broker/api/resources/verification.rb
pact_broker-2.26.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.25.0 lib/pact_broker/api/resources/verification.rb