Class: Quandl::Command::Config
- Inherits:
-
Object
- Object
- Quandl::Command::Config
- Includes:
- Support::Attributes
- Defined in:
- lib/quandl/command/config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #auth_token ⇒ Object
- #file_dir ⇒ Object
- #file_path ⇒ Object
-
#initialize(opts = {}) ⇒ Config
constructor
A new instance of Config.
- #quandl_url ⇒ Object
- #request_platform ⇒ Object
- #stderr ⇒ Object
- #stdout ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Config
16 17 18 19 20 21 |
# File 'lib/quandl/command/config.rb', line 16 def initialize(opts={}) self. = opts.symbolize_keys convert_legacy_config ensure_directory_is_present @attributes = read_config_from_file.stringify_keys end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/quandl/command/config.rb', line 14 def end |
Instance Method Details
#auth_token ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/quandl/command/config.rb', line 40 def auth_token return @auth_token if @auth_token.present? @auth_token = [:token] if [:token].present? @auth_token = ENV['QUANDL_TOKEN'] if @auth_token.blank? @auth_token = read_attribute(:token) if @auth_token.blank? @auth_token end |
#file_dir ⇒ Object
56 57 58 |
# File 'lib/quandl/command/config.rb', line 56 def file_dir File.dirname(file_path) end |
#file_path ⇒ Object
52 53 54 |
# File 'lib/quandl/command/config.rb', line 52 def file_path [:file_path] end |
#quandl_url ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/quandl/command/config.rb', line 31 def quandl_url return @quandl_url if @quandl_url.present? @quandl_url = [:url] if [:url].present? @quandl_url = ENV['QUANDL_URL'] if @quandl_url.blank? @quandl_url = read_attribute(:quandl_url) if @quandl_url.blank? @quandl_url = 'http://quandl.com/api/' if @quandl_url.blank? @quandl_url end |
#request_platform ⇒ Object
48 49 50 |
# File 'lib/quandl/command/config.rb', line 48 def request_platform 'sandbox' if [:sandbox].present? end |
#stderr ⇒ Object
27 28 29 |
# File 'lib/quandl/command/config.rb', line 27 def stderr [:stderr] || read_attribute(:stderr) end |
#stdout ⇒ Object
23 24 25 |
# File 'lib/quandl/command/config.rb', line 23 def stdout [:stdout] || read_attribute(:stdout) end |