Class: Pushr::MessageFcm
- Inherits:
-
Message
- Object
- Message
- Pushr::MessageFcm
- Defined in:
- lib/pushr/message_fcm.rb
Constant Summary collapse
- POSTFIX =
'fcm'.freeze
Instance Attribute Summary collapse
-
#android ⇒ Object
Returns the value of attribute android.
-
#apns ⇒ Object
Returns the value of attribute apns.
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#data ⇒ Object
Returns the value of attribute data.
-
#fcm_options ⇒ Object
Returns the value of attribute fcm_options.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notification ⇒ Object
Returns the value of attribute notification.
-
#token ⇒ Object
Returns the value of attribute token.
-
#topic ⇒ Object
Returns the value of attribute topic.
-
#webpush ⇒ Object
Returns the value of attribute webpush.
Instance Method Summary collapse
- #to_hash ⇒ Object
-
#to_message ⇒ Object
{ “name”: string, “data”: { string: string, … }, “notification”: { object(Notification) }, “android”: { object(AndroidConfig) }, “webpush”: { object(WebpushConfig) }, “apns”: { object(ApnsConfig) }, “fcm_options”: { object (FcmOptions) },.
Instance Attribute Details
#android ⇒ Object
Returns the value of attribute android.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def android @android end |
#apns ⇒ Object
Returns the value of attribute apns.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def apns @apns end |
#condition ⇒ Object
Returns the value of attribute condition.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def condition @condition end |
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def data @data end |
#fcm_options ⇒ Object
Returns the value of attribute fcm_options.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def @fcm_options end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def name @name end |
#notification ⇒ Object
Returns the value of attribute notification.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def notification @notification end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def token @token end |
#topic ⇒ Object
Returns the value of attribute topic.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def topic @topic end |
#webpush ⇒ Object
Returns the value of attribute webpush.
5 6 7 |
# File 'lib/pushr/message_fcm.rb', line 5 def webpush @webpush end |
Instance Method Details
#to_hash ⇒ Object
44 45 46 47 48 49 |
# File 'lib/pushr/message_fcm.rb', line 44 def to_hash hsh = { type: self.class.to_s, app: app, name: name, data: data, notification: notification, android: android, webpush: webpush, apns: apns, fcm_options: , token: token, topic: topic, condition: condition } hsh[Pushr::Core.external_id_tag] = external_id if external_id hsh end |
#to_message ⇒ Object
{
"name": string,
"data": {
string: string,
...
},
"notification": {
object(Notification)
},
"android": {
object(AndroidConfig)
},
"webpush": {
object(WebpushConfig)
},
"apns": {
object(ApnsConfig)
},
"fcm_options": {
object (FcmOptions)
},
// Union field target can be only one of the following:
"token": string,
"topic": string,
"condition": string
// End of list of possible types for union field target.
}
36 37 38 39 40 41 42 |
# File 'lib/pushr/message_fcm.rb', line 36 def hsh = {} %w[name data notification android webpush apns fcm_options token topic condition].each do |variable| hsh[variable] = send(variable) if send(variable) end MultiJson.dump(message: hsh) end |