Class: AppleShove::APNS::Connection
- Inherits:
-
Object
- Object
- AppleShove::APNS::Connection
- Defined in:
- lib/apple_shove/apns/connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#last_used ⇒ Object
readonly
Returns the value of attribute last_used.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(host, port, p12_string) ⇒ Connection
constructor
A new instance of Connection.
- #reconnect ⇒ Object
- #safe_last_used ⇒ Object
-
#socket ⇒ Object
lazy connect the socket.
Constructor Details
#initialize(host, port, p12_string) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 13 14 15 |
# File 'lib/apple_shove/apns/connection.rb', line 9 def initialize(host, port, p12_string) @host = host @port = port @p12_string = p12_string @p12 = nil end |
Instance Attribute Details
#last_used ⇒ Object (readonly)
Returns the value of attribute last_used.
7 8 9 |
# File 'lib/apple_shove/apns/connection.rb', line 7 def last_used @last_used end |
Instance Method Details
#disconnect ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/apple_shove/apns/connection.rb', line 23 def disconnect @ssl_sock.close if @ssl_sock begin @sock.close if @sock rescue IOError @sock = nil end end |
#reconnect ⇒ Object
33 34 35 36 |
# File 'lib/apple_shove/apns/connection.rb', line 33 def reconnect disconnect connect end |
#safe_last_used ⇒ Object
38 39 40 |
# File 'lib/apple_shove/apns/connection.rb', line 38 def safe_last_used @last_used || Time.at(0) end |
#socket ⇒ Object
lazy connect the socket
18 19 20 21 |
# File 'lib/apple_shove/apns/connection.rb', line 18 def socket connect unless connected? @ssl_sock end |