Class: SimpleGCM::Message
- Inherits:
-
Object
- Object
- SimpleGCM::Message
- Defined in:
- lib/simple_gcm/message.rb
Constant Summary collapse
- ATTRIBUTES =
[:data, :collapse_key, :delay_while_idle, :time_to_live].freeze
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Message
constructor
A new instance of Message.
- #inspect ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Message
Returns a new instance of Message.
7 8 9 10 11 12 13 14 |
# File 'lib/simple_gcm/message.rb', line 7 def initialize(args = {}) @data = {} ATTRIBUTES.each do |attr| if (args.key?(attr)) instance_variable_set("@#{attr}", args[attr]) end end end |
Instance Method Details
#inspect ⇒ Object
16 17 18 19 20 21 |
# File 'lib/simple_gcm/message.rb', line 16 def inspect ATTRIBUTES.inject({ }) do |h, attr| h[attr] = instance_variable_get("@#{attr}") h end end |
#to_json ⇒ Object
23 24 25 |
# File 'lib/simple_gcm/message.rb', line 23 def to_json self.inspect.to_json end |