Class: EcfDgii::PollingOptions
- Inherits:
-
Object
- Object
- EcfDgii::PollingOptions
- Defined in:
- lib/ecf_dgii/polling.rb
Overview
Configuration options for polling with exponential backoff.
Matches the TypeScript SDK’s PollingOptions interface 1:1.
Instance Attribute Summary collapse
-
#backoff_multiplier ⇒ Float
Backoff multiplier.
-
#cancellation ⇒ Proc?
Optional cancellation callable.
-
#initial_delay ⇒ Float
Initial delay between polls in seconds.
-
#max_delay ⇒ Float
Maximum delay between polls in seconds.
-
#max_retries ⇒ Integer
Maximum number of retries.
-
#timeout ⇒ Float?
Total timeout in seconds.
Instance Method Summary collapse
-
#initialize(initial_delay: 1.0, max_delay: 30.0, max_retries: 60, backoff_multiplier: 2.0, timeout: nil, cancellation: nil) ⇒ PollingOptions
constructor
A new instance of PollingOptions.
Constructor Details
#initialize(initial_delay: 1.0, max_delay: 30.0, max_retries: 60, backoff_multiplier: 2.0, timeout: nil, cancellation: nil) ⇒ PollingOptions
Returns a new instance of PollingOptions.
28 29 30 31 32 33 34 35 36 |
# File 'lib/ecf_dgii/polling.rb', line 28 def initialize(initial_delay: 1.0, max_delay: 30.0, max_retries: 60, backoff_multiplier: 2.0, timeout: nil, cancellation: nil) @initial_delay = initial_delay @max_delay = max_delay @max_retries = max_retries @backoff_multiplier = backoff_multiplier @timeout = timeout @cancellation = cancellation end |
Instance Attribute Details
#backoff_multiplier ⇒ Float
Returns Backoff multiplier. Default: 2.0.
18 19 20 |
# File 'lib/ecf_dgii/polling.rb', line 18 def backoff_multiplier @backoff_multiplier end |
#cancellation ⇒ Proc?
Returns Optional cancellation callable. Called before each poll iteration. If it returns a truthy value, polling is aborted with PollingTimeoutError.
26 27 28 |
# File 'lib/ecf_dgii/polling.rb', line 26 def cancellation @cancellation end |
#initial_delay ⇒ Float
Returns Initial delay between polls in seconds. Default: 1.0.
9 10 11 |
# File 'lib/ecf_dgii/polling.rb', line 9 def initial_delay @initial_delay end |
#max_delay ⇒ Float
Returns Maximum delay between polls in seconds. Default: 30.0.
12 13 14 |
# File 'lib/ecf_dgii/polling.rb', line 12 def max_delay @max_delay end |
#max_retries ⇒ Integer
Returns Maximum number of retries. Default: 60.
15 16 17 |
# File 'lib/ecf_dgii/polling.rb', line 15 def max_retries @max_retries end |
#timeout ⇒ Float?
Returns Total timeout in seconds. Optional (nil = no timeout).
21 22 23 |
# File 'lib/ecf_dgii/polling.rb', line 21 def timeout @timeout end |