lib/rapnd/notification.rb in rapnd-0.1.10 vs lib/rapnd/notification.rb in rapnd-0.2.0
- old
+ new
@@ -4,11 +4,11 @@
def initialize(hash)
[:badge, :alert, :sound, :device_token, :custom].each do |k|
self.instance_variable_set("@#{k}".to_sym, hash[k]) if hash[k]
end
- raise 'Must provide device token' if self.device_token.nil?
+ raise "Must provide device token: #{hash}" if self.device_token.nil?
self.device_token = self.device_token.delete(' ')
end
def payload
if badge.nil? && sound.nil?
@@ -24,10 +24,10 @@
aps
end
def json_payload
j = ActiveSupport::JSON.encode(payload)
- raise PayloadInvalid.new("The payload is larger than allowed: #{j.length}") if j.size > 256
+ raise "The payload #{j} is larger than allowed: #{j.length}" if j.size > 256
j
end
def to_bytes
j = json_payload
\ No newline at end of file