Sha256: 23fcaa68e44f36dd4cae79bd16760af44f0a5e3db88251ea1239d5b8d2acb28a

Contents?: true

Size: 881 Bytes

Versions: 11

Compression:

Stored size: 881 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/api/decorators/matrix_decorator'

module PactBroker
  module Api
    module Resources
      class MatrixForConsumerAndProvider < BaseResource

        def initialize
          _, @options = PactBroker::Matrix::ParseQuery.call(request.uri.query)
        end

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

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

        def resource_exists?
          consumer && provider
        end

        def to_json
          lines = matrix_service.find_for_consumer_and_provider(identifier_from_path, options)
          PactBroker::Api::Decorators::MatrixDecorator.new(lines).to_json(user_options: { base_url: base_url })
        end

        private

        attr_reader :options
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.39.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.38.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.38.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.37.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.36.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.36.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.35.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.34.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.33.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.32.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb