Class: Rapns::Daemon::Apns::DeliveryHandler
- Inherits:
-
DeliveryHandler
- Object
- DeliveryHandler
- Rapns::Daemon::Apns::DeliveryHandler
- Defined in:
- lib/rapns/daemon/apns/delivery_handler.rb
Constant Summary collapse
- HOSTS =
{ :production => ['gateway.push.apple.com', 2195], :development => ['gateway.sandbox.push.apple.com', 2195], # deprecated :sandbox => ['gateway.sandbox.push.apple.com', 2195] }
Instance Attribute Summary
Attributes inherited from DeliveryHandler
Instance Method Summary collapse
- #deliver(notification) ⇒ Object
-
#initialize(app) ⇒ DeliveryHandler
constructor
A new instance of DeliveryHandler.
- #stopped ⇒ Object
Methods inherited from DeliveryHandler
Methods included from Reflectable
Constructor Details
#initialize(app) ⇒ DeliveryHandler
Returns a new instance of DeliveryHandler.
11 12 13 14 |
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 11 def initialize(app) @app = app @host, @port = HOSTS[@app.environment.to_sym] end |
Instance Method Details
#deliver(notification) ⇒ Object
16 17 18 |
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 16 def deliver(notification) Rapns::Daemon::Apns::Delivery.perform(@app, connection, notification) end |
#stopped ⇒ Object
20 21 22 |
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 20 def stopped @connection.close if @connection end |