Class: PaymentKit::NotificationAdapter
- Inherits:
-
Object
- Object
- PaymentKit::NotificationAdapter
- Defined in:
- lib/payment_kit/notification_adapter.rb
Overview
Adapts ActiveSupport::Notifications' multi-argument callback to #call(event).
Class Method Summary collapse
-
.call(subscriber) ⇒ Object
Wraps
subscriberso the notification backend can invoke it.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Receives the backend's callback arguments and forwards only the payload.
-
#initialize(subscriber) ⇒ NotificationAdapter
constructor
:nodoc:.
Constructor Details
#initialize(subscriber) ⇒ NotificationAdapter
:nodoc:
11 12 13 |
# File 'lib/payment_kit/notification_adapter.rb', line 11 def initialize(subscriber) # :nodoc: @subscriber = subscriber end |
Class Method Details
.call(subscriber) ⇒ Object
Wraps subscriber so the notification backend can invoke it.
7 8 9 |
# File 'lib/payment_kit/notification_adapter.rb', line 7 def self.call(subscriber) new(subscriber) end |
Instance Method Details
#call(*args) ⇒ Object
Receives the backend's callback arguments and forwards only the payload.
16 17 18 19 |
# File 'lib/payment_kit/notification_adapter.rb', line 16 def call(*args) event = args.last @subscriber.call(event) end |