Class: DefaultHandler
- Inherits:
-
Hooks::Plugins::Handlers::Base
- Object
- Hooks::Plugins::Handlers::Base
- DefaultHandler
- Defined in:
- lib/hooks/plugins/handlers/default.rb
Overview
Default webhook handler implementation
This handler provides a basic webhook processing implementation that can be used as a fallback when no custom handler is configured for an endpoint. It demonstrates the standard handler interface and provides basic logging functionality.
Instance Method Summary collapse
-
#call(payload:, headers:, env:, config:) ⇒ Hash
Process a webhook request with basic acknowledgment.
Methods inherited from Hooks::Plugins::Handlers::Base
Methods included from Hooks::Core::ComponentAccess
#failbot, #log, #method_missing, #respond_to_missing?, #stats
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hooks::Core::ComponentAccess
Instance Method Details
#call(payload:, headers:, env:, config:) ⇒ Hash
Process a webhook request with basic acknowledgment
Provides a simple webhook processing implementation that logs the request and returns a standard acknowledgment response. This is useful for testing webhook endpoints or as a placeholder during development.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/hooks/plugins/handlers/default.rb', line 37 def call(payload:, headers:, env:, config:) log.info("🔔 Default handler invoked for webhook 🔔") # do some basic processing if payload log.debug("received payload: #{payload.inspect}") end if env log.debug("default handler got a request with the following request_id: #{env['hooks.request_id']}") end { message: "webhook processed successfully", handler: "DefaultHandler", timestamp: Time.now.utc.iso8601 } end |