Class: Rpush::Daemon::Wns::Delivery
- Defined in:
- lib/rpush/daemon/wns/delivery.rb
Overview
Constant Summary collapse
- WPN_TOKEN_URI =
Oauth2.0 token endpoint. This endpoint is used to request authorization tokens.
URI.parse('https://login.live.com/accesstoken.srf')
- ACCESS_TOKEN_REQUEST_DATA =
Data used to request authorization tokens.
{ "grant_type" => "client_credentials", "scope" => "notify.windows.com" }
- MAX_RETRIES =
14
- FAILURE_MESSAGES =
{ 400 => 'One or more headers were specified incorrectly or conflict with another header.', 401 => 'The cloud service did not present a valid authentication ticket. The OAuth ticket may be invalid.', 403 => 'The cloud service is not authorized to send a notification to this URI even though they are authenticated.', 404 => 'The channel URI is not valid or is not recognized by WNS.', 405 => 'Invalid method (GET, CREATE); only POST (Windows or Windows Phone) or DELETE (Windows Phone only) is allowed.', 406 => 'The cloud service exceeded its throttle limit.', 410 => 'The channel expired.', 413 => 'The notification payload exceeds the 5000 byte size limit.', 500 => 'An internal failure caused notification delivery to fail.', 503 => 'The server is currently unavailable.' }
Instance Method Summary collapse
-
#initialize(app, http, notification, batch) ⇒ Delivery
constructor
A new instance of Delivery.
- #perform ⇒ Object
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
Constructor Details
#initialize(app, http, notification, batch) ⇒ Delivery
Returns a new instance of Delivery.
27 28 29 30 31 32 |
# File 'lib/rpush/daemon/wns/delivery.rb', line 27 def initialize(app, http, notification, batch) @app = app @http = http @notification = notification @batch = batch end |
Instance Method Details
#perform ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rpush/daemon/wns/delivery.rb', line 34 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 |