Class: Faraday::Request::Retry::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/faraday/request/retry.rb

Constant Summary collapse

DEFAULT_CHECK =
lambda { |env,exception| false }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(value) ⇒ Object


34
35
36
37
38
39
40
# File 'lib/faraday/request/retry.rb', line 34

def self.from(value)
  if Integer === value
    new(value)
  else
    super(value)
  end
end

Instance Method Details

#backoff_factorObject


58
59
60
# File 'lib/faraday/request/retry.rb', line 58

def backoff_factor
  (self[:backoff_factor] ||= 1).to_f
end

#exceptionsObject


62
63
64
# File 'lib/faraday/request/retry.rb', line 62

def exceptions
  Array(self[:exceptions] ||= DEFAULT_EXCEPTIONS)
end

#intervalObject


46
47
48
# File 'lib/faraday/request/retry.rb', line 46

def interval
  (self[:interval] ||= 0).to_f
end

#interval_randomnessObject


54
55
56
# File 'lib/faraday/request/retry.rb', line 54

def interval_randomness
  (self[:interval_randomness] ||= 0).to_f
end

#maxObject


42
43
44
# File 'lib/faraday/request/retry.rb', line 42

def max
  (self[:max] ||= 2).to_i
end

#max_intervalObject


50
51
52
# File 'lib/faraday/request/retry.rb', line 50

def max_interval
  (self[:max_interval] ||= Float::MAX).to_f
end

#methodsObject


66
67
68
# File 'lib/faraday/request/retry.rb', line 66

def methods
  Array(self[:methods] ||= IDEMPOTENT_METHODS)
end

#retry_blockObject


74
75
76
# File 'lib/faraday/request/retry.rb', line 74

def retry_block
  self[:retry_block] ||= Proc.new {}
end

#retry_ifObject


70
71
72
# File 'lib/faraday/request/retry.rb', line 70

def retry_if
  self[:retry_if] ||= DEFAULT_CHECK
end

#retry_statusesObject


78
79
80
# File 'lib/faraday/request/retry.rb', line 78

def retry_statuses
  Array(self[:retry_statuses] ||= [])
end