Class: Pling::APN::Feedback
- Inherits:
-
Object
- Object
- Pling::APN::Feedback
- Includes:
- Configurable
- Defined in:
- lib/pling/apn/feedback.rb
Overview
Instances of this class can be used to retrieve device identifiers that have been marked invalid. This should be done on a regular basis since Apple will ban you if you continue to send push notifications to invalid devices.
The only operation supported by instances of this class is #get. The method simply returns a list of the identifieres that have been marked invalid since you last called this method.
Instance Method Summary (collapse)
-
- (Array<String>) get
Retrieves all device identifiers that have been marked invalid since the method has been called last.
-
- (Feedback) initialize(configuration)
constructor
Creates a new instance of this class and establishes a connection to Apple's Push Notification Service.
Constructor Details
- (Feedback) initialize(configuration)
Creates a new instance of this class and establishes a connection to Apple's Push Notification Service.
The connection is only established once since Apple will ban you if you reconnect each time you want to retrieve the list of invalid device identifiers. For testing purposes, you should use Apple's sandbox feedback service feedback.sandbox.push.apple.com. In order to do this, you have to specify the optional :host parameter when creating instances of this class.
50 51 52 |
# File 'lib/pling/apn/feedback.rb', line 50 def initialize(configuration) setup_configuration(configuration, :require => :certificate) end |
Instance Method Details
- (Array<String>) get
Retrieves all device identifiers that have been marked invalid since the method has been called last.
60 61 62 63 64 65 66 67 |
# File 'lib/pling/apn/feedback.rb', line 60 def get tokens = [] while line = connection.gets time, length = line.unpack("Nn") tokens << line.unpack("x6H#{length << 1}").first end tokens end |