Class: PactBroker::Api::Resources::MatrixForConsumerAndProvider

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb

Instance Method Summary collapse

Constructor Details

#initializeMatrixForConsumerAndProvider

Returns a new instance of MatrixForConsumerAndProvider.



9
10
11
12
# File 'lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb', line 9

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

Instance Method Details

#allowed_methodsObject



18
19
20
# File 'lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb', line 18

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

#content_types_providedObject



14
15
16
# File 'lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb', line 14

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

#resource_exists?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb', line 22

def resource_exists?
  consumer && provider
end

#to_jsonObject



26
27
28
# File 'lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb', line 26

def to_json
  PactBroker::Api::Decorators::MatrixDecorator.new(results).to_json(decorator_options)
end