Module: APNS
- Defined in:
- lib/apns/core.rb,
lib/apns/notification.rb
Defined Under Namespace
Classes: Notification
Class Attribute Summary collapse
-
.host ⇒ Object
Returns the value of attribute host.
-
.pass ⇒ Object
Returns the value of attribute pass.
-
.pem ⇒ Object
Returns the value of attribute pem.
-
.port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
- .feedback ⇒ Object
- .send_notification(device_token, message) ⇒ Object
- .send_notifications(notifications) ⇒ Object
Class Attribute Details
.host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/apns/core.rb', line 13 def host @host end |
.pass ⇒ Object
Returns the value of attribute pass.
13 14 15 |
# File 'lib/apns/core.rb', line 13 def pass @pass end |
.pem ⇒ Object
Returns the value of attribute pem.
13 14 15 |
# File 'lib/apns/core.rb', line 13 def pem @pem end |
.port ⇒ Object
Returns the value of attribute port.
13 14 15 |
# File 'lib/apns/core.rb', line 13 def port @port end |
Class Method Details
.feedback ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/apns/core.rb', line 32 def self.feedback sock, ssl = self.feedback_connection apns_feedback = [] while = ssl.read(38) , token_size, token = .unpack('N1n1H*') apns_feedback << [Time.at(), token] end ssl.close sock.close return apns_feedback end |
.send_notification(device_token, message) ⇒ Object
16 17 18 19 |
# File 'lib/apns/core.rb', line 16 def self.send_notification(device_token, ) n = APNS::Notification.new(device_token, ) self.send_notifications([n]) end |
.send_notifications(notifications) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/apns/core.rb', line 21 def self.send_notifications(notifications) sock, ssl = self.open_connection notifications.each do |n| sock, ssl= send_to_apns(sock, ssl, n) end ssl.close sock.close end |