Class: Rpush::Adm::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/rpush/adm/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
# File 'lib/rpush/adm/notification.rb', line 11

def as_json
  json = {
    'data' => data
  }

  if collapse_key
    json['consolidationKey'] = collapse_key
  end

  # number of seconds before message is expired
  if expiry
    json['expiresAfter'] = expiry
  end

  json
end