Class: RubyPushNotifications::FCM::FCMNotification
- Inherits:
-
Object
- Object
- RubyPushNotifications::FCM::FCMNotification
- Includes:
- NotificationResultsManager
- Defined in:
- lib/ruby-push-notifications/fcm/fcm_notification.rb
Overview
Encapsulates a FCM Notification. By default only Required fields are set. (developer.android.com/google/fcm/server-ref.html#send-downstream)
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#registration_ids ⇒ Object
readonly
Returns the value of attribute registration_ids.
Attributes included from NotificationResultsManager
Instance Method Summary collapse
-
#as_fcm_json ⇒ String
Credits: github.com/calos0921 - for this url change to FCM std.
-
#initialize(registration_ids, data) ⇒ FCMNotification
constructor
Initializes the notification.
- #make_payload ⇒ Object
Constructor Details
#initialize(registration_ids, data) ⇒ FCMNotification
Initializes the notification
19 20 21 22 |
# File 'lib/ruby-push-notifications/fcm/fcm_notification.rb', line 19 def initialize(registration_ids, data) @registration_ids = registration_ids @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/ruby-push-notifications/fcm/fcm_notification.rb', line 11 def data @data end |
#registration_ids ⇒ Object (readonly)
Returns the value of attribute registration_ids.
11 12 13 |
# File 'lib/ruby-push-notifications/fcm/fcm_notification.rb', line 11 def registration_ids @registration_ids end |
Instance Method Details
#as_fcm_json ⇒ String
Credits: github.com/calos0921 - for this url change to FCM std
31 32 33 |
# File 'lib/ruby-push-notifications/fcm/fcm_notification.rb', line 31 def as_fcm_json JSON.dump(make_payload) end |
#make_payload ⇒ Object
24 25 26 |
# File 'lib/ruby-push-notifications/fcm/fcm_notification.rb', line 24 def make_payload { registration_ids: @registration_ids }.merge(@data) end |