Class: Hooksmith::Processor::Base Abstract
- Inherits:
-
Object
- Object
- Hooksmith::Processor::Base
- Defined in:
- lib/hooksmith/processor/base.rb
Overview
This class is abstract.
Base class for all webhook processors.
Processors should inherit from this class and implement the process! method.
Instance Attribute Summary collapse
-
#payload ⇒ Hash
readonly
The payload for the webhook.
Instance Method Summary collapse
-
#can_handle?(_payload) ⇒ Boolean
Checks if the processor can handle the payload.
-
#initialize(payload) ⇒ Base
constructor
Initializes the processor with a payload.
-
#process! ⇒ Object
Process the webhook.
Constructor Details
#initialize(payload) ⇒ Base
Initializes the processor with a payload.
17 18 19 |
# File 'lib/hooksmith/processor/base.rb', line 17 def initialize(payload) @payload = payload end |
Instance Attribute Details
#payload ⇒ Hash (readonly)
Returns the payload for the webhook.
12 13 14 |
# File 'lib/hooksmith/processor/base.rb', line 12 def payload @payload end |
Instance Method Details
#can_handle?(_payload) ⇒ Boolean
Checks if the processor can handle the payload. Override this method in subclasses if conditional processing is needed.
26 27 28 |
# File 'lib/hooksmith/processor/base.rb', line 26 def can_handle?(_payload) true end |
#process! ⇒ Object
Process the webhook. Must be implemented by subclasses.
34 35 36 |
# File 'lib/hooksmith/processor/base.rb', line 34 def process! raise NotImplementedError, 'Implement process! in your processor' end |