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 =
['Unavailable', 'InternalServerError']
INVALID_REGISTRATION_ID_STATES =
['InvalidRegistration', 'MismatchSenderId', 'NotRegistered', 'InvalidPackageName']

Instance Method Summary collapse

Methods included from MultiJsonHelper

#multi_json_dump, #multi_json_load

Methods inherited from Delivery

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



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

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

Instance Method Details

#performObject



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

def perform
  begin
    handle_response(do_post)
  rescue Rpush::DeliveryError => error
    mark_failed(error.code, error.description)
    raise
  end
end