Class: LogaltyCertificateIssuanceApiCerty::ImageType

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

Overview

Image type: - ‘DNI_NIE`: Front of the ID card. - `DNI_NIE_BACK`: Back of the ID card. - `PASSPORT`: Passport image. - `DRIVER_LICENSE`: Driver’s license image. - ‘SELFIE`: Selfie. - `SELFIE_LIFE`: Selfie with liveness proof. - `PHOTOCUT`: Cropped face image from the document. - `SIGNATURE`: Cropped handwritten signature from the document. - `FINGERPRINT`: Cropped fingerprint image from the document.

Constant Summary collapse

IMAGE_TYPE =
[
  # TODO: Write general description for DNI_NIE
  DNI_NIE = 'DNI_NIE'.freeze,

  # TODO: Write general description for DNI_NIE_BACK
  DNI_NIE_BACK = 'DNI_NIE_BACK'.freeze,

  # TODO: Write general description for PASSPORT
  PASSPORT = 'PASSPORT'.freeze,

  # TODO: Write general description for DRIVER_LICENSE
  DRIVER_LICENSE = 'DRIVER_LICENSE'.freeze,

  # TODO: Write general description for SELFIE
  SELFIE = 'SELFIE'.freeze,

  # TODO: Write general description for SELFIE_LIFE
  SELFIE_LIFE = 'SELFIE_LIFE'.freeze,

  # TODO: Write general description for PHOTOCUT
  PHOTOCUT = 'PHOTOCUT'.freeze,

  # TODO: Write general description for SIGNATURE
  SIGNATURE = 'SIGNATURE'.freeze,

  # TODO: Write general description for FINGERPRINT
  FINGERPRINT = 'FINGERPRINT'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DNI_NIE) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'dni_nie' then DNI_NIE
  when 'dni_nie_back' then DNI_NIE_BACK
  when 'passport' then PASSPORT
  when 'driver_license' then DRIVER_LICENSE
  when 'selfie' then SELFIE
  when 'selfie_life' then SELFIE_LIFE
  when 'photocut' then PHOTOCUT
  when 'signature' then SIGNATURE
  when 'fingerprint' then FINGERPRINT
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  IMAGE_TYPE.include?(value)
end