Class: Mindee::Product::InternationalId::InternationalIdV2Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::InternationalId::InternationalIdV2Document
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/international_id/international_id_v2_document.rb
Overview
International ID API version 2.1 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Mindee::Parsing::Standard::StringField
readonly
The physical address of the document holder.
-
#birth_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date of birth of the document holder.
-
#birth_place ⇒ Mindee::Parsing::Standard::StringField
readonly
The place of birth of the document holder.
-
#country_of_issue ⇒ Mindee::Parsing::Standard::StringField
readonly
The country where the document was issued.
-
#document_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The unique identifier assigned to the document.
-
#document_type ⇒ Mindee::Parsing::Standard::ClassificationField
readonly
The type of personal identification document.
-
#expiry_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the document becomes invalid.
-
#given_names ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
The list of the document holder’s given names.
-
#issue_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the document was issued.
-
#mrz_line1 ⇒ Mindee::Parsing::Standard::StringField
readonly
The Machine Readable Zone, first line.
-
#mrz_line2 ⇒ Mindee::Parsing::Standard::StringField
readonly
The Machine Readable Zone, second line.
-
#mrz_line3 ⇒ Mindee::Parsing::Standard::StringField
readonly
The Machine Readable Zone, third line.
-
#nationality ⇒ Mindee::Parsing::Standard::StringField
readonly
The country of citizenship of the document holder.
-
#personal_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The unique identifier assigned to the document holder.
-
#sex ⇒ Mindee::Parsing::Standard::StringField
readonly
The biological sex of the document holder.
-
#state_of_issue ⇒ Mindee::Parsing::Standard::StringField
readonly
The state or territory where the document was issued.
-
#surnames ⇒ Array<Mindee::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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 65 def initialize(prediction, page_id) super() @address = StringField.new(prediction['address'], page_id) @birth_date = DateField.new(prediction['birth_date'], page_id) @birth_place = StringField.new(prediction['birth_place'], page_id) @country_of_issue = StringField.new(prediction['country_of_issue'], page_id) @document_number = StringField.new(prediction['document_number'], page_id) @document_type = ClassificationField.new(prediction['document_type'], page_id) @expiry_date = DateField.new(prediction['expiry_date'], page_id) @given_names = [] prediction['given_names'].each do |item| @given_names.push(StringField.new(item, page_id)) end @issue_date = DateField.new(prediction['issue_date'], page_id) @mrz_line1 = StringField.new(prediction['mrz_line1'], page_id) @mrz_line2 = StringField.new(prediction['mrz_line2'], page_id) @mrz_line3 = StringField.new(prediction['mrz_line3'], page_id) @nationality = StringField.new(prediction['nationality'], page_id) @personal_number = StringField.new(prediction['personal_number'], page_id) @sex = StringField.new(prediction['sex'], page_id) @state_of_issue = StringField.new(prediction['state_of_issue'], page_id) @surnames = [] prediction['surnames'].each do |item| @surnames.push(StringField.new(item, page_id)) end end |
Instance Attribute Details
#address ⇒ Mindee::Parsing::Standard::StringField (readonly)
The physical address of the document holder.
13 14 15 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 13 def address @address end |
#birth_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date of birth of the document holder.
16 17 18 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 16 def birth_date @birth_date end |
#birth_place ⇒ Mindee::Parsing::Standard::StringField (readonly)
The place of birth of the document holder.
19 20 21 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 19 def birth_place @birth_place end |
#country_of_issue ⇒ Mindee::Parsing::Standard::StringField (readonly)
The country where the document was issued.
22 23 24 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 22 def country_of_issue @country_of_issue end |
#document_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The unique identifier assigned to the document.
25 26 27 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 25 def document_number @document_number end |
#document_type ⇒ Mindee::Parsing::Standard::ClassificationField (readonly)
The type of personal identification document.
28 29 30 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 28 def document_type @document_type end |
#expiry_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date when the document becomes invalid.
31 32 33 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 31 def expiry_date @expiry_date end |
#given_names ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The list of the document holder’s given names.
34 35 36 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 34 def given_names @given_names end |
#issue_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date when the document was issued.
37 38 39 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 37 def issue_date @issue_date end |
#mrz_line1 ⇒ Mindee::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, first line.
40 41 42 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 40 def mrz_line1 @mrz_line1 end |
#mrz_line2 ⇒ Mindee::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, second line.
43 44 45 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 43 def mrz_line2 @mrz_line2 end |
#mrz_line3 ⇒ Mindee::Parsing::Standard::StringField (readonly)
The Machine Readable Zone, third line.
46 47 48 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 46 def mrz_line3 @mrz_line3 end |
#nationality ⇒ Mindee::Parsing::Standard::StringField (readonly)
The country of citizenship of the document holder.
49 50 51 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 49 def nationality @nationality end |
#personal_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The unique identifier assigned to the document holder.
52 53 54 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 52 def personal_number @personal_number end |
#sex ⇒ Mindee::Parsing::Standard::StringField (readonly)
The biological sex of the document holder.
55 56 57 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 55 def sex @sex end |
#state_of_issue ⇒ Mindee::Parsing::Standard::StringField (readonly)
The state or territory where the document was issued.
58 59 60 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 58 def state_of_issue @state_of_issue end |
#surnames ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The list of the document holder’s family names.
61 62 63 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 61 def surnames @surnames end |
Instance Method Details
#to_s ⇒ String
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/mindee/product/international_id/international_id_v2_document.rb', line 93 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 |