Class: Rpush::Wpns::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/rpush/wpns/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



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rpush/wpns/notification.rb', line 8

def as_json
  json = {
    'message' => alert,
    'uri'     => uri
  }

  if collapse_key
    json['consolidationKey'] = collapse_key
  end

  json
end

#uri_is_valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rpush/wpns/notification.rb', line 21

def uri_is_valid?
  return (/https?:\/\/[\S]+/.match(uri) != nil)
end