Class: Rpush::Daemon::Wpns::Delivery

Inherits:
Delivery
  • Object
show all
Defined in:
lib/rpush/daemon/wpns/delivery.rb

Overview

Constant Summary collapse

FAILURE_MESSAGES =
{
  400 => 'Bad XML or malformed notification URI.',
  401 => 'Unauthorized to send a notification to this app.'
}

Instance Method Summary collapse

Methods inherited from Delivery

#mark_batch_delivered, #mark_batch_failed, #mark_batch_retryable, #mark_delivered, #mark_failed, #mark_retryable, #mark_retryable_exponential

Methods included from Loggable

#log_debug, #log_error, #log_info, #log_warn

Methods included from Reflectable

#reflect

Constructor Details

#initialize(app, http, notification, batch) ⇒ Delivery

Returns a new instance of Delivery.



11
12
13
14
15
16
# File 'lib/rpush/daemon/wpns/delivery.rb', line 11

def initialize(app, http, notification, batch)
  @app = app
  @http = http
  @notification = notification
  @batch = batch
end

Instance Method Details

#performObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rpush/daemon/wpns/delivery.rb', line 18

def perform
  handle_response(do_post)
rescue SocketError => error
  mark_retryable(@notification, Time.now + 10.seconds, error)
  raise
rescue StandardError => error
  mark_failed(error)
  raise
ensure
  @batch.notification_processed
end