Class: Tenk::Configuration
- Inherits:
-
Object
- Object
- Tenk::Configuration
- Defined in:
- lib/configuration.rb
Overview
Holds the configuration for a Tenk client (API key and base URL, and logger)
Instance Attribute Summary collapse
-
#api_base ⇒ String
Return the base URL of the API.
-
#logger ⇒ Logger
Return the current logger being used by the gem.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Configuration
constructor
Intialize a Tenk::Configuration.
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Intialize a Tenk::Configuration
12 13 14 15 16 |
# File 'lib/configuration.rb', line 12 def initialize(opts = {}) opts.each do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
#api_base ⇒ String
Return the base URL of the API
20 21 22 |
# File 'lib/configuration.rb', line 20 def api_base @api_base || 'https://api.10000ft.com/api/v1' end |
#logger ⇒ Logger
Return the current logger being used by the gem
26 27 28 29 30 31 32 33 |
# File 'lib/configuration.rb', line 26 def logger if @logger.blank? @logger = Logger.new(STDERR) @logger.level = Logger::WARN end @logger end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/configuration.rb', line 6 def token @token end |