Class: LogaltyCertificateIssuanceApiCerty::CertificateModel

Inherits:
Object
  • Object
show all
Defined in:
lib/logalty_certificate_issuance_api_certy/models/certificate_model.rb

Overview

Certificate model: - ‘personal-hsm-fortress-qes`: Qualified personal certificate (QES) hosted in the cloud (FirmaCloud). - `personal-sw`: Qualified personal certificate (AES) in software support. - `personal-sw-identity`: Qualified personal certificate (AES) hosted in the cloud (FirmaCloud). - `personal-sw-identity-sc`: Qualified personal certificate (AES) hosted in Client System (SC) in cloud. Does not require end-user activation.

Constant Summary collapse

CERTIFICATE_MODEL =
[
  # TODO: Write general description for PERSONALHSMFORTRESSQES
  PERSONALHSMFORTRESSQES = 'personal-hsm-fortress-qes'.freeze,

  # TODO: Write general description for PERSONALSW
  PERSONALSW = 'personal-sw'.freeze,

  # TODO: Write general description for PERSONALSWIDENTITY
  PERSONALSWIDENTITY = 'personal-sw-identity'.freeze,

  # TODO: Write general description for PERSONALSWIDENTITYSC
  PERSONALSWIDENTITYSC = 'personal-sw-identity-sc'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PERSONALHSMFORTRESSQES) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/logalty_certificate_issuance_api_certy/models/certificate_model.rb', line 35

def self.from_value(value, default_value = PERSONALHSMFORTRESSQES)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'personalhsmfortressqes' then PERSONALHSMFORTRESSQES
  when 'personalsw' then PERSONALSW
  when 'personalswidentity' then PERSONALSWIDENTITY
  when 'personalswidentitysc' then PERSONALSWIDENTITYSC
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/logalty_certificate_issuance_api_certy/models/certificate_model.rb', line 29

def self.validate(value)
  return false if value.nil?

  CERTIFICATE_MODEL.include?(value)
end