Class: SBF::Client::Configuration
- Inherits:
-
Object
- Object
- SBF::Client::Configuration
- Defined in:
- lib/stbaldricks/configuration.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- DEFAULT_API_ENDPOINT =
'https://api'.freeze
Class Attribute Summary collapse
- .base_uri ⇒ Object
-
.forwarded_for ⇒ Object
Returns the value of attribute forwarded_for.
- .general_token ⇒ Object
- .request_id ⇒ Object
-
.user_token ⇒ Object
Returns the value of attribute user_token.
Class Method Summary collapse
Class Attribute Details
.base_uri ⇒ Object
18 19 20 |
# File 'lib/stbaldricks/configuration.rb', line 18 def self.base_uri @base_uri ||= ENV['API_ENDPOINT'] || DEFAULT_API_ENDPOINT end |
.forwarded_for ⇒ Object
Returns the value of attribute forwarded_for.
15 16 17 |
# File 'lib/stbaldricks/configuration.rb', line 15 def forwarded_for @forwarded_for end |
.general_token ⇒ Object
22 23 24 |
# File 'lib/stbaldricks/configuration.rb', line 22 def self.general_token @general_token ||= ENV['API_KEY'] || raise(SBF::Client::Configuration::Error.new('general_token', 'must be set')) end |
.request_id ⇒ Object
26 27 28 |
# File 'lib/stbaldricks/configuration.rb', line 26 def self.request_id @request_id ||= SecureRandom.uuid end |
.user_token ⇒ Object
Returns the value of attribute user_token.
15 16 17 |
# File 'lib/stbaldricks/configuration.rb', line 15 def user_token @user_token end |
Class Method Details
.logger ⇒ Object
37 38 39 |
# File 'lib/stbaldricks/configuration.rb', line 37 def self.logger @logger ||= SBF::Client::DefaultLogger.instance end |
.logger=(new_logger) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/stbaldricks/configuration.rb', line 30 def self.logger=(new_logger) missing_methods = SBF::Client::LOG::REQUIRED_METHODS.reject { |method| new_logger.respond_to?(method) } raise SBF::Client::Configuration::Error.new('logger', "must respond to: #{missing_methods.join(', ')}") unless missing_methods.empty? @logger = new_logger end |