Class: A2A::PushNotification::Dispatcher
- Inherits:
-
Object
- Object
- A2A::PushNotification::Dispatcher
- Defined in:
- lib/a2a/push_notification/dispatcher.rb
Defined Under Namespace
Classes: Transport
Instance Method Summary collapse
- #dispatch(config, event) ⇒ Object
-
#initialize(transport: Transport.new) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(transport: Transport.new) ⇒ Dispatcher
Returns a new instance of Dispatcher.
10 11 12 |
# File 'lib/a2a/push_notification/dispatcher.rb', line 10 def initialize(transport: Transport.new) @transport = transport end |
Instance Method Details
#dispatch(config, event) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/a2a/push_notification/dispatcher.rb', line 14 def dispatch(config, event) headers = { "Content-Type" => "application/json", "Accept" => "application/json" } headers["Authorization"] = config.authentication. if config.authentication @transport.post(config.url, body: event.to_h, headers: headers) end |