Sha256: 4ffc663ee93eef80c3ef047ed3d040ea5fb1955fc92ee3484ee6c940c87946b4

Contents?: true

Size: 973 Bytes

Versions: 9

Compression:

Stored size: 973 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
          decorator_class(:matrix_decorator).new(results).to_json(decorator_options)
        end

        def policy_name
          :'matrix::matrix'
        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

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.79.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.78.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.78.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.77.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.76.2 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.76.1 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.76.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb
pact_broker-2.75.0 lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb