Class: Mindee::Product::EU::DriverLicense::DriverLicenseV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/eu/driver_license/driver_license_v1_document.rb

Overview

Driver License API version 1.0 document data.

Direct Known Subclasses

DriverLicenseV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ DriverLicenseV1Document

Returns a new instance of DriverLicenseV1Document.

Parameters:

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


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 51

def initialize(prediction, page_id)
  super()
  @address = StringField.new(prediction['address'], page_id)
  @category = StringField.new(prediction['category'], page_id)
  @country_code = StringField.new(prediction['country_code'], page_id)
  @date_of_birth = DateField.new(prediction['date_of_birth'], page_id)
  @document_id = StringField.new(prediction['document_id'], page_id)
  @expiry_date = DateField.new(prediction['expiry_date'], page_id)
  @first_name = StringField.new(prediction['first_name'], page_id)
  @issue_authority = StringField.new(prediction['issue_authority'], page_id)
  @issue_date = DateField.new(prediction['issue_date'], page_id)
  @last_name = StringField.new(prediction['last_name'], page_id)
  @mrz = StringField.new(prediction['mrz'], page_id)
  @place_of_birth = StringField.new(prediction['place_of_birth'], page_id)
end

Instance Attribute Details

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

EU driver license holders address



14
15
16
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 14

def address
  @address
end

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

EU driver license holders categories



17
18
19
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 17

def category
  @category
end

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

Country code extracted as a string.



20
21
22
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 20

def country_code
  @country_code
end

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

The date of birth of the document holder



23
24
25
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 23

def date_of_birth
  @date_of_birth
end

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

ID number of the Document.



26
27
28
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 26

def document_id
  @document_id
end

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

Date the document expires



29
30
31
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 29

def expiry_date
  @expiry_date
end

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

First name(s) of the driver license holder



32
33
34
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 32

def first_name
  @first_name
end

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

Authority that issued the document



35
36
37
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 35

def issue_authority
  @issue_authority
end

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

Date the document was issued



38
39
40
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 38

def issue_date
  @issue_date
end

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

Last name of the driver license holder.



41
42
43
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 41

def last_name
  @last_name
end

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

Machine-readable license number



44
45
46
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 44

def mrz
  @mrz
end

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

Place where the driver license holder was born



47
48
49
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 47

def place_of_birth
  @place_of_birth
end

Instance Method Details

#to_sString

Returns:

  • (String)


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mindee/product/eu/driver_license/driver_license_v1_document.rb', line 68

def to_s
  out_str = String.new
  out_str << "\n:Country Code: #{@country_code}".rstrip
  out_str << "\n:Document ID: #{@document_id}".rstrip
  out_str << "\n:Driver License Category: #{@category}".rstrip
  out_str << "\n:Last Name: #{@last_name}".rstrip
  out_str << "\n:First Name: #{@first_name}".rstrip
  out_str << "\n:Date Of Birth: #{@date_of_birth}".rstrip
  out_str << "\n:Place Of Birth: #{@place_of_birth}".rstrip
  out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
  out_str << "\n:Issue Date: #{@issue_date}".rstrip
  out_str << "\n:Issue Authority: #{@issue_authority}".rstrip
  out_str << "\n:MRZ: #{@mrz}".rstrip
  out_str << "\n:Address: #{@address}".rstrip
  out_str[1..].to_s
end