Class: FulfilApi::Configuration
- Inherits:
-
Object
- Object
- FulfilApi::Configuration
- Defined in:
- lib/fulfil_api/configuration.rb
Overview
Configuration model for the Fulfil gem.
This model holds configuration settings and provides thread-safe access to these settings.
Constant Summary collapse
- DEFAULT_API_VERSION =
"v2"- DEFAULT_REQUEST_OPTIONS =
{ open_timeout: 1, read_timeout: 5, write_timeout: 5, timeout: 5 }.freeze
- DEFAULT_CONNECTION_OPTIONS =
Tuning for the persistent (keep-alive) HTTP connection.
max_retriesre-enables Ruby's built-in retry for idempotent requests (GET/HEAD/PUT/DELETE/OPTIONS). Thenet_http_persistentadapter forces it to 0, which means a keep-alive socket the server has already dropped surfaces as a read timeout instead of being transparently retried on a fresh socket. POST is never auto-retried, so this is side-effect safe.idle_timeoutandpool_sizeare passed through to the underlying Net::HTTP::Persistent connection when set. { max_retries: 1 }.freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#request_options ⇒ Object
Returns the value of attribute request_options.
-
#tpl ⇒ Object
Returns the value of attribute tpl.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
Initializes the configuration with optional settings.
Constructor Details
#initialize(options = {}) ⇒ Configuration
Initializes the configuration with optional settings.
31 32 33 34 35 36 37 38 39 |
# File 'lib/fulfil_api/configuration.rb', line 31 def initialize( = {}) # Assigns the optional configuration options .each_pair do |key, value| send(:"#{key}=", value) if respond_to?(:"#{key}=") end # Sets the default options if not provided end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
9 10 11 |
# File 'lib/fulfil_api/configuration.rb', line 9 def access_token @access_token end |
#api_version ⇒ Object
Returns the value of attribute api_version.
9 10 11 |
# File 'lib/fulfil_api/configuration.rb', line 9 def api_version @api_version end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
10 11 12 |
# File 'lib/fulfil_api/configuration.rb', line 10 def @connection_options end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
9 10 11 |
# File 'lib/fulfil_api/configuration.rb', line 9 def merchant_id @merchant_id end |
#request_options ⇒ Object
Returns the value of attribute request_options.
9 10 11 |
# File 'lib/fulfil_api/configuration.rb', line 9 def @request_options end |
#tpl ⇒ Object
Returns the value of attribute tpl.
9 10 11 |
# File 'lib/fulfil_api/configuration.rb', line 9 def tpl @tpl end |