Class: PactBroker::Api::Resources::TaggedPactVersions

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

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



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

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

#content_types_providedObject



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

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

#delete_resourceObject



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

def delete_resource
  pact_service.delete_all_pact_publications_between consumer_name, and: provider_name, tag: identifier_from_path[:tag]
  true
end

#pactsObject



31
32
33
# File 'lib/pact_broker/api/resources/tagged_pact_versions.rb', line 31

def pacts
  pact_service.find_all_pact_versions_between consumer_name, and: provider_name, tag: identifier_from_path[:tag]
end

#resource_exists?Boolean

Returns:

  • (Boolean)


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

def resource_exists?
  consumer && provider
end

#to_jsonObject



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

def to_json
  PactBroker::Api::Decorators::TaggedPactVersionsDecorator.new(pacts).to_json(user_options: decorator_context(identifier_from_path))
end