Class: SolidusWebhooks::Configuration
- Inherits:
-
Object
- Object
- SolidusWebhooks::Configuration
- Defined in:
- lib/solidus_webhooks/configuration.rb
Instance Method Summary collapse
- #find_webhook_handler(id) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_webhook_handler(id, handler) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 |
# File 'lib/solidus_webhooks/configuration.rb', line 7 def initialize @handlers = {} end |
Instance Method Details
#find_webhook_handler(id) ⇒ Object
20 21 22 |
# File 'lib/solidus_webhooks/configuration.rb', line 20 def find_webhook_handler(id) @handlers[id.to_sym] end |
#register_webhook_handler(id, handler) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/solidus_webhooks/configuration.rb', line 11 def register_webhook_handler(id, handler) unless handler.respond_to? :call raise SolidusWebhooks::InvalidHandler, "Please provide a handler that responds to #call, got: #{handler.inspect}" end @handlers[id.to_sym] = handler end |