Class: LogaltyCertificateIssuanceApiCerty::TransactionState

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

Overview

Transaction state: - ‘0`: CREATED — Transaction created. - `1`: ACCESS_SENT — Access notification sent. - `10`: PENDING_CERTIFICATE_CONTRACT_SIGNATURE —Pending signature of the certificate issuance contract. - `11`: PENDING_CERTIFICATE_VALIDATION — Pending validation by the video operator. - `12`: CLOSED — Transaction closed. - `13`: PENDING_CERTIFICATE_ISSUING —Pending issuance by the RA operator. - `14`: PENDING_CERTIFICATE_ACTIVATION — Pending certificate activation by the end-user. - `15`: PENDING_CERTIFICATE_DOWNLOAD — Pending certificate download by the end-user (software support only).

Constant Summary collapse

TRANSACTION_STATE =
[
  # TODO: Write general description for ENUM_0
  ENUM_0 = 0,

  # TODO: Write general description for ENUM_1
  ENUM_1 = 1,

  # TODO: Write general description for ENUM_10
  ENUM_10 = 10,

  # TODO: Write general description for ENUM_11
  ENUM_11 = 11,

  # TODO: Write general description for ENUM_12
  ENUM_12 = 12,

  # TODO: Write general description for ENUM_13
  ENUM_13 = 13,

  # TODO: Write general description for ENUM_14
  ENUM_14 = 14,

  # TODO: Write general description for ENUM_15
  ENUM_15 = 15
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_0) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_state.rb', line 49

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

  str = value.to_s.strip
  if str.match?(/\A\d+\z/)
    num = str.to_i
    return num if TRANSACTION_STATE.include?(num)

    return default_value
  end

  case str.downcase
  when 'enum_0' then ENUM_0
  when 'enum_1' then ENUM_1
  when 'enum_10' then ENUM_10
  when 'enum_11' then ENUM_11
  when 'enum_12' then ENUM_12
  when 'enum_13' then ENUM_13
  when 'enum_14' then ENUM_14
  when 'enum_15' then ENUM_15
  else
    default_value
  end
end

.validate(value) ⇒ Object



43
44
45
46
47
# File 'lib/logalty_certificate_issuance_api_certy/models/transaction_state.rb', line 43

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

  TRANSACTION_STATE.include?(value)
end