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.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
Initializes the configuration with optional settings.
-
#method_missing(method, *args, &block) ⇒ void
Provides thread-safe access to missing methods, allowing dynamic handling of configuration options.
-
#respond_to_missing?(method, include_private = false) ⇒ Boolean
Ensures that the object responds correctly to methods handled by method_missing.
Constructor Details
#initialize(options = {}) ⇒ Configuration
Initializes the configuration with optional settings.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fulfil_api/configuration.rb', line 15 def initialize( = {}) @mutex = Mutex.new # 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ void
This method returns an undefined value.
Provides thread-safe access to missing methods, allowing dynamic handling of configuration options.
33 34 35 |
# File 'lib/fulfil_api/configuration.rb', line 33 def method_missing(method, *args, &block) @mutex.synchronize { super } 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 |
#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 |
Instance Method Details
#respond_to_missing?(method, include_private = false) ⇒ Boolean
Ensures that the object responds correctly to methods handled by method_missing.
42 43 44 |
# File 'lib/fulfil_api/configuration.rb', line 42 def respond_to_missing?(method, include_private = false) @mutex.synchronize { super } end |