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 ⇒ 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.
27 28 29 30 31 |
# File 'lib/justimmo_client/core/config.rb', line 27 def configure super self.credentials = Base64.urlsafe_encode64("#{username}:#{password}") validate 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.
41 42 43 |
# File 'lib/justimmo_client/core/config.rb', line 41 def url "#{secure ? 'https' : 'http'}://#{base_url}/v#{api_ver}" end |
.validate ⇒ 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.
33 34 35 36 37 38 39 |
# File 'lib/justimmo_client/core/config.rb', line 33 def validate missing = REQUIRED.select { |r| @_config[r].nil? } raise MissingConfiguration, missing unless missing.empty? supported_ver = SUPPORTED_API_VERSIONS.include?(api_ver) raise UnsupportedAPIVersion, api_ver unless supported_ver end |