Class: Truelist::Configuration
- Inherits:
-
Object
- Object
- Truelist::Configuration
- Defined in:
- lib/truelist/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#raise_on_error ⇒ Object
Returns the value of attribute raise_on_error.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #api_key! ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 |
# File 'lib/truelist/configuration.rb', line 7 def initialize @api_key = ENV.fetch('TRUELIST_API_KEY', nil) @base_url = 'https://api.truelist.io' @timeout = 10 @max_retries = 2 @raise_on_error = false end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def base_url @base_url end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def max_retries @max_retries end |
#raise_on_error ⇒ Object
Returns the value of attribute raise_on_error.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def raise_on_error @raise_on_error end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def timeout @timeout end |
Instance Method Details
#api_key! ⇒ Object
15 16 17 18 |
# File 'lib/truelist/configuration.rb', line 15 def api_key! api_key || raise(Truelist::AuthenticationError, 'Truelist API key is not configured. Set TRUELIST_API_KEY or use Truelist.configure.') end |