Class: Exchange::ExternalAPI::Configuration
- Inherits:
-
Configurable
- Object
- Configurable
- Exchange::ExternalAPI::Configuration
- Defined in:
- lib/exchange/external_api/configuration.rb
Overview
A Class that handles api configuration options
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#fallback_with_constantize ⇒ Object
(also: #fallback)
Constantize fallback apis on the fly.
-
#key ⇒ Symbol
The configuration key.
-
#parent_module ⇒ Class
The configuration parent module.
Methods inherited from Configurable
#reset, #set, #subclass_with_constantize
Instance Attribute Details
#app_id ⇒ Object
12 13 14 |
# File 'lib/exchange/external_api/configuration.rb', line 12 def app_id @app_id end |
#fallback=(value) ⇒ Object
12 13 14 |
# File 'lib/exchange/external_api/configuration.rb', line 12 def fallback=(value) @fallback = value end |
#protocol ⇒ Object
12 13 14 |
# File 'lib/exchange/external_api/configuration.rb', line 12 def protocol @protocol end |
#retries ⇒ Object
12 13 14 |
# File 'lib/exchange/external_api/configuration.rb', line 12 def retries @retries end |
Instance Method Details
#fallback_with_constantize ⇒ Object Also known as: fallback
Constantize fallback apis on the fly
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/exchange/external_api/configuration.rb', line 18 def fallback_with_constantize self.fallback = Array(fallback_without_constantize).map do |fb| unless !fb || fb.is_a?(Class) parent_module.const_get camelize(fb) else fb end end fallback_without_constantize end |
#key ⇒ Symbol
The configuration key
42 43 44 |
# File 'lib/exchange/external_api/configuration.rb', line 42 def key :api end |
#parent_module ⇒ Class
The configuration parent module
35 36 37 |
# File 'lib/exchange/external_api/configuration.rb', line 35 def parent_module ExternalAPI end |