Sha256: 706740a10308e40c295e7c8522457a82da8e4cf66b7db337732e9414cefaa996

Contents?: true

Size: 897 Bytes

Versions: 10

Compression:

Stored size: 897 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
          super
          _, @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

10 entries across 10 versions & 1 rubygems

Version Path
pact_broker-2.49.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.48.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.47.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.47.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.46.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.45.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.44.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.43.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.42.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.41.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb