Class: GCM::Notification
- Inherits:
-
Object
- Object
- GCM::Notification
- Includes:
- ActiveModel::Model
- Defined in:
- lib/mercurius/gcm/notification.rb
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.
-
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
Instance Method Summary collapse
- #==(that) ⇒ Object
-
#initialize(attributes = {}) ⇒ Notification
constructor
validate delay_while_idle is true/false validate ttl is integer in seconds.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Notification
validate delay_while_idle is true/false validate ttl is integer in seconds
10 11 12 13 |
# File 'lib/mercurius/gcm/notification.rb', line 10 def initialize(attributes = {}) @attributes = attributes super data: @attributes.except(:collapse_key, :time_to_live, :delay_while_idle) end |
Instance Attribute Details
#collapse_key ⇒ Object
Returns the value of attribute collapse_key.
5 6 7 |
# File 'lib/mercurius/gcm/notification.rb', line 5 def collapse_key @collapse_key end |
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/mercurius/gcm/notification.rb', line 5 def data @data end |
#delay_while_idle ⇒ Object
Returns the value of attribute delay_while_idle.
5 6 7 |
# File 'lib/mercurius/gcm/notification.rb', line 5 def delay_while_idle @delay_while_idle end |
#time_to_live ⇒ Object
Returns the value of attribute time_to_live.
5 6 7 |
# File 'lib/mercurius/gcm/notification.rb', line 5 def time_to_live @time_to_live end |
Instance Method Details
#==(that) ⇒ Object
26 27 28 |
# File 'lib/mercurius/gcm/notification.rb', line 26 def ==(that) attributes == that.attributes end |
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mercurius/gcm/notification.rb', line 15 def to_h hash = { data: data, collapse_key: collapse_key, time_to_live: time_to_live, delay_while_idle: delay_while_idle } hash.reject { |k, v| v.nil? } end |