class Rpush::Daemon::Apns::Delivery
Public Class Methods
new(app, connection, batch)
click to toggle source
# File lib/rpush/daemon/apns/delivery.rb, line 5 def initialize(app, connection, batch) @app = app @connection = connection @batch = batch end
Public Instance Methods
perform()
click to toggle source
# File lib/rpush/daemon/apns/delivery.rb, line 11 def perform @connection.write(batch_to_binary) mark_batch_delivered describe_deliveries rescue Rpush::Daemon::TcpConnectionError => error mark_batch_retryable(Time.now + 10.seconds, error) raise rescue StandardError => error mark_batch_failed(error) raise ensure @batch.all_processed end
Protected Instance Methods
batch_to_binary()
click to toggle source
# File lib/rpush/daemon/apns/delivery.rb, line 27 def batch_to_binary payload = "" @batch.each_notification do |notification| payload << notification.to_binary end payload end
describe_deliveries()
click to toggle source
# File lib/rpush/daemon/apns/delivery.rb, line 35 def describe_deliveries @batch.each_notification do |notification| log_info("#{notification.id} sent to #{notification.device_token}") end end