Class: Contrast::Config::CertificationConfiguration

Inherits:
Object
  • Object
show all
Includes:
Contrast::Components::ComponentBase, BaseConfiguration
Defined in:
lib/contrast/config/certification_configuration.rb

Overview

Certificate Configuration

Constant Summary collapse

CANON_NAME =
'api.certification'
CONFIG_VALUES =
%w[ca_file cert_file key_file enable].cs__freeze

Constants included from Contrast::Components::ComponentBase

Contrast::Components::ComponentBase::ENABLE

Constants included from Diagnostics::Tools

Diagnostics::Tools::CHECK

Constants included from Diagnostics::SingletonTools

Diagnostics::SingletonTools::API_CREDENTIALS, Diagnostics::SingletonTools::CONTRAST_MARK

Constants included from BaseConfiguration

BaseConfiguration::AT_UNDERSCORE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Contrast::Components::ComponentBase

#canon_name, #config_values, #false?, #file_exists?, #stringify_array, #true?, #valid_cert?

Methods included from Diagnostics::Tools

#add_effective_config_values, #add_single_effective_value

Methods included from Diagnostics::SingletonTools

#flatten_settings, #to_config_values, #update_config, #value_to_s

Methods included from BaseConfiguration

#to_contrast_hash

Constructor Details

#initialize(hsh = {}) ⇒ CertificationConfiguration

Returns a new instance of CertificationConfiguration.



24
25
26
27
28
29
30
31
# File 'lib/contrast/config/certification_configuration.rb', line 24

def initialize hsh = {}
  return unless hsh

  @enable = hsh[:enable]
  @ca_file = hsh[:ca_file]
  @cert_file = hsh[:cert_file]
  @key_file = hsh[:key_file]
end

Instance Attribute Details

#ca_fileString

Returns path to CA Cert file.

Returns:

  • (String)

    path to CA Cert file



17
18
19
# File 'lib/contrast/config/certification_configuration.rb', line 17

def ca_file
  @ca_file
end

#cert_fileString

Returns path to Certification file.

Returns:

  • (String)

    path to Certification file



19
20
21
# File 'lib/contrast/config/certification_configuration.rb', line 19

def cert_file
  @cert_file
end

#enableBoolean, false

Returns:

  • (Boolean, false)


34
35
36
# File 'lib/contrast/config/certification_configuration.rb', line 34

def enable
  @enable.nil? ? false : @enable
end

#key_fileString

Returns path to Certification Key file.

Returns:

  • (String)

    path to Certification Key file



21
22
23
# File 'lib/contrast/config/certification_configuration.rb', line 21

def key_file
  @key_file
end

Instance Method Details

#to_effective_config(effective_config) ⇒ Object

Converts current configuration to effective config values class and appends them to EffectiveConfig class.

Parameters:



42
43
44
# File 'lib/contrast/config/certification_configuration.rb', line 42

def to_effective_config effective_config
  add_effective_config_values(effective_config, CONFIG_VALUES, CANON_NAME)
end