Class: LogaltyCertificateIssuanceApiCerty::Image

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

Overview

Image Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(type: SKIP, content_type: SKIP, content: SKIP, hash: SKIP, additional_properties: nil) ⇒ Image

Returns a new instance of Image.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 62

def initialize(type: SKIP, content_type: SKIP, content: SKIP, hash: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @content_type = content_type unless content_type == SKIP
  @content = content unless content == SKIP
  @hash = hash unless hash == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#contentString

Image content encoded in Base64.

Returns:

  • (String)


31
32
33
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 31

def content
  @content
end

#content_typeString

MIME type of the image (e.g. ‘image/jpg`, `image/png`).

Returns:

  • (String)


27
28
29
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 27

def content_type
  @content_type
end

#hashString

Hash of the image content.

Returns:

  • (String)


35
36
37
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 35

def hash
  @hash
end

#typeImageType

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.

Returns:



23
24
25
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 23

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  content_type = hash.key?('contentType') ? hash['contentType'] : SKIP
  content = hash.key?('content') ? hash['content'] : SKIP
  hash = hash.key?('hash') ? hash['hash'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Image.new(type: type,
            content_type: content_type,
            content: content,
            hash: hash,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['content_type'] = 'contentType'
  @_hash['content'] = 'content'
  @_hash['hash'] = 'hash'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 48

def self.optionals
  %w[
    type
    content_type
    content
    hash
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, content_type: #{@content_type.inspect}, content:"\
  " #{@content.inspect}, hash: #{@hash.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 100

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, content_type: #{@content_type}, content: #{@content}, hash:"\
  " #{@hash}, additional_properties: #{@additional_properties}>"
end