Class: Rpush::Daemon::Gcm::Delivery

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

Overview

Constant Summary collapse

GCM_URI =
URI.parse("#{host}/gcm/send")
UNAVAILABLE_STATES =
%w(Unavailable InternalServerError)
INVALID_REGISTRATION_ID_STATES =
%w(InvalidRegistration MismatchSenderId NotRegistered InvalidPackageName)

Instance Method Summary collapse

Methods included from MultiJsonHelper

#multi_json_dump, #multi_json_load

Methods inherited from Delivery

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

Methods included from Loggable

#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.



13
14
15
16
17
18
# File 'lib/rpush/daemon/gcm/delivery.rb', line 13

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

Instance Method Details

#performObject



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

def perform
  handle_response(do_post)
rescue StandardError => error
  mark_failed(error)
  raise
ensure
  @batch.notification_processed
end