Class: Mindee::V1::Product::InternationalId::InternationalIdV2Document
- Inherits:
-
Mindee::V1::Parsing::Common::Prediction
- Object
- Mindee::V1::Parsing::Common::Prediction
- Mindee::V1::Product::InternationalId::InternationalIdV2Document
- Includes:
- Mindee::V1::Parsing::Standard
- Defined in:
- lib/mindee/v1/product/international_id/international_id_v2_document.rb
Overview
International ID API version 2.2 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The physical address of the document holder.
-
#birth_date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date of birth of the document holder.
-
#birth_place ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The place of birth of the document holder.
-
#country_of_issue ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The country where the document was issued.
-
#document_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The unique identifier assigned to the document.
-
#document_type ⇒ Mindee::V1::Parsing::Standard::ClassificationField
readonly
The type of personal identification document.
-
#expiry_date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date when the document becomes invalid.
-
#given_names ⇒ Array<Mindee::V1::Parsing::Standard::StringField>
readonly
The list of the document holder's given names.
-
#issue_date ⇒ Mindee::V1::Parsing::Standard::DateField
readonly
The date when the document was issued.
-
#mrz_line1 ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The Machine Readable Zone, first line.
-
#mrz_line2 ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The Machine Readable Zone, second line.
-
#mrz_line3 ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The Machine Readable Zone, third line.
-
#nationality ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The country of citizenship of the document holder.
-
#personal_number ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The unique identifier assigned to the document holder.
-
#sex ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The biological sex of the document holder.
-
#state_of_issue ⇒ Mindee::V1::Parsing::Standard::StringField
readonly
The state or territory where the document was issued.
-
#surnames ⇒ Array<Mindee::V1::Parsing::Standard::StringField>
readonly
The list of the document holder's family names.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ InternationalIdV2Document
constructor
A new instance of InternationalIdV2Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ InternationalIdV2Document
Returns a new instance of InternationalIdV2Document.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 67 def initialize(prediction, page_id) super @address = Parsing::Standard::StringField.new( prediction['address'], page_id ) @birth_date = Parsing::Standard::DateField.new( prediction['birth_date'], page_id ) @birth_place = Parsing::Standard::StringField.new( prediction['birth_place'], page_id ) @country_of_issue = Parsing::Standard::StringField.new( prediction['country_of_issue'], page_id ) @document_number = Parsing::Standard::StringField.new( prediction['document_number'], page_id ) @document_type = Parsing::Standard::ClassificationField.new( prediction['document_type'], page_id ) @expiry_date = Parsing::Standard::DateField.new( prediction['expiry_date'], page_id ) @given_names = [] # : Array[Parsing::Standard::StringField] prediction['given_names'].each do |item| @given_names.push(Parsing::Standard::StringField.new(item, page_id)) end @issue_date = Parsing::Standard::DateField.new( prediction['issue_date'], page_id ) @mrz_line1 = Parsing::Standard::StringField.new( prediction['mrz_line1'], page_id ) @mrz_line2 = Parsing::Standard::StringField.new( prediction['mrz_line2'], page_id ) @mrz_line3 = Parsing::Standard::StringField.new( prediction['mrz_line3'], page_id ) @nationality = Parsing::Standard::StringField.new( prediction['nationality'], page_id ) @personal_number = Parsing::Standard::StringField.new( prediction['personal_number'], page_id ) @sex = Parsing::Standard::StringField.new(prediction['sex'], page_id) @state_of_issue = Parsing::Standard::StringField.new( prediction['state_of_issue'], page_id ) @surnames = [] # : Array[Parsing::Standard::StringField] prediction['surnames'].each do |item| @surnames.push(Parsing::Standard::StringField.new(item, page_id)) end end |
Instance Attribute Details
#address ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The physical address of the document holder.
15 16 17 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 15 def address @address end |
#birth_date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date of birth of the document holder.
18 19 20 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 18 def birth_date @birth_date end |
#birth_place ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The place of birth of the document holder.
21 22 23 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 21 def birth_place @birth_place end |
#country_of_issue ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The country where the document was issued.
24 25 26 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 24 def country_of_issue @country_of_issue end |
#document_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The unique identifier assigned to the document.
27 28 29 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 27 def document_number @document_number end |
#document_type ⇒ Mindee::V1::Parsing::Standard::ClassificationField (readonly)
The type of personal identification document.
30 31 32 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 30 def document_type @document_type end |
#expiry_date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date when the document becomes invalid.
33 34 35 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 33 def expiry_date @expiry_date end |
#given_names ⇒ Array<Mindee::V1::Parsing::Standard::StringField> (readonly)
The list of the document holder's given names.
36 37 38 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 36 def given_names @given_names end |
#issue_date ⇒ Mindee::V1::Parsing::Standard::DateField (readonly)
The date when the document was issued.
39 40 41 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 39 def issue_date @issue_date end |
#mrz_line1 ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, first line.
42 43 44 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 42 def mrz_line1 @mrz_line1 end |
#mrz_line2 ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, second line.
45 46 47 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 45 def mrz_line2 @mrz_line2 end |
#mrz_line3 ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, third line.
48 49 50 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 48 def mrz_line3 @mrz_line3 end |
#nationality ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The country of citizenship of the document holder.
51 52 53 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 51 def nationality @nationality end |
#personal_number ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The unique identifier assigned to the document holder.
54 55 56 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 54 def personal_number @personal_number end |
#sex ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The biological sex of the document holder.
57 58 59 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 57 def sex @sex end |
#state_of_issue ⇒ Mindee::V1::Parsing::Standard::StringField (readonly)
The state or territory where the document was issued.
60 61 62 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 60 def state_of_issue @state_of_issue end |
#surnames ⇒ Array<Mindee::V1::Parsing::Standard::StringField> (readonly)
The list of the document holder's family names.
63 64 65 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 63 def surnames @surnames end |
Instance Method Details
#to_s ⇒ String
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/mindee/v1/product/international_id/international_id_v2_document.rb', line 137 def to_s surnames = @surnames.join("\n #{' ' * 10}") given_names = @given_names.join("\n #{' ' * 13}") out_str = String.new out_str << "\n:Document Type: #{@document_type}".rstrip out_str << "\n:Document Number: #{@document_number}".rstrip out_str << "\n:Surnames: #{surnames}".rstrip out_str << "\n:Given Names: #{given_names}".rstrip out_str << "\n:Sex: #{@sex}".rstrip out_str << "\n:Birth Date: #{@birth_date}".rstrip out_str << "\n:Birth Place: #{@birth_place}".rstrip out_str << "\n:Nationality: #{@nationality}".rstrip out_str << "\n:Personal Number: #{@personal_number}".rstrip out_str << "\n:Country of Issue: #{@country_of_issue}".rstrip out_str << "\n:State of Issue: #{@state_of_issue}".rstrip out_str << "\n:Issue Date: #{@issue_date}".rstrip out_str << "\n:Expiration Date: #{@expiry_date}".rstrip out_str << "\n:Address: #{@address}".rstrip out_str << "\n:MRZ Line 1: #{@mrz_line1}".rstrip out_str << "\n:MRZ Line 2: #{@mrz_line2}".rstrip out_str << "\n:MRZ Line 3: #{@mrz_line3}".rstrip out_str[1..].to_s end |