Class: CFC::Config
Instance Attribute Summary collapse
-
#api_email ⇒ Object
Returns the value of attribute api_email.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
Instance Attribute Details
#api_email ⇒ Object
Returns the value of attribute api_email.
7 8 9 |
# File 'lib/cfc/config.rb', line 7 def api_email @api_email end |
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/cfc/config.rb', line 7 def api_key @api_key end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/cfc/config.rb', line 7 def token @token end |
Class Method Details
.configure {|CFC::Config.instance| ... } ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/cfc/config.rb', line 9 def self.configure yield CFC::Config.instance if [instance.token, instance.api_key, instance.api_email].all?(&:nil?) raise CFC::Errors::ConfigurationError, 'Either `token` or BOTH of `api_key`, `api_email` must be set on call ' \ "to `configure'." elsif instance.token.nil? && [instance.api_key, instance.api_email].any?(&:nil?) raise CFC::Errors::ConfigurationError, 'Both `api_key` AND `api_email` must be set when not using token auth.' end end |