Class: DeepL::Configuration Private
- Inherits:
-
Object
- Object
- DeepL::Configuration
- Defined in:
- lib/deepl/configuration.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.
The options of one DeepL::Client or DeepL::AdminClient, built by Utils::ClientBuilder. Nothing is read from the environment.
Constant Summary collapse
- ATTRIBUTES =
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[auth_key host logger max_network_retries user_agent headers timeout].freeze
Instance Method Summary collapse
- #==(other) ⇒ Object private
- #attributes ⇒ Object private
-
#initialize(auth_key:, host:, max_network_retries:, timeout:, logger:, headers:, user_agent:, send_platform_info:, app_info:) ⇒ Configuration
constructor
private
rubocop:disable Metrics/ParameterLists.
-
#inspect ⇒ Object
private
Redacts the auth key, so that it never shows in the inspect output of objects holding the configuration.
Constructor Details
#initialize(auth_key:, host:, max_network_retries:, timeout:, logger:, headers:, user_agent:, send_platform_info:, app_info:) ⇒ Configuration
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.
rubocop:disable Metrics/ParameterLists
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/deepl/configuration.rb', line 15 def initialize(auth_key:, host:, max_network_retries:, timeout:, logger:, headers:, # rubocop:disable Metrics/ParameterLists user_agent:, send_platform_info:, app_info:) @auth_key = auth_key @host = host @max_network_retries = max_network_retries @timeout = timeout @logger = logger @headers = headers @user_agent = user_agent || construct_user_agent(send_platform_info, app_info) end |
Instance Method Details
#==(other) ⇒ 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.
30 31 32 |
# File 'lib/deepl/configuration.rb', line 30 def ==(other) other.is_a?(Configuration) && attributes == other.attributes end |
#attributes ⇒ 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.
26 27 28 |
# File 'lib/deepl/configuration.rb', line 26 def attributes ATTRIBUTES.to_h { |attr| [attr, send(attr)] } end |
#inspect ⇒ 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.
Redacts the auth key, so that it never shows in the inspect output of objects holding the configuration.
36 37 38 39 |
# File 'lib/deepl/configuration.rb', line 36 def inspect shown = attributes.merge(auth_key: auth_key.nil? ? nil : '[REDACTED]') "#<#{self.class.name} #{shown.map { |name, value| "#{name}=#{value.inspect}" }.join(', ')}>" end |