Class: RubyPushNotifications::FCM::FCMPusher
- Inherits:
-
Object
- Object
- RubyPushNotifications::FCM::FCMPusher
- Defined in:
- lib/ruby-push-notifications/fcm/fcm_pusher.rb
Overview
This class is responsible for sending notifications to the FCM service.
Instance Method Summary collapse
-
#initialize(key) ⇒ FCMPusher
constructor
Initializes the FCMPusher.
-
#push(notifications) ⇒ Object
Actually pushes the given notifications.
Constructor Details
#initialize(key) ⇒ FCMPusher
Initializes the FCMPusher
13 14 15 |
# File 'lib/ruby-push-notifications/fcm/fcm_pusher.rb', line 13 def initialize(key) @key = key end |
Instance Method Details
#push(notifications) ⇒ Object
Actually pushes the given notifications. Assigns every notification an array with the result of each individual notification.
22 23 24 25 26 |
# File 'lib/ruby-push-notifications/fcm/fcm_pusher.rb', line 22 def push(notifications) notifications.each do |notif| notif.results = FCMConnection.post notif.as_fcm_json, @key end end |