Class: Rpush::Daemon::Pushy::Delivery
- Includes:
- MultiJsonHelper
- Defined in:
- lib/rpush/daemon/pushy/delivery.rb
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
-
#pushy_uri ⇒ Object
readonly
Returns the value of attribute pushy_uri.
Instance Method Summary collapse
-
#initialize(app, http, notification, batch) ⇒ Delivery
constructor
A new instance of Delivery.
- #perform ⇒ Object
Methods included from MultiJsonHelper
#multi_json_dump, #multi_json_load
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.
9 10 11 12 13 14 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 9 def initialize(app, http, notification, batch) @http = http @notification = notification @batch = batch @pushy_uri = URI.parse("https://api.pushy.me/push?api_key=#{app.api_key}") end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
7 8 9 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 7 def batch @batch end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
7 8 9 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 7 def http @http end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
7 8 9 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 7 def notification @notification end |
#pushy_uri ⇒ Object (readonly)
Returns the value of attribute pushy_uri.
7 8 9 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 7 def pushy_uri @pushy_uri end |
Instance Method Details
#perform ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rpush/daemon/pushy/delivery.rb', line 16 def perform response = send_request process_response(response) rescue SocketError => error mark_retryable(notification, Time.now + 10.seconds, error) raise rescue StandardError => error mark_failed(error) raise ensure batch.notification_processed end |