Class: JustimmoClient::Config Private
- Inherits:
-
Object
- Object
- JustimmoClient::Config
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/justimmo_client/core/config.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Configuration options storage
Constant Summary collapse
- SUPPORTED_API_VERSIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[1].freeze
- REQUIRED =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%i[username password].freeze
Class Method Summary collapse
- .configure ⇒ Object private
- .url ⇒ Object private
- .validate_api_version ⇒ Object private
- .validate_credentials ⇒ Object private
Class Method Details
.configure ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 |
# File 'lib/justimmo_client/core/config.rb', line 28 def configure super self.credentials = Base64.urlsafe_encode64("#{username}:#{password}") validate_api_version end |
.url ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 |
# File 'lib/justimmo_client/core/config.rb', line 44 def url validate_credentials return "#{base_url}/v#{api_ver}" if self.base_url.start_with?("http") "#{secure ? 'https' : 'http'}://#{base_url}/v#{api_ver}" end |
.validate_api_version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 |
# File 'lib/justimmo_client/core/config.rb', line 39 def validate_api_version supported_ver = SUPPORTED_API_VERSIONS.include?(api_ver) raise JustimmoClient::UnsupportedAPIVersion, api_ver unless supported_ver end |
.validate_credentials ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 |
# File 'lib/justimmo_client/core/config.rb', line 34 def validate_credentials missing = REQUIRED.select { |r| @_config[r].nil? } raise JustimmoClient::MissingConfiguration, missing unless missing.empty? end |