Class: Doohly::Configuration
- Inherits:
-
Object
- Object
- Doohly::Configuration
- Defined in:
- lib/doohly/configuration.rb
Overview
Configuration management for Doohly client
Constant Summary collapse
- DEFAULT_API_BASE_URL =
"https://api.dooh.ly/api/public"- DEFAULT_TIMEOUT =
30- DEFAULT_OPEN_TIMEOUT =
10
Instance Attribute Summary collapse
-
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 |
# File 'lib/doohly/configuration.rb', line 12 def initialize @api_token = nil @api_base_url = DEFAULT_API_BASE_URL @timeout = DEFAULT_TIMEOUT @open_timeout = DEFAULT_OPEN_TIMEOUT @logger = nil end |
Instance Attribute Details
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
6 7 8 |
# File 'lib/doohly/configuration.rb', line 6 def api_base_url @api_base_url end |
#api_token ⇒ Object
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/doohly/configuration.rb', line 6 def api_token @api_token end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/doohly/configuration.rb', line 6 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
6 7 8 |
# File 'lib/doohly/configuration.rb', line 6 def open_timeout @open_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/doohly/configuration.rb', line 6 def timeout @timeout end |
Instance Method Details
#validate! ⇒ Object
20 21 22 23 24 |
# File 'lib/doohly/configuration.rb', line 20 def validate! raise ConfigurationError, "API token is required" if api_token.nil? || api_token.empty? true end |