Class: Chronos::Ports::TransportResult
- Inherits:
-
Object
- Object
- Chronos::Ports::TransportResult
- Defined in:
- lib/chronos/ports/transport.rb
Overview
Result returned by transport adapters instead of raising into the application.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status, options = {}) ⇒ TransportResult
constructor
A new instance of TransportResult.
- #retryable? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(status, options = {}) ⇒ TransportResult
Returns a new instance of TransportResult.
13 14 15 16 17 18 19 |
# File 'lib/chronos/ports/transport.rb', line 13 def initialize(status, = {}) @status = status @status_code = [:status_code] @retry_after = [:retry_after] @error = [:error] freeze end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
11 12 13 |
# File 'lib/chronos/ports/transport.rb', line 11 def error @error end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
11 12 13 |
# File 'lib/chronos/ports/transport.rb', line 11 def retry_after @retry_after end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
11 12 13 |
# File 'lib/chronos/ports/transport.rb', line 11 def status @status end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
11 12 13 |
# File 'lib/chronos/ports/transport.rb', line 11 def status_code @status_code end |
Instance Method Details
#retryable? ⇒ Boolean
25 26 27 |
# File 'lib/chronos/ports/transport.rb', line 25 def retryable? [:rate_limited, :server_error, :network_error].include?(status) end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/chronos/ports/transport.rb', line 21 def success? status == :success end |