Class: Zotero::HTTPConfig
- Inherits:
-
Object
- Object
- Zotero::HTTPConfig
- Defined in:
- lib/zotero/http_config.rb
Overview
Configuration for HTTP requests and retry behavior
Constant Summary collapse
- DEFAULTS =
{ open_timeout: 30, read_timeout: 60, verify_ssl: true, retry_on_rate_limit: true, max_retries: 3, base_delay: 1.0 }.freeze
Instance Attribute Summary collapse
-
#base_delay ⇒ Object
Returns the value of attribute base_delay.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#retry_on_rate_limit ⇒ Object
Returns the value of attribute retry_on_rate_limit.
-
#verify_ssl ⇒ Object
Returns the value of attribute verify_ssl.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ HTTPConfig
constructor
A new instance of HTTPConfig.
Constructor Details
#initialize(**options) ⇒ HTTPConfig
Returns a new instance of HTTPConfig.
18 19 20 21 22 23 24 25 26 |
# File 'lib/zotero/http_config.rb', line 18 def initialize(**) config = DEFAULTS.merge() @open_timeout = config[:open_timeout] @read_timeout = config[:read_timeout] @verify_ssl = config[:verify_ssl] @retry_on_rate_limit = config[:retry_on_rate_limit] @max_retries = config[:max_retries] @base_delay = config[:base_delay] end |
Instance Attribute Details
#base_delay ⇒ Object
Returns the value of attribute base_delay.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def base_delay @base_delay end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def max_retries @max_retries end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def read_timeout @read_timeout end |
#retry_on_rate_limit ⇒ Object
Returns the value of attribute retry_on_rate_limit.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def retry_on_rate_limit @retry_on_rate_limit end |
#verify_ssl ⇒ Object
Returns the value of attribute verify_ssl.
6 7 8 |
# File 'lib/zotero/http_config.rb', line 6 def verify_ssl @verify_ssl end |
Class Method Details
.configure {|default| ... } ⇒ Object
32 33 34 35 |
# File 'lib/zotero/http_config.rb', line 32 def self.configure yield(default) if block_given? default end |
.default ⇒ Object
28 29 30 |
# File 'lib/zotero/http_config.rb', line 28 def self.default @default ||= new end |