Class: Mindee::Product::IND::IndianPassport::IndianPassportV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb

Overview

Passport - India API version 1.2 document data.

Direct Known Subclasses

IndianPassportV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ IndianPassportV1Document

Returns a new instance of IndianPassportV1Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 84

def initialize(prediction, page_id)
  super
  @address1 = Parsing::Standard::StringField.new(
    prediction['address1'],
    page_id
  )
  @address2 = Parsing::Standard::StringField.new(
    prediction['address2'],
    page_id
  )
  @address3 = Parsing::Standard::StringField.new(
    prediction['address3'],
    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 = Parsing::Standard::StringField.new(
    prediction['country'],
    page_id
  )
  @expiry_date = Parsing::Standard::DateField.new(
    prediction['expiry_date'],
    page_id
  )
  @file_number = Parsing::Standard::StringField.new(
    prediction['file_number'],
    page_id
  )
  @gender = Parsing::Standard::ClassificationField.new(
    prediction['gender'],
    page_id
  )
  @given_names = Parsing::Standard::StringField.new(
    prediction['given_names'],
    page_id
  )
  @id_number = Parsing::Standard::StringField.new(
    prediction['id_number'],
    page_id
  )
  @issuance_date = Parsing::Standard::DateField.new(
    prediction['issuance_date'],
    page_id
  )
  @issuance_place = Parsing::Standard::StringField.new(
    prediction['issuance_place'],
    page_id
  )
  @legal_guardian = Parsing::Standard::StringField.new(
    prediction['legal_guardian'],
    page_id
  )
  @mrz1 = Parsing::Standard::StringField.new(prediction['mrz1'], page_id)
  @mrz2 = Parsing::Standard::StringField.new(prediction['mrz2'], page_id)
  @name_of_mother = Parsing::Standard::StringField.new(
    prediction['name_of_mother'],
    page_id
  )
  @name_of_spouse = Parsing::Standard::StringField.new(
    prediction['name_of_spouse'],
    page_id
  )
  @old_passport_date_of_issue = Parsing::Standard::DateField.new(
    prediction['old_passport_date_of_issue'],
    page_id
  )
  @old_passport_number = Parsing::Standard::StringField.new(
    prediction['old_passport_number'],
    page_id
  )
  @old_passport_place_of_issue = Parsing::Standard::StringField.new(
    prediction['old_passport_place_of_issue'],
    page_id
  )
  @page_number = Parsing::Standard::ClassificationField.new(
    prediction['page_number'],
    page_id
  )
  @surname = Parsing::Standard::StringField.new(
    prediction['surname'],
    page_id
  )
end

Instance Attribute Details

#address1Mindee::Parsing::Standard::StringField (readonly)

The first line of the address of the passport holder.



14
15
16
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 14

def address1
  @address1
end

#address2Mindee::Parsing::Standard::StringField (readonly)

The second line of the address of the passport holder.



17
18
19
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 17

def address2
  @address2
end

#address3Mindee::Parsing::Standard::StringField (readonly)

The third line of the address of the passport holder.



20
21
22
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 20

def address3
  @address3
end

#birth_dateMindee::Parsing::Standard::DateField (readonly)

The birth date of the passport holder, ISO format: YYYY-MM-DD.



23
24
25
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 23

def birth_date
  @birth_date
end

#birth_placeMindee::Parsing::Standard::StringField (readonly)

The birth place of the passport holder.



26
27
28
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 26

def birth_place
  @birth_place
end

#countryMindee::Parsing::Standard::StringField (readonly)

ISO 3166-1 alpha-3 country code (3 letters format).



29
30
31
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 29

def country
  @country
end

#expiry_dateMindee::Parsing::Standard::DateField (readonly)

The date when the passport will expire, ISO format: YYYY-MM-DD.



32
33
34
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 32

def expiry_date
  @expiry_date
end

#file_numberMindee::Parsing::Standard::StringField (readonly)

The file number of the passport document.



35
36
37
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 35

def file_number
  @file_number
end

#genderMindee::Parsing::Standard::ClassificationField (readonly)

The gender of the passport holder.



38
39
40
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 38

def gender
  @gender
end

#given_namesMindee::Parsing::Standard::StringField (readonly)

The given names of the passport holder.



41
42
43
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 41

def given_names
  @given_names
end

#id_numberMindee::Parsing::Standard::StringField (readonly)

The identification number of the passport document.



44
45
46
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 44

def id_number
  @id_number
end

#issuance_dateMindee::Parsing::Standard::DateField (readonly)

The date when the passport was issued, ISO format: YYYY-MM-DD.



47
48
49
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 47

def issuance_date
  @issuance_date
end

#issuance_placeMindee::Parsing::Standard::StringField (readonly)

The place where the passport was issued.



50
51
52
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 50

def issuance_place
  @issuance_place
end

The name of the legal guardian of the passport holder (if applicable).



53
54
55
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 53

def legal_guardian
  @legal_guardian
end

#mrz1Mindee::Parsing::Standard::StringField (readonly)

The first line of the machine-readable zone (MRZ) of the passport document.



56
57
58
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 56

def mrz1
  @mrz1
end

#mrz2Mindee::Parsing::Standard::StringField (readonly)

The second line of the machine-readable zone (MRZ) of the passport document.



59
60
61
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 59

def mrz2
  @mrz2
end

#name_of_motherMindee::Parsing::Standard::StringField (readonly)

The name of the mother of the passport holder.



62
63
64
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 62

def name_of_mother
  @name_of_mother
end

#name_of_spouseMindee::Parsing::Standard::StringField (readonly)

The name of the spouse of the passport holder (if applicable).



65
66
67
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 65

def name_of_spouse
  @name_of_spouse
end

#old_passport_date_of_issueMindee::Parsing::Standard::DateField (readonly)

The date of issue of the old passport (if applicable), ISO format: YYYY-MM-DD.



68
69
70
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 68

def old_passport_date_of_issue
  @old_passport_date_of_issue
end

#old_passport_numberMindee::Parsing::Standard::StringField (readonly)

The number of the old passport (if applicable).



71
72
73
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 71

def old_passport_number
  @old_passport_number
end

#old_passport_place_of_issueMindee::Parsing::Standard::StringField (readonly)

The place of issue of the old passport (if applicable).



74
75
76
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 74

def old_passport_place_of_issue
  @old_passport_place_of_issue
end

#page_numberMindee::Parsing::Standard::ClassificationField (readonly)

The page number of the passport document.



77
78
79
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 77

def page_number
  @page_number
end

#surnameMindee::Parsing::Standard::StringField (readonly)

The surname of the passport holder.



80
81
82
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 80

def surname
  @surname
end

Instance Method Details

#to_sString

Returns:

  • (String)


175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb', line 175

def to_s
  out_str = String.new
  out_str << "\n:Page Number: #{@page_number}".rstrip
  out_str << "\n:Country: #{@country}".rstrip
  out_str << "\n:ID Number: #{@id_number}".rstrip
  out_str << "\n:Given Names: #{@given_names}".rstrip
  out_str << "\n:Surname: #{@surname}".rstrip
  out_str << "\n:Birth Date: #{@birth_date}".rstrip
  out_str << "\n:Birth Place: #{@birth_place}".rstrip
  out_str << "\n:Issuance Place: #{@issuance_place}".rstrip
  out_str << "\n:Gender: #{@gender}".rstrip
  out_str << "\n:Issuance Date: #{@issuance_date}".rstrip
  out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
  out_str << "\n:MRZ Line 1: #{@mrz1}".rstrip
  out_str << "\n:MRZ Line 2: #{@mrz2}".rstrip
  out_str << "\n:Legal Guardian: #{@legal_guardian}".rstrip
  out_str << "\n:Name of Spouse: #{@name_of_spouse}".rstrip
  out_str << "\n:Name of Mother: #{@name_of_mother}".rstrip
  out_str << "\n:Old Passport Date of Issue: #{@old_passport_date_of_issue}".rstrip
  out_str << "\n:Old Passport Number: #{@old_passport_number}".rstrip
  out_str << "\n:Address Line 1: #{@address1}".rstrip
  out_str << "\n:Address Line 2: #{@address2}".rstrip
  out_str << "\n:Address Line 3: #{@address3}".rstrip
  out_str << "\n:Old Passport Place of Issue: #{@old_passport_place_of_issue}".rstrip
  out_str << "\n:File Number: #{@file_number}".rstrip
  out_str[1..].to_s
end