Class: LogaltyCertificateIssuanceApiCerty::Image
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- LogaltyCertificateIssuanceApiCerty::Image
- Defined in:
- lib/logalty_certificate_issuance_api_certy/models/image.rb
Overview
Image Model.
Instance Attribute Summary collapse
-
#content ⇒ String
Image content encoded in Base64.
-
#content_type ⇒ String
MIME type of the image (e.g. ‘image/jpg`, `image/png`).
-
#hash ⇒ String
Hash of the image content.
-
#type ⇒ ImageType
Image type: - ‘DNI_NIE`: Front of the ID card.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(type: SKIP, content_type: SKIP, content: SKIP, hash: SKIP, additional_properties: nil) ⇒ Image
constructor
A new instance of Image.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#content ⇒ String
Image content encoded in Base64.
31 32 33 |
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 31 def content @content end |
#content_type ⇒ String
MIME type of the image (e.g. ‘image/jpg`, `image/png`).
27 28 29 |
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 27 def content_type @content_type end |
#hash ⇒ String
Hash of the image content.
35 36 37 |
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 35 def hash @hash end |
#type ⇒ ImageType
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.
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/logalty_certificate_issuance_api_certy/models/image.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |