app/models/spree/webhook.rb in solidus_webhooks-0.2.0 vs app/models/spree/webhook.rb in solidus_webhooks-0.3.0
- old
+ new
@@ -1,11 +1,11 @@
+require 'solidus_webhooks/errors'
+
class Spree::Webhook
include ActiveModel::Model
attr_accessor :handler, :id
- WebhookNotFound = Class.new(StandardError)
-
def receive(payload, user)
if handler_arity == 1
handler.call(payload)
else
handler.call(payload, user)
@@ -14,10 +14,10 @@
def self.find(id)
id = id.to_sym # normalize incoming ids
handler = SolidusWebhooks.config.find_webhook_handler(id) or
- raise WebhookNotFound, "Cannot find a webhook handler for #{id.inspect}"
+ raise SolidusWebhooks::WebhookNotFound, "Cannot find a webhook handler for #{id.inspect}"
new(id: id, handler: handler)
end
private