class RubyPushNotifications::MPNS::MPNSPusher
This class is responsible for sending notifications to the MPNS
service.
Public Class Methods
new(certificate = nil, options = {})
click to toggle source
Initializes the MPNSPusher
@param certificate [String]. The PEM encoded MPNS
certificate. @param options [Hash] optional. Options for GCMPusher. Currently supports:
* open_timeout [Integer]: Number of seconds to wait for the connection to open. Defaults to 30. * read_timeout [Integer]: Number of seconds to wait for one block to be read. Defaults to 30.
(msdn.microsoft.com/pt-br/library/windows/apps/ff941099)
# File lib/ruby-push-notifications/mpns/mpns_pusher.rb, line 16 def initialize(certificate = nil, options = {}) @certificate = certificate @options = options end
Public Instance Methods
push(notifications)
click to toggle source
Actually pushes the given notifications. Assigns every notification an array with the result of each individual notification.
@param notifications [Array]. Array of MPNSNotification
to send.
# File lib/ruby-push-notifications/mpns/mpns_pusher.rb, line 26 def push(notifications) notifications.each do |notif| notif.results = MPNSConnection.post notif, @certificate, @options end end