class PactBroker::Api::Resources::WebhookExecution
Public Instance Methods
action()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 55 def action :execute end
allowed_methods()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 24 def allowed_methods ["POST", "OPTIONS"] end
content_types_accepted()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 16 def content_types_accepted [["application/json"]] end
content_types_provided()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 20 def content_types_provided [["application/hal+json"]] end
malformed_request?()
click to toggle source
Calls superclass method
# File lib/pact_broker/api/resources/webhook_execution.rb, line 39 def malformed_request? if request.post? if uuid false else webhook_validation_errors?(webhook) end else super end end
policy_name()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 51 def policy_name :'webhooks::webhook' end
policy_record()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 59 def policy_record webhook end
process_post()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 28 def process_post webhook_execution_result = webhook_trigger_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?()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 35 def resource_exists? !!webhook end
Private Instance Methods
build_unsaved_webhook()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 90 def build_unsaved_webhook decorator_class(:webhook_decorator).new(PactBroker::Domain::Webhook.new).from_json(request_body) end
decorator_options()
click to toggle source
Calls superclass method
# File lib/pact_broker/api/resources/webhook_execution.rb, line 83 def decorator_options super( webhook: webhook, show_response: PactBroker.configuration.show_webhook_response? ) end
post_response_body(webhook_execution_result)
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 65 def post_response_body webhook_execution_result decorator_class(:webhook_execution_result_decorator).new(webhook_execution_result).to_json(decorator_options) end
uuid()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 79 def uuid identifier_from_path[:uuid] end
webhook()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 69 def webhook @webhook ||= begin if uuid webhook_service.find_by_uuid uuid else build_unsaved_webhook end end end