Class: APN::NotificationJob
- Inherits:
-
Object
- Object
- APN::NotificationJob
- Extended by:
- Resque::Plugins::AccessWorkerFromJob
- Defined in:
- lib/apn/notification_job.rb
Overview
This is the class that’s actually enqueued via Resque when user calls APN.notify
. It gets added to the apple_server_notifications
Resque queue, which should only be operated on by workers of the APN::Sender
class.
Class Method Summary collapse
-
.perform(token, opts) ⇒ Object
Build a notification from arguments and send to Apple.
Class Method Details
.perform(token, opts) ⇒ Object
Build a notification from arguments and send to Apple
13 14 15 16 17 18 |
# File 'lib/apn/notification_job.rb', line 13 def self.perform(token, opts) msg = APN::Notification.new(token, opts) raise "Invalid notification options (did you provide :alert, :badge, or :sound?): #{opts.inspect}" unless msg.valid? worker.send_to_apple( msg ) end |