Class: StripeLocal::Webhook::Subscriber
- Inherits:
-
Object
- Object
- StripeLocal::Webhook::Subscriber
- Defined in:
- lib/stripe_local/webhook/subscriber.rb
Overview
basically taken straight from the StripeEvents gem github.com/integrallis/stripe_event
Instance Method Summary collapse
-
#initialize(*names, &block) ⇒ Subscriber
constructor
A new instance of Subscriber.
- #register ⇒ Object
Constructor Details
#initialize(*names, &block) ⇒ Subscriber
Returns a new instance of Subscriber.
10 11 12 13 14 |
# File 'lib/stripe_local/webhook/subscriber.rb', line 10 def initialize *names, &block @names = names @block = block ensure_valid_types! end |
Instance Method Details
#register ⇒ Object
16 17 18 19 20 |
# File 'lib/stripe_local/webhook/subscriber.rb', line 16 def register ActiveSupport::Notifications.subscribe(pattern) do |_, _, _, _, payload| @block.call payload[:event] end end |