Sha256: 12a57a3a902acfb480dc00c959c8887cbe7894e4052a8e65eceaae7be8066b09

Contents?: true

Size: 995 Bytes

Versions: 5

Compression:

Stored size: 995 Bytes

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

        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

5 entries across 5 versions & 1 rubygems

Version Path
pact_broker-2.24.0 lib/pact_broker/api/resources/verification.rb
pact_broker-2.23.4 lib/pact_broker/api/resources/verification.rb
pact_broker-2.23.3 lib/pact_broker/api/resources/verification.rb
pact_broker-2.23.2 lib/pact_broker/api/resources/verification.rb
pact_broker-2.23.1 lib/pact_broker/api/resources/verification.rb