Class: Hooks::Plugins::Handlers::Base
- Inherits:
-
Object
- Object
- Hooks::Plugins::Handlers::Base
- Includes:
- Core::ComponentAccess
- Defined in:
- lib/hooks/plugins/handlers/base.rb
Overview
Base class for all webhook handlers
All custom handlers must inherit from this class and implement the #call method
Direct Known Subclasses
Instance Method Summary collapse
-
#call(payload:, headers:, env:, config:) ⇒ Hash, ...
Process a webhook request.
-
#error!(body, status = 500) ⇒ Object
Terminate request processing with a custom error response.
Methods included from 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
24 25 26 |
# File 'lib/hooks/plugins/handlers/base.rb', line 24 def call(payload:, headers:, env:, config:) raise NotImplementedError, "Handler must implement #call method" end |
#error!(body, status = 500) ⇒ Object
Terminate request processing with a custom error response
This method provides the same interface as Grape’s ‘error!` method, allowing handlers to immediately stop processing and return a specific error response to the client.
46 47 48 |
# File 'lib/hooks/plugins/handlers/base.rb', line 46 def error!(body, status = 500) raise Error.new(body, status) end |