Class: PactBroker::Api::Resources::Verification

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

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject

Remember to update latest_verification_id_for_pact_version_and_provider_version if/when DELETE is implemented



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

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

#content_types_providedObject



12
13
14
15
16
17
18
# File 'lib/pact_broker/api/resources/verification.rb', line 12

def content_types_provided
  [
    ["application/hal+json", :to_json],
    ["application/json", :to_json],
    ["application/vnd.pactbrokerextended.v1+json", :to_extended_json]
  ]
end

#delete_resourceObject



43
44
45
46
# File 'lib/pact_broker/api/resources/verification.rb', line 43

def delete_resource
  verification_service.delete(verification)
  true
end

#policy_nameObject



48
49
50
# File 'lib/pact_broker/api/resources/verification.rb', line 48

def policy_name
  :'verifications::verification'
end

#resource_exists?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
# File 'lib/pact_broker/api/resources/verification.rb', line 26

def resource_exists?
  if identifier_from_path[:verification_number] == "all"
    set_json_error_message("To see all the verifications for a pact, use the Matrix page")
    false
  else
    !!verification
  end
end

#to_extended_jsonObject



39
40
41
# File 'lib/pact_broker/api/resources/verification.rb', line 39

def to_extended_json
  extended_decorator_for(verification).to_json(decorator_options)
end

#to_jsonObject



35
36
37
# File 'lib/pact_broker/api/resources/verification.rb', line 35

def to_json
  decorator_for(verification).to_json(decorator_options)
end