Method: APNS::Notification#initialize

Defined in:
lib/pushmeup/apns/notification.rb

#initialize(device_token, message) ⇒ Notification

Returns a new instance of Notification.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pushmeup/apns/notification.rb', line 5

def initialize(device_token, message)
  self.device_token = device_token
  if message.is_a?(Hash)
    self.alert = message[:alert]
    self.badge = message[:badge]
    self.sound = message[:sound]
    self.other = message[:other]
  elsif message.is_a?(String)
    self.alert = message
  else
    raise "Notification needs to have either a Hash or String"
  end
end