Sha256: 2812a004a4bf5194ba4292b4439ae4138e2fd3aa1503015bc1866117b54c0f6b

Contents?: true

Size: 937 Bytes

Versions: 13

Compression:

Stored size: 937 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
          PactBroker::Api::Decorators::MatrixDecorator.new(results).to_json(user_options: { base_url: base_url })
        end

        private

        attr_reader :options

        def results
          @results ||= matrix_service.find_for_consumer_and_provider(identifier_from_path, options)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pact_broker-2.58.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.57.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.56.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.56.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.55.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.54.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.53.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.52.2 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.52.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.52.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.51.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.50.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.50.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb