class OrangeData::Transport::IntermediateResult
Attributes
errors[R]
retry_count[R]
retry_in[R]
Public Class Methods
new( success:false, sub_url:nil, data:, attempt_retry:false, retry_in:nil, retry_count:0, transport:nil, errors:nil )
click to toggle source
# File lib/orange_data/transport.rb, line 69 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
Public Instance Methods
retry()
click to toggle source
# File lib/orange_data/transport.rb, line 94 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?()
click to toggle source
# File lib/orange_data/transport.rb, line 90 def should_retry? @attempt_retry || false end
success?()
click to toggle source
# File lib/orange_data/transport.rb, line 86 def success? @success == true end
Protected Instance Methods
get_result_with(get_method)
click to toggle source
# File lib/orange_data/transport.rb, line 103 def get_result_with(get_method) raise "Non-success" unless success? @transport.send( get_method, @data.respond_to?(:inn) && @data.inn || @data[:inn] || @data["inn"], @data.respond_to?(:id) && @data.id || @data[:id] || @data["id"] ) end