Class: Truelist::Configuration
- Inherits:
-
Object
- Object
- Truelist::Configuration
- Defined in:
- lib/truelist/configuration.rb
Instance Attribute Summary collapse
-
#allow_risky ⇒ Object
Returns the value of attribute allow_risky.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#cache_store ⇒ Object
Returns the value of attribute cache_store.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#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.
8 9 10 11 12 13 14 15 16 |
# File 'lib/truelist/configuration.rb', line 8 def initialize @api_key = ENV.fetch('TRUELIST_API_KEY', nil) @base_url = 'https://api.truelist.io' @timeout = 10 @raise_on_error = false @allow_risky = true @cache_store = nil @cache_ttl = 3600 # 1 hour in seconds end |
Instance Attribute Details
#allow_risky ⇒ Object
Returns the value of attribute allow_risky.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def allow_risky @allow_risky end |
#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 |
#cache_store ⇒ Object
Returns the value of attribute cache_store.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def cache_store @cache_store end |
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
5 6 7 |
# File 'lib/truelist/configuration.rb', line 5 def cache_ttl @cache_ttl 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
18 19 20 21 |
# File 'lib/truelist/configuration.rb', line 18 def api_key! api_key || raise(Truelist::AuthenticationError, 'Truelist API key is not configured. Set TRUELIST_API_KEY or use Truelist.configure.') end |