Class: Rapns::Daemon::Gcm::Delivery

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

Overview

Constant Summary collapse

GCM_URI =
URI.parse('https://android.googleapis.com/gcm/send')
UNAVAILABLE_STATES =
['Unavailable', 'InternalServerError']

Instance Method Summary collapse

Methods included from MultiJsonHelper

#multi_json_dump, #multi_json_load

Methods inherited from Delivery

#mark_delivered, #mark_failed, perform, #retry_after, #retry_exponentially

Methods included from Reflectable

#reflect

Constructor Details

#initialize(app, http, notification) ⇒ Delivery

Returns a new instance of Delivery.



11
12
13
14
15
# File 'lib/rapns/daemon/gcm/delivery.rb', line 11

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

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
# File 'lib/rapns/daemon/gcm/delivery.rb', line 17

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