Class: Rpush::Gcm::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/rpush/gcm/notification.rb

Instance Method Summary collapse

Methods inherited from Notification

completed_and_older_than, created_before, #data, #data=, #payload, #payload_data_size, #payload_size, #registration_ids=

Methods included from MultiJsonHelper

#multi_json_dump, #multi_json_load

Instance Method Details

#as_jsonObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rpush/gcm/notification.rb', line 11

def as_json
  json = {
    'registration_ids' => registration_ids,
    'delay_while_idle' => delay_while_idle,
    'data' => data
  }

  if collapse_key
    json['collapse_key'] = collapse_key
  end

  if expiry
    json['time_to_live'] = expiry
  end

  json
end