Class: OrangeData::Transport::IntermediateResult
- Inherits:
-
Object
- Object
- OrangeData::Transport::IntermediateResult
- Defined in:
- lib/orange_data/transport.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#retry_count ⇒ Object
readonly
Returns the value of attribute retry_count.
-
#retry_in ⇒ Object
readonly
Returns the value of attribute retry_in.
Instance Method Summary collapse
-
#initialize(success: false, sub_url: nil, data:, attempt_retry: false, retry_in: nil, retry_count: 0, transport: nil, errors: nil) ⇒ IntermediateResult
constructor
A new instance of IntermediateResult.
- #retry ⇒ Object
- #should_retry? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(success: false, sub_url: nil, data:, attempt_retry: false, retry_in: nil, retry_count: 0, transport: nil, errors: nil) ⇒ IntermediateResult
Returns a new instance of IntermediateResult.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/orange_data/transport.rb', line 70 def initialize( success:false, sub_url:nil, data:, attempt_retry:false, retry_in:nil, retry_count:0, transport:nil, errors:nil ) @success = success @sub_url = sub_url @data = data @attempt_retry = attempt_retry @retry_in = retry_in @retry_count = retry_count @transport = transport @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
85 86 87 |
# File 'lib/orange_data/transport.rb', line 85 def errors @errors end |
#retry_count ⇒ Object (readonly)
Returns the value of attribute retry_count.
85 86 87 |
# File 'lib/orange_data/transport.rb', line 85 def retry_count @retry_count end |
#retry_in ⇒ Object (readonly)
Returns the value of attribute retry_in.
85 86 87 |
# File 'lib/orange_data/transport.rb', line 85 def retry_in @retry_in end |
Instance Method Details
#retry ⇒ Object
95 96 97 98 99 100 |
# File 'lib/orange_data/transport.rb', line 95 def retry raise "not-retriable" unless should_retry? @transport.post_entity(@sub_url, @data, raise_errors:false, result_class:self.class, retry_count:(retry_count + 1)) end |
#should_retry? ⇒ Boolean
91 92 93 |
# File 'lib/orange_data/transport.rb', line 91 def should_retry? @attempt_retry || false end |
#success? ⇒ Boolean
87 88 89 |
# File 'lib/orange_data/transport.rb', line 87 def success? @success == true end |