Class: PactBroker::Api::Resources::WebhookExecution

Inherits:
BaseResource
  • Object
show all
Includes:
WebhookExecutionMethods, WebhookResourceMethods
Defined in:
lib/pact_broker/api/resources/webhook_execution.rb

Instance Method Summary collapse

Methods included from WebhookExecutionMethods

#webhook_execution_configuration

Methods included from WebhookResourceMethods

#webhook_validation_errors?

Instance Method Details

#allowed_methodsObject



24
25
26
# File 'lib/pact_broker/api/resources/webhook_execution.rb', line 24

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

#content_types_acceptedObject



16
17
18
# File 'lib/pact_broker/api/resources/webhook_execution.rb', line 16

def content_types_accepted
  [["application/json"]]
end

#content_types_providedObject



20
21
22
# File 'lib/pact_broker/api/resources/webhook_execution.rb', line 20

def content_types_provided
  [["application/hal+json"]]
end

#malformed_request?Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
49
# File 'lib/pact_broker/api/resources/webhook_execution.rb', line 43

def malformed_request?
  if uuid
    false
  else
    webhook_validation_errors?(webhook)
  end
end

#policy_nameObject



51
52
53
# File 'lib/pact_broker/api/resources/webhook_execution.rb', line 51

def policy_name
  :'webhooks::webhook'
end

#process_postObject



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

def process_post
  webhook_execution_result = webhook_service.test_execution(webhook, webhook_execution_configuration.webhook_context, webhook_execution_configuration)
  response.headers['Content-Type'] = 'application/hal+json;charset=utf-8'
  response.body = post_response_body(webhook_execution_result)
  true
end

#resource_exists?Boolean

Returns:

  • (Boolean)


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

def resource_exists?
  !!resource_object
end

#resource_objectObject



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

def resource_object
  webhook
end