Class: Fireimg::Configuration
- Inherits:
-
Object
- Object
- Fireimg::Configuration
- Defined in:
- lib/fireimg/configuration.rb
Constant Summary collapse
- DEFAULT_API_BASE =
'https://api.fireimg.com'- DEFAULT_CDN_BASE =
'https://img.fireimg.com'
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Returns the value of attribute api_base.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#cdn_base ⇒ Object
Returns the value of attribute cdn_base.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #configured? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 |
# File 'lib/fireimg/configuration.rb', line 10 def initialize @api_key = ENV['FIREIMG_API_KEY'].to_s.strip @project = (ENV['FIREIMG_PROJECT'] || '').to_s.strip @api_base = strip_slash(ENV['FIREIMG_API_BASE'].to_s.strip) @api_base = DEFAULT_API_BASE if @api_base.empty? @cdn_base = strip_slash(ENV['FIREIMG_CDN_BASE'].to_s.strip) @cdn_base = DEFAULT_CDN_BASE if @cdn_base.empty? end |
Instance Attribute Details
#api_base ⇒ Object
Returns the value of attribute api_base.
8 9 10 |
# File 'lib/fireimg/configuration.rb', line 8 def api_base @api_base end |
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/fireimg/configuration.rb', line 8 def api_key @api_key end |
#cdn_base ⇒ Object
Returns the value of attribute cdn_base.
8 9 10 |
# File 'lib/fireimg/configuration.rb', line 8 def cdn_base @cdn_base end |
#project ⇒ Object
Returns the value of attribute project.
8 9 10 |
# File 'lib/fireimg/configuration.rb', line 8 def project @project end |
Instance Method Details
#configured? ⇒ Boolean
19 20 21 |
# File 'lib/fireimg/configuration.rb', line 19 def configured? !api_key.to_s.strip.empty? && !project.to_s.strip.empty? end |