class PactBroker::Api::Resources::WebhookExecution
Public Instance Methods
action()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 51 def action :execute end
allowed_methods()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 18 def allowed_methods ["POST", "OPTIONS"] end
content_types_provided()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 14 def content_types_provided [["application/hal+json"]] end
malformed_request?()
click to toggle source
Calls superclass method
PactBroker::Api::Resources::BaseResource#malformed_request?
# File lib/pact_broker/api/resources/webhook_execution.rb, line 33 def malformed_request? if super true elsif request.post? if uuid false else validation_errors_for_schema? end else false end end
policy_name()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 47 def policy_name :'webhooks::webhook' end
policy_record()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 55 def policy_record webhook end
process_post()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 22 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 29 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 86 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
PactBroker::Api::Resources::BaseResource#decorator_options
# File lib/pact_broker/api/resources/webhook_execution.rb, line 79 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 61 def post_response_body webhook_execution_result decorator_class(:webhook_execution_result_decorator).new(webhook_execution_result).to_json(**decorator_options) end
schema()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 90 def schema api_contract_class(:webhook_contract) end
uuid()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 75 def uuid identifier_from_path[:uuid] end
webhook()
click to toggle source
# File lib/pact_broker/api/resources/webhook_execution.rb, line 65 def webhook @webhook ||= begin if uuid webhook_service.find_by_uuid uuid else build_unsaved_webhook end end end