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

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

Overview

Driver License API version 1.1 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)


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

def initialize(prediction, page_id)
  super()
  @address = StringField.new(prediction['address'], page_id)
  @date_of_birth = DateField.new(prediction['date_of_birth'], page_id)
  @dd_number = StringField.new(prediction['dd_number'], page_id)
  @dl_class = StringField.new(prediction['dl_class'], page_id)
  @driver_license_id = StringField.new(prediction['driver_license_id'], page_id)
  @endorsements = StringField.new(prediction['endorsements'], page_id)
  @expiry_date = DateField.new(prediction['expiry_date'], page_id)
  @eye_color = StringField.new(prediction['eye_color'], page_id)
  @first_name = StringField.new(prediction['first_name'], page_id)
  @hair_color = StringField.new(prediction['hair_color'], page_id)
  @height = StringField.new(prediction['height'], page_id)
  @issued_date = DateField.new(prediction['issued_date'], page_id)
  @last_name = StringField.new(prediction['last_name'], page_id)
  @restrictions = StringField.new(prediction['restrictions'], page_id)
  @sex = StringField.new(prediction['sex'], page_id)
  @state = StringField.new(prediction['state'], page_id)
  @weight = StringField.new(prediction['weight'], page_id)
end

Instance Attribute Details

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

US driver license holders address



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

def address
  @address
end

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

US driver license holders date of birth



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

def date_of_birth
  @date_of_birth
end

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

Document Discriminator Number of the US Driver License



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

def dd_number
  @dd_number
end

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

US driver license holders class



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

def dl_class
  @dl_class
end

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

ID number of the US Driver License.



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

def driver_license_id
  @driver_license_id
end

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

US driver license holders endorsements



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

def endorsements
  @endorsements
end

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

Date on which the documents expires.



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

def expiry_date
  @expiry_date
end

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

US driver license holders eye colour



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

def eye_color
  @eye_color
end

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

US driver license holders first name(s)



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

def first_name
  @first_name
end

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

US driver license holders hair colour



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

def hair_color
  @hair_color
end

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

US driver license holders hight



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

def height
  @height
end

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

Date on which the documents was issued.



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

def issued_date
  @issued_date
end

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

US driver license holders last name



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

def last_name
  @last_name
end

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

US driver license holders restrictions



53
54
55
# File 'lib/mindee/product/us/driver_license/driver_license_v1_document.rb', line 53

def restrictions
  @restrictions
end

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

US driver license holders gender



56
57
58
# File 'lib/mindee/product/us/driver_license/driver_license_v1_document.rb', line 56

def sex
  @sex
end

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

US State



59
60
61
# File 'lib/mindee/product/us/driver_license/driver_license_v1_document.rb', line 59

def state
  @state
end

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

US driver license holders weight



62
63
64
# File 'lib/mindee/product/us/driver_license/driver_license_v1_document.rb', line 62

def weight
  @weight
end

Instance Method Details

#to_sString

Returns:

  • (String)


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mindee/product/us/driver_license/driver_license_v1_document.rb', line 88

def to_s
  out_str = String.new
  out_str << "\n:State: #{@state}".rstrip
  out_str << "\n:Driver License ID: #{@driver_license_id}".rstrip
  out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
  out_str << "\n:Date Of Issue: #{@issued_date}".rstrip
  out_str << "\n:Last Name: #{@last_name}".rstrip
  out_str << "\n:First Name: #{@first_name}".rstrip
  out_str << "\n:Address: #{@address}".rstrip
  out_str << "\n:Date Of Birth: #{@date_of_birth}".rstrip
  out_str << "\n:Restrictions: #{@restrictions}".rstrip
  out_str << "\n:Endorsements: #{@endorsements}".rstrip
  out_str << "\n:Driver License Class: #{@dl_class}".rstrip
  out_str << "\n:Sex: #{@sex}".rstrip
  out_str << "\n:Height: #{@height}".rstrip
  out_str << "\n:Weight: #{@weight}".rstrip
  out_str << "\n:Hair Color: #{@hair_color}".rstrip
  out_str << "\n:Eye Color: #{@eye_color}".rstrip
  out_str << "\n:Document Discriminator: #{@dd_number}".rstrip
  out_str[1..].to_s
end