Class: Mindee::Product::FR::CarteVitale::CarteVitaleV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb

Overview

Carte Vitale API version 1.1 document data.

Direct Known Subclasses

CarteVitaleV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ CarteVitaleV1Document

Returns a new instance of CarteVitaleV1Document.

Parameters:

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


27
28
29
30
31
32
33
34
35
36
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 27

def initialize(prediction, page_id)
  super()
  @given_names = []
  prediction['given_names'].each do |item|
    @given_names.push(StringField.new(item, page_id))
  end
  @issuance_date = DateField.new(prediction['issuance_date'], page_id)
  @social_security = StringField.new(prediction['social_security'], page_id)
  @surname = StringField.new(prediction['surname'], page_id)
end

Instance Attribute Details

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

The given name(s) of the card holder.



14
15
16
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 14

def given_names
  @given_names
end

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

The date the card was issued.



17
18
19
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 17

def issuance_date
  @issuance_date
end

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

The Social Security Number (Numéro de Sécurité Sociale) of the card holder



20
21
22
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 20

def social_security
  @social_security
end

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

The surname of the card holder.



23
24
25
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 23

def surname
  @surname
end

Instance Method Details

#to_sString

Returns:

  • (String)


39
40
41
42
43
44
45
46
47
# File 'lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb', line 39

def to_s
  given_names = @given_names.join("\n #{' ' * 15}")
  out_str = String.new
  out_str << "\n:Given Name(s): #{given_names}".rstrip
  out_str << "\n:Surname: #{@surname}".rstrip
  out_str << "\n:Social Security Number: #{@social_security}".rstrip
  out_str << "\n:Issuance Date: #{@issuance_date}".rstrip
  out_str[1..].to_s
end