Class: Spree::Webhook
- Inherits:
-
Object
- Object
- Spree::Webhook
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/spree/webhook.rb
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#id ⇒ Object
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
5 6 7 |
# File 'app/models/spree/webhook.rb', line 5 def handler @handler end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'app/models/spree/webhook.rb', line 5 def id @id end |
Class Method Details
.find(id) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/models/spree/webhook.rb', line 15 def self.find(id) id = id.to_sym # normalize incoming ids handler = SolidusWebhooks.config.find_webhook_handler(id) or raise SolidusWebhooks::WebhookNotFound, "Cannot find a webhook handler for #{id.inspect}" new(id: id, handler: handler) end |
Instance Method Details
#receive(payload, user) ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/models/spree/webhook.rb', line 7 def receive(payload, user) if handler_arity == 1 handler.call(payload) else handler.call(payload, user) end end |