Class: RunApi::Core::ClientOptions
- Inherits:
-
Struct
- Object
- Struct
- RunApi::Core::ClientOptions
- Defined in:
- lib/runapi/core/types.rb
Overview
Configuration options for API clients.
Instance Attribute Summary collapse
-
#api_key ⇒ String
API key for authentication.
-
#base_url ⇒ String
Base URL for API requests.
-
#http_client ⇒ Object?
Custom HTTP transport object.
-
#max_retries ⇒ Integer
Maximum number of retry attempts.
-
#retry_base_delay ⇒ Float
Base delay between retries in seconds.
-
#retry_max_delay ⇒ Float
Maximum delay between retries in seconds.
-
#timeout ⇒ Integer
Request timeout in seconds.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ ClientOptions
constructor
A new instance of ClientOptions.
Constructor Details
#initialize(**kwargs) ⇒ ClientOptions
Returns a new instance of ClientOptions.
51 52 53 54 55 56 57 58 |
# File 'lib/runapi/core/types.rb', line 51 def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end |
Instance Attribute Details
#api_key ⇒ String
Returns API key for authentication. Required.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#base_url ⇒ String
Returns Base URL for API requests. Defaults to RunApi.base_url.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#http_client ⇒ Object?
Returns Custom HTTP transport object. Must respond to ‘#request(method, path, body:, options:)` with the same interface as HttpClient. When set, the SDK skips building its own HttpClient and delegates all HTTP calls to this object.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#max_retries ⇒ Integer
Returns Maximum number of retry attempts. Defaults to 2.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#retry_base_delay ⇒ Float
Returns Base delay between retries in seconds. Defaults to 0.5.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#retry_max_delay ⇒ Float
Returns Maximum delay between retries in seconds. Defaults to 5.0.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |
#timeout ⇒ Integer
Returns Request timeout in seconds. Defaults to 900 (15 minutes).
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/runapi/core/types.rb', line 41 ClientOptions = Struct.new( :api_key, :base_url, :timeout, :max_retries, :retry_base_delay, :retry_max_delay, :http_client, keyword_init: true ) do def initialize(**kwargs) super self.base_url ||= RunApi.base_url self.timeout ||= Constants::TIMEOUTS[:http_request] self.max_retries ||= Constants::RETRY_CONFIG[:max_retries] self.retry_base_delay ||= Constants::RETRY_CONFIG[:base_delay] self.retry_max_delay ||= Constants::RETRY_CONFIG[:max_delay] end end |