Class: Mindee::Product::US::BankCheck::BankCheckV1Document

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

Overview

Bank Check API version 1.1 document data.

Direct Known Subclasses

BankCheckV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ BankCheckV1Document

Returns a new instance of BankCheckV1Document.

Parameters:

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


33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 33

def initialize(prediction, page_id)
  super()
  @account_number = StringField.new(prediction['account_number'], page_id)
  @amount = AmountField.new(prediction['amount'], page_id)
  @check_number = StringField.new(prediction['check_number'], page_id)
  @date = DateField.new(prediction['date'], page_id)
  @payees = []
  prediction['payees'].each do |item|
    @payees.push(StringField.new(item, page_id))
  end
  @routing_number = StringField.new(prediction['routing_number'], page_id)
end

Instance Attribute Details

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

The check payer's account number.



14
15
16
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 14

def 
  @account_number
end

#amountMindee::Parsing::Standard::AmountField (readonly)

The amount of the check.



17
18
19
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 17

def amount
  @amount
end

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

The issuer's check number.



20
21
22
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 20

def check_number
  @check_number
end

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

The date the check was issued.



23
24
25
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 23

def date
  @date
end

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

List of the check's payees (recipients).



26
27
28
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 26

def payees
  @payees
end

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

The check issuer's routing number.



29
30
31
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 29

def routing_number
  @routing_number
end

Instance Method Details

#to_sString

Returns:

  • (String)


47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mindee/product/us/bank_check/bank_check_v1_document.rb', line 47

def to_s
  payees = @payees.join("\n #{' ' * 8}")
  out_str = String.new
  out_str << "\n:Check Issue Date: #{@date}".rstrip
  out_str << "\n:Amount: #{@amount}".rstrip
  out_str << "\n:Payees: #{payees}".rstrip
  out_str << "\n:Routing Number: #{@routing_number}".rstrip
  out_str << "\n:Account Number: #{@account_number}".rstrip
  out_str << "\n:Check Number: #{@check_number}".rstrip
  out_str[1..].to_s
end