class Mindee::Product::Passport::PassportV1Document
Passport API version 1.1 document data.
def initialize(prediction, page_id)
-
page_id
(Integer, nil
) -- -
prediction
(Hash
) --
def initialize(prediction, page_id) super() @birth_date = DateField.new(prediction['birth_date'], page_id) @birth_place = StringField.new(prediction['birth_place'], page_id) @country = StringField.new(prediction['country'], page_id) @expiry_date = DateField.new(prediction['expiry_date'], page_id) @gender = StringField.new(prediction['gender'], page_id) @given_names = [] prediction['given_names'].each do |item| @given_names.push(StringField.new(item, page_id)) end @id_number = StringField.new(prediction['id_number'], page_id) @issuance_date = DateField.new(prediction['issuance_date'], page_id) @mrz1 = StringField.new(prediction['mrz1'], page_id) @mrz2 = StringField.new(prediction['mrz2'], page_id) @surname = StringField.new(prediction['surname'], page_id) end
def to_s
-
(String)
-
def to_s given_names = @given_names.join("\n #{' ' * 15}") out_str = String.new out_str << "\n:Country Code: #{@country}".rstrip out_str << "\n:ID Number: #{@id_number}".rstrip out_str << "\n:Given Name(s): #{given_names}".rstrip out_str << "\n:Surname: #{@surname}".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:Date of Issue: #{@issuance_date}".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[1..].to_s end