Class: ApnClient::Delivery
- Inherits:
-
Object
- Object
- ApnClient::Delivery
- Defined in:
- lib/apn_client/delivery.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
-
#connection_config ⇒ Object
Returns the value of attribute connection_config.
-
#consecutive_failure_count ⇒ Object
Returns the value of attribute consecutive_failure_count.
-
#consecutive_failure_limit ⇒ Object
Returns the value of attribute consecutive_failure_limit.
-
#exception_count ⇒ Object
Returns the value of attribute exception_count.
-
#exception_limit ⇒ Object
Returns the value of attribute exception_limit.
-
#failure_count ⇒ Object
Returns the value of attribute failure_count.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#sleep_on_exception ⇒ Object
Returns the value of attribute sleep_on_exception.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#success_count ⇒ Object
Returns the value of attribute success_count.
Instance Method Summary collapse
- #elapsed ⇒ Object
-
#initialize(messages, options = {}) ⇒ Delivery
constructor
Creates a new APN delivery.
- #process! ⇒ Object
- #total_count ⇒ Object
Constructor Details
#initialize(messages, options = {}) ⇒ Delivery
Creates a new APN delivery
11 12 13 14 15 16 17 18 |
# File 'lib/apn_client/delivery.rb', line 11 def initialize(, = {}) self. = () self.exception_count = 0 self.success_count = 0 self.failure_count = 0 self.consecutive_failure_count = 0 end |
Instance Attribute Details
#callbacks ⇒ Object
Returns the value of attribute callbacks.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def callbacks @callbacks end |
#connection_config ⇒ Object
Returns the value of attribute connection_config.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def connection_config @connection_config end |
#consecutive_failure_count ⇒ Object
Returns the value of attribute consecutive_failure_count.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def consecutive_failure_count @consecutive_failure_count end |
#consecutive_failure_limit ⇒ Object
Returns the value of attribute consecutive_failure_limit.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def consecutive_failure_limit @consecutive_failure_limit end |
#exception_count ⇒ Object
Returns the value of attribute exception_count.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def exception_count @exception_count end |
#exception_limit ⇒ Object
Returns the value of attribute exception_limit.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def exception_limit @exception_limit end |
#failure_count ⇒ Object
Returns the value of attribute failure_count.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def failure_count @failure_count end |
#finished_at ⇒ Object
Returns the value of attribute finished_at.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def finished_at @finished_at end |
#messages ⇒ Object
Returns the value of attribute messages.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def @messages end |
#sleep_on_exception ⇒ Object
Returns the value of attribute sleep_on_exception.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def sleep_on_exception @sleep_on_exception end |
#started_at ⇒ Object
Returns the value of attribute started_at.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def started_at @started_at end |
#success_count ⇒ Object
Returns the value of attribute success_count.
3 4 5 |
# File 'lib/apn_client/delivery.rb', line 3 def success_count @success_count end |
Instance Method Details
#elapsed ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/apn_client/delivery.rb', line 29 def elapsed if started_at finished_at ? (finished_at - started_at) : (Time.now - started_at) else 0 end end |
#process! ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/apn_client/delivery.rb', line 20 def process! self.started_at = Time.now while && consecutive_failure_count < consecutive_failure_limit end close_connection self.finished_at = Time.now end |
#total_count ⇒ Object
37 38 39 |
# File 'lib/apn_client/delivery.rb', line 37 def total_count success_count + failure_count end |