Class: Pushr::MessageGcm
- Inherits:
-
Message
- Object
- Message
- Pushr::MessageGcm
- Defined in:
- lib/pushr/message_gcm.rb
Constant Summary collapse
- POSTFIX =
'gcm'
Instance Attribute Summary collapse
-
#collapse_key ⇒ Object
Returns the value of attribute collapse_key.
-
#data ⇒ Object
Returns the value of attribute data.
-
#delay_while_idle ⇒ Object
Returns the value of attribute delay_while_idle.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#notification_key ⇒ Object
Returns the value of attribute notification_key.
-
#registration_ids ⇒ Object
Returns the value of attribute registration_ids.
-
#restricted_package_name ⇒ Object
Returns the value of attribute restricted_package_name.
-
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
Instance Method Summary collapse
Instance Attribute Details
#collapse_key ⇒ Object
Returns the value of attribute collapse_key.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def collapse_key @collapse_key end |
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def data @data end |
#delay_while_idle ⇒ Object
Returns the value of attribute delay_while_idle.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def delay_while_idle @delay_while_idle end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def dry_run @dry_run end |
#notification_key ⇒ Object
Returns the value of attribute notification_key.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def notification_key @notification_key end |
#registration_ids ⇒ Object
Returns the value of attribute registration_ids.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def registration_ids @registration_ids end |
#restricted_package_name ⇒ Object
Returns the value of attribute restricted_package_name.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def restricted_package_name @restricted_package_name end |
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
5 6 7 |
# File 'lib/pushr/message_gcm.rb', line 5 def time_to_live @time_to_live end |
Instance Method Details
#to_hash ⇒ Object
23 24 25 26 27 28 |
# File 'lib/pushr/message_gcm.rb', line 23 def to_hash hsh = { type: self.class.to_s, app: app, registration_ids: registration_ids, notification_key: notification_key, collapse_key: collapse_key, delay_while_idle: delay_while_idle, time_to_live: time_to_live, data: data } hsh[Pushr::Core.external_id_tag] = external_id if external_id hsh end |
#to_message ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/pushr/message_gcm.rb', line 14 def hsh = {} hsh['registration_ids'] = registration_ids %w(notification_key collapse_key delay_while_idle time_to_live data restricted_package_name dry_run).each do |variable| hsh[variable] = send(variable) if send(variable) end MultiJson.dump(hsh) end |