Class: Mindee::V1::Product::FR::IdCard::IdCardV2Document

Inherits:
Mindee::V1::Parsing::Common::Prediction show all
Includes:
Mindee::V1::Parsing::Standard
Defined in:
lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb,
sig/mindee/v1/product/fr/id_card/id_card_v2_document.rbs

Overview

Carte Nationale d'Identité API version 2.0 document data.

Direct Known Subclasses

IdCardV2PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ IdCardV2Document

Returns a new instance of IdCardV2Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)
  • (Hash[String | Symbol, untyped])
  • (Integer, nil)


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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 62

def initialize(prediction, page_id)
  super
  @alternate_name = Parsing::Standard::StringField.new(
    prediction['alternate_name'],
    page_id
  )
  @authority = Parsing::Standard::StringField.new(
    prediction['authority'],
    page_id
  )
  @birth_date = Parsing::Standard::DateField.new(
    prediction['birth_date'],
    page_id
  )
  @birth_place = Parsing::Standard::StringField.new(
    prediction['birth_place'],
    page_id
  )
  @card_access_number = Parsing::Standard::StringField.new(
    prediction['card_access_number'],
    page_id
  )
  @document_number = Parsing::Standard::StringField.new(
    prediction['document_number'],
    page_id
  )
  @expiry_date = Parsing::Standard::DateField.new(
    prediction['expiry_date'],
    page_id
  )
  @gender = Parsing::Standard::StringField.new(
    prediction['gender'],
    page_id
  )
  @given_names = [] # : Array[Parsing::Standard::StringField]
  prediction['given_names'].each do |item|
    @given_names.push(Parsing::Standard::StringField.new(item, page_id))
  end
  @issue_date = Parsing::Standard::DateField.new(
    prediction['issue_date'],
    page_id
  )
  @mrz1 = Parsing::Standard::StringField.new(prediction['mrz1'], page_id)
  @mrz2 = Parsing::Standard::StringField.new(prediction['mrz2'], page_id)
  @mrz3 = Parsing::Standard::StringField.new(prediction['mrz3'], page_id)
  @nationality = Parsing::Standard::StringField.new(
    prediction['nationality'],
    page_id
  )
  @surname = Parsing::Standard::StringField.new(
    prediction['surname'],
    page_id
  )
end

Instance Attribute Details

#alternate_nameMindee::V1::Parsing::Standard::StringField (readonly)

The alternate name of the card holder.



16
17
18
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 16

def alternate_name
  @alternate_name
end

#authorityMindee::V1::Parsing::Standard::StringField (readonly)

The name of the issuing authority.



19
20
21
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 19

def authority
  @authority
end

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

The date of birth of the card holder.



22
23
24
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 22

def birth_date
  @birth_date
end

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

The place of birth of the card holder.



25
26
27
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 25

def birth_place
  @birth_place
end

#card_access_numberMindee::V1::Parsing::Standard::StringField (readonly)

The card access number (CAN).



28
29
30
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 28

def card_access_number
  @card_access_number
end

#document_numberMindee::V1::Parsing::Standard::StringField (readonly)

The document number.



31
32
33
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 31

def document_number
  @document_number
end

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

The expiry date of the identification card.



34
35
36
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 34

def expiry_date
  @expiry_date
end

#genderMindee::V1::Parsing::Standard::StringField (readonly)

The gender of the card holder.



37
38
39
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 37

def gender
  @gender
end

#given_namesArray<Mindee::V1::Parsing::Standard::StringField> (readonly)

The given name(s) of the card holder.



40
41
42
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 40

def given_names
  @given_names
end

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

The date of issue of the identification card.



43
44
45
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 43

def issue_date
  @issue_date
end

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

The Machine Readable Zone, first line.



46
47
48
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 46

def mrz1
  @mrz1
end

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

The Machine Readable Zone, second line.



49
50
51
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 49

def mrz2
  @mrz2
end

#mrz3Mindee::V1::Parsing::Standard::StringField (readonly)

The Machine Readable Zone, third line.



52
53
54
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 52

def mrz3
  @mrz3
end

#nationalityMindee::V1::Parsing::Standard::StringField (readonly)

The nationality of the card holder.



55
56
57
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 55

def nationality
  @nationality
end

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

The surname of the card holder.



58
59
60
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 58

def surname
  @surname
end

Instance Method Details

#to_sString

Returns:

  • (String)


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb', line 118

def to_s
  given_names = @given_names.join("\n #{' ' * 15}")
  out_str = String.new
  out_str << "\n:Nationality: #{@nationality}".rstrip
  out_str << "\n:Card Access Number: #{@card_access_number}".rstrip
  out_str << "\n:Document Number: #{@document_number}".rstrip
  out_str << "\n:Given Name(s): #{given_names}".rstrip
  out_str << "\n:Surname: #{@surname}".rstrip
  out_str << "\n:Alternate Name: #{@alternate_name}".rstrip
  out_str << "\n:Date of Birth: #{@birth_date}".rstrip
  out_str << "\n:Place of Birth: #{@birth_place}".rstrip
  out_str << "\n:Gender: #{@gender}".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:Mrz Line 3: #{@mrz3}".rstrip
  out_str << "\n:Date of Issue: #{@issue_date}".rstrip
  out_str << "\n:Issuing Authority: #{@authority}".rstrip
  out_str[1..].to_s
end