diff --git a/README.md b/README.md index 9adcf4e..36e01fb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +** DEPRECATED ** + # Pushmeup ### a gem for various push notification services. @@ -59,13 +61,13 @@ and install it with device_token = '123abc456def' APNS.send_notification(device_token, 'Hello iPhone!' ) - APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default') + APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', :category => 'cat1') #### Sending multiple notifications device_token = '123abc456def' n1 = APNS::Notification.new(device_token, 'Hello iPhone!' ) - n2 = APNS::Notification.new(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default') + n2 = APNS::Notification.new(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', :category => 'cat1') APNS.send_notifications([n1, n2]) > All notifications passed as a parameter will be sent on a single connection, this is done to improve @@ -80,11 +82,11 @@ and install it with # Send single notifications APNS.send_notification(device_token, 'Hello iPhone!' ) - APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default') + APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', :category => 'cat1') # Send multiple notifications n1 = APNS::Notification.new(device_token, 'Hello iPhone!' ) - n2 = APNS::Notification.new(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default') + n2 = APNS::Notification.new(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', :category => 'cat1') APNS.send_notifications([n1, n2]) ... @@ -94,12 +96,12 @@ and install it with #### Sending more information along - APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', + APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default', :category => 'cat1', :other => {:sent => 'with apns gem', :custom_param => "value"}) this will result in a payload like this: - {"aps":{"alert":"Hello iPhone!","badge":1,"sound":"default"},"sent":"with apns gem", "custom_param":"value"} + {"aps":{"alert":"Hello iPhone!","badge":1,"sound":"default", "category":"cat1"},"sent":"with apns gem", "custom_param":"value"} ### Getting your iOS device token diff --git a/lib/pushmeup/apns/notification.rb b/lib/pushmeup/apns/notification.rb index 60d76f6..fdb909d 100644 --- a/lib/pushmeup/apns/notification.rb +++ b/lib/pushmeup/apns/notification.rb @@ -1,6 +1,6 @@ module APNS class Notification - attr_accessor :device_token, :alert, :badge, :sound, :other + attr_accessor :device_token, :alert, :badge, :sound, :category, :other def initialize(device_token, message) self.device_token = device_token @@ -9,6 +9,7 @@ def initialize(device_token, message) self.badge = message[:badge] self.sound = message[:sound] self.other = message[:other] + self.category = message[:category] elsif message.is_a?(String) self.alert = message else @@ -31,6 +32,7 @@ def packaged_message aps['aps']['alert'] = self.alert if self.alert aps['aps']['badge'] = self.badge if self.badge aps['aps']['sound'] = self.sound if self.sound + aps['aps']['category'] = self.category if self.category aps.merge!(self.other) if self.other aps.to_json.gsub(/\\u([\da-fA-F]{4})/) {|m| [$1].pack("H*").unpack("n*").pack("U*")} end diff --git a/lib/pushmeup/version.rb b/lib/pushmeup/version.rb index 8d944ed..7309bfe 100644 --- a/lib/pushmeup/version.rb +++ b/lib/pushmeup/version.rb @@ -1,3 +1,3 @@ module Pushmeup - VERSION = "0.3.0" + VERSION = "0.4.0" end