Sha256: 1c331b6eecf1329f71f655132a8cd592d747906ba99a5e2f741508906940da64
Contents?: true
Size: 672 Bytes
Versions: 4
Compression:
Stored size: 672 Bytes
Contents
require 'solidus_webhooks/errors' class Spree::Webhook include ActiveModel::Model attr_accessor :handler, :id def receive(payload, user) if handler_arity == 1 handler.call(payload) else handler.call(payload, user) end end 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 private def handler_arity if handler.respond_to?(:arity) handler.arity else handler.method(:call).arity end end end
Version data entries
4 entries across 4 versions & 1 rubygems