Class: Quandl::ApiConfig
- Inherits:
-
Object
- Object
- Quandl::ApiConfig
- Defined in:
- lib/quandl/api_config.rb
Constant Summary collapse
- API_KEY_THREAD_KEY =
'quandl_api_key'
- API_BASE_THREAD_KEY =
'quandl_api_base'
- API_VERSION_THREAD_KEY =
'quandl_api_version_key'
Class Method Summary collapse
- .api_base ⇒ Object
- .api_base=(api_base) ⇒ Object
- .api_key ⇒ Object
- .api_key=(api_key) ⇒ Object
- .api_version ⇒ Object
- .api_version=(api_version) ⇒ Object
- .reset ⇒ Object
Class Method Details
.api_base ⇒ Object
26 27 28 |
# File 'lib/quandl/api_config.rb', line 26 def api_base Thread.current[API_BASE_THREAD_KEY] || @api_base || 'https://www.quandl.com/api/v3' end |
.api_base=(api_base) ⇒ Object
21 22 23 24 |
# File 'lib/quandl/api_config.rb', line 21 def api_base=(api_base) @api_base = api_base if @api_base.nil? Thread.current[API_BASE_THREAD_KEY] = api_base end |
.api_key ⇒ Object
17 18 19 |
# File 'lib/quandl/api_config.rb', line 17 def api_key Thread.current[API_KEY_THREAD_KEY] || @api_key end |
.api_key=(api_key) ⇒ Object
12 13 14 15 |
# File 'lib/quandl/api_config.rb', line 12 def api_key=(api_key) @api_key = api_key if @api_key.nil? Thread.current[API_KEY_THREAD_KEY] = api_key end |
.api_version ⇒ Object
35 36 37 |
# File 'lib/quandl/api_config.rb', line 35 def api_version Thread.current[API_VERSION_THREAD_KEY] || @api_version end |
.api_version=(api_version) ⇒ Object
30 31 32 33 |
# File 'lib/quandl/api_config.rb', line 30 def api_version=(api_version) @api_version = api_base if @api_version.nil? Thread.current[API_VERSION_THREAD_KEY] = api_version end |
.reset ⇒ Object
39 40 41 42 43 |
# File 'lib/quandl/api_config.rb', line 39 def reset @api_key = nil @api_base = nil @api_version = nil end |