Module: IOSPN
- Included in:
- Notification
- Defined in:
- lib/ios_push_notifications.rb,
lib/ios_push_notifications/device.rb,
lib/ios_push_notifications/notification.rb,
lib/ios_push_notifications/configuration.rb
Defined Under Namespace
Classes: Configuration, Device, Notification
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
Instance Method Summary collapse
- #open(options = {}) {|ssl, sock| ... } ⇒ Object
- #open_for_delivery(options = {}, &block) ⇒ Object
-
#open_for_feedback(options = {}, &block) ⇒ Object
Yields up an SSL socket to receive feedback from.
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
25 26 27 |
# File 'lib/ios_push_notifications/configuration.rb', line 25 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
28 29 30 31 |
# File 'lib/ios_push_notifications/configuration.rb', line 28 def self.configure self.configuration ||= Configuration.new yield(configuration) end |
Instance Method Details
#open(options = {}) {|ssl, sock| ... } ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ios_push_notifications.rb', line 16 def open( = {}, &block) = IOSPN.configuration.notification.merge() cert = File.read([:cert]) ctx = OpenSSL::SSL::SSLContext.new ctx.key = OpenSSL::PKey::RSA.new(cert, [:passphrase]) ctx.cert = OpenSSL::X509::Certificate.new(cert) sock = TCPSocket.new([:host], [:port]) ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx) ssl.sync = true ssl.connect yield ssl, sock if block_given? ssl.close sock.close end |
#open_for_delivery(options = {}, &block) ⇒ Object
13 14 15 |
# File 'lib/ios_push_notifications.rb', line 13 def open_for_delivery( = {}, &block) open(, &block) end |
#open_for_feedback(options = {}, &block) ⇒ Object
Yields up an SSL socket to receive feedback from. The connections are close automatically. Configuration parameters are:
37 38 39 40 |
# File 'lib/ios_push_notifications.rb', line 37 def open_for_feedback( = {}, &block) = IOSPN.configuration.feedback.merge() Notification.open(, &block) end |