Class: Togul::Config
- Inherits:
-
Object
- Object
- Togul::Config
- Defined in:
- lib/togul/config.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
'https://api.togul.io'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#cache_ttl ⇒ Object
readonly
Returns the value of attribute cache_ttl.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#fallback_mode ⇒ Object
readonly
Returns the value of attribute fallback_mode.
-
#retry_count ⇒ Object
readonly
Returns the value of attribute retry_count.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(environment:, api_key: '', timeout: 5, cache_ttl: 30, fallback_mode: :fail_closed, retry_count: 2, base_url: nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(environment:, api_key: '', timeout: 5, cache_ttl: 30, fallback_mode: :fail_closed, retry_count: 2, base_url: nil) ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/togul/config.rb', line 16 def initialize( environment:, api_key: '', timeout: 5, cache_ttl: 30, fallback_mode: :fail_closed, retry_count: 2, base_url: nil ) @base_url = base_url&.chomp('/') || DEFAULT_BASE_URL @api_key = api_key @environment = environment @timeout = timeout @cache_ttl = cache_ttl @fallback_mode = fallback_mode @retry_count = retry_count end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def base_url @base_url end |
#cache_ttl ⇒ Object (readonly)
Returns the value of attribute cache_ttl.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def cache_ttl @cache_ttl end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def environment @environment end |
#fallback_mode ⇒ Object (readonly)
Returns the value of attribute fallback_mode.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def fallback_mode @fallback_mode end |
#retry_count ⇒ Object (readonly)
Returns the value of attribute retry_count.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def retry_count @retry_count end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/togul/config.rb', line 7 def timeout @timeout end |