Class: APN::Feedback
- Inherits:
-
Object
- Object
- APN::Feedback
- Defined in:
- lib/apn/feedback.rb
Instance Method Summary collapse
- #client ⇒ Object
- #data ⇒ Object
-
#initialize(options = {}) ⇒ Feedback
constructor
A new instance of Feedback.
- #receive ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Feedback
Returns a new instance of Feedback.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/apn/feedback.rb', line 12 def initialize( = {}) [:host] ||= 'feedback.push.apple.com' [:port] ||= 2196 [:password] ||= '' @cert = [:cert] @password = [:password] @host = [:host] @port = [:port] @logger = APN::Log.new.write end |
Instance Method Details
#client ⇒ Object
42 43 44 |
# File 'lib/apn/feedback.rb', line 42 def client @client ||= APN::Client.new(host: @host, port: @port, cert: APN.config.cert_file, password: APN.config.cert_password) end |
#data ⇒ Object
25 26 27 28 29 |
# File 'lib/apn/feedback.rb', line 25 def data @logger.info 'Trying to get feedback from Apple push notification server...' @feedback ||= receive end |
#receive ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/apn/feedback.rb', line 31 def receive feedbacks = [] while f = client.feedback feedbacks << f end @logger.info 'Feedback received!' return feedbacks end |