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

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/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)


53
54
55
56
57
58
59
60
61
62
63
64
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
91
92
93
94
95
96
97
98
# File 'lib/mindee/product/driver_license/driver_license_v1_document.rb', line 53

def initialize(prediction, page_id)
  super
  @category = Parsing::Standard::StringField.new(
    prediction['category'],
    page_id
  )
  @country_code = Parsing::Standard::StringField.new(
    prediction['country_code'],
    page_id
  )
  @date_of_birth = Parsing::Standard::DateField.new(
    prediction['date_of_birth'],
    page_id
  )
  @dd_number = Parsing::Standard::StringField.new(
    prediction['dd_number'],
    page_id
  )
  @expiry_date = Parsing::Standard::DateField.new(
    prediction['expiry_date'],
    page_id
  )
  @first_name = Parsing::Standard::StringField.new(
    prediction['first_name'],
    page_id
  )
  @id = Parsing::Standard::StringField.new(prediction['id'], page_id)
  @issued_date = Parsing::Standard::DateField.new(
    prediction['issued_date'],
    page_id
  )
  @issuing_authority = Parsing::Standard::StringField.new(
    prediction['issuing_authority'],
    page_id
  )
  @last_name = Parsing::Standard::StringField.new(
    prediction['last_name'],
    page_id
  )
  @mrz = Parsing::Standard::StringField.new(prediction['mrz'], page_id)
  @place_of_birth = Parsing::Standard::StringField.new(
    prediction['place_of_birth'],
    page_id
  )
  @state = Parsing::Standard::StringField.new(prediction['state'], page_id)
end

Instance Attribute Details

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

The category or class of the driver license.



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

def category
  @category
end

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

The alpha-3 ISO 3166 code of the country where the driver license was issued.



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

def country_code
  @country_code
end

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

The date of birth of the driver license holder.



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

def date_of_birth
  @date_of_birth
end

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

The DD number of the driver license.



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

def dd_number
  @dd_number
end

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

The expiry date of the driver license.



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

def expiry_date
  @expiry_date
end

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

The first name of the driver license holder.



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

def first_name
  @first_name
end

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

The unique identifier of the driver license.



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

def id
  @id
end

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

The date when the driver license was issued.



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

def issued_date
  @issued_date
end

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

The authority that issued the driver license.



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

def issuing_authority
  @issuing_authority
end

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

The last name of the driver license holder.



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

def last_name
  @last_name
end

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

The Machine Readable Zone (MRZ) of the driver license.



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

def mrz
  @mrz
end

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

The place of birth of the driver license holder.



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

def place_of_birth
  @place_of_birth
end

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

Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.



49
50
51
# File 'lib/mindee/product/driver_license/driver_license_v1_document.rb', line 49

def state
  @state
end

Instance Method Details

#to_sString

Returns:

  • (String)


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/mindee/product/driver_license/driver_license_v1_document.rb', line 101

def to_s
  out_str = String.new
  out_str << "\n:Country Code: #{@country_code}".rstrip
  out_str << "\n:State: #{@state}".rstrip
  out_str << "\n:ID: #{@id}".rstrip
  out_str << "\n: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:Issued Date: #{@issued_date}".rstrip
  out_str << "\n:Issuing Authority: #{@issuing_authority}".rstrip
  out_str << "\n:MRZ: #{@mrz}".rstrip
  out_str << "\n:DD Number: #{@dd_number}".rstrip
  out_str[1..].to_s
end