mindee 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +2 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +36 -0
- data/README.md +29 -16
- data/bin/mindee.rb +23 -26
- data/docs/code_samples/bank_account_details_v1.txt +10 -5
- data/docs/code_samples/bank_account_details_v2.txt +19 -0
- data/docs/code_samples/bank_check_v1.txt +10 -5
- data/docs/code_samples/carte_vitale_v1.txt +10 -5
- data/docs/code_samples/custom_v1.txt +19 -10
- data/docs/code_samples/default.txt +10 -2
- data/docs/code_samples/expense_receipts_v4.txt +10 -5
- data/docs/code_samples/expense_receipts_v5.txt +11 -6
- data/docs/code_samples/financial_document_v1.txt +10 -5
- data/docs/code_samples/idcard_fr_v1.txt +10 -5
- data/docs/code_samples/invoice_splitter_v1_async.txt +66 -0
- data/docs/code_samples/invoices_v4.txt +10 -5
- data/docs/code_samples/license_plates_v1.txt +10 -5
- data/docs/code_samples/passport_v1.txt +10 -5
- data/docs/code_samples/proof_of_address_v1.txt +10 -5
- data/docs/ruby-api-builder.md +30 -31
- data/docs/ruby-getting-started.md +64 -23
- data/docs/ruby-invoice-ocr.md +70 -59
- data/docs/ruby-passport-ocr.md +49 -40
- data/docs/ruby-receipt-ocr.md +45 -32
- data/lib/mindee/client.rb +150 -148
- data/lib/mindee/geometry/min_max.rb +23 -0
- data/lib/mindee/geometry/point.rb +35 -0
- data/lib/mindee/geometry/polygon.rb +23 -0
- data/lib/mindee/geometry/quadrilateral.rb +45 -0
- data/lib/mindee/geometry/utils.rb +81 -0
- data/lib/mindee/geometry.rb +5 -116
- data/lib/mindee/http/endpoint.rb +123 -16
- data/lib/mindee/http.rb +3 -0
- data/lib/mindee/input/sources.rb +87 -73
- data/lib/mindee/parsing/common/api_response.rb +109 -0
- data/lib/mindee/parsing/common/document.rb +48 -0
- data/lib/mindee/parsing/common/error.rb +24 -0
- data/lib/mindee/parsing/common/inference.rb +43 -0
- data/lib/mindee/parsing/common/ocr/mvision_v1.rb +34 -0
- data/lib/mindee/parsing/common/ocr/ocr.rb +169 -0
- data/lib/mindee/parsing/common/ocr.rb +3 -0
- data/lib/mindee/parsing/common/orientation.rb +26 -0
- data/lib/mindee/parsing/common/page.rb +40 -0
- data/lib/mindee/parsing/common/prediction.rb +15 -0
- data/lib/mindee/parsing/common/product.rb +19 -0
- data/lib/mindee/parsing/common.rb +10 -0
- data/lib/mindee/parsing/custom/classification_field.rb +28 -0
- data/lib/mindee/parsing/custom/list_field.rb +76 -0
- data/lib/mindee/parsing/custom.rb +4 -0
- data/lib/mindee/parsing/standard/amount_field.rb +26 -0
- data/lib/mindee/parsing/standard/base_field.rb +104 -0
- data/lib/mindee/parsing/standard/classification_field.rb +16 -0
- data/lib/mindee/parsing/standard/company_registration_field.rb +21 -0
- data/lib/mindee/parsing/standard/date_field.rb +34 -0
- data/lib/mindee/parsing/standard/locale_field.rb +50 -0
- data/lib/mindee/parsing/standard/payment_details_field.rb +42 -0
- data/lib/mindee/parsing/standard/position_field.rb +44 -0
- data/lib/mindee/parsing/standard/tax_field.rb +108 -0
- data/lib/mindee/parsing/standard/text_field.rb +16 -0
- data/lib/mindee/parsing/standard.rb +12 -0
- data/lib/mindee/parsing.rb +3 -2
- data/lib/mindee/{input → pdf}/pdf_processing.rb +4 -32
- data/lib/mindee/pdf/pdf_tools.rb +34 -0
- data/lib/mindee/pdf.rb +3 -0
- data/lib/mindee/product/.rubocop.yml +5 -0
- data/lib/mindee/product/custom/custom_v1.rb +35 -0
- data/lib/mindee/product/custom/custom_v1_document.rb +60 -0
- data/lib/mindee/product/custom/custom_v1_page.rb +32 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +38 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +37 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1_page.rb +34 -0
- data/lib/mindee/product/financial_document/financial_document_v1.rb +36 -0
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +188 -0
- data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +90 -0
- data/lib/mindee/product/financial_document/financial_document_v1_page.rb +32 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +38 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +43 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rb +34 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +38 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +71 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +58 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb +34 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +38 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +52 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb +34 -0
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +38 -0
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +82 -0
- data/lib/mindee/product/fr/id_card/id_card_v1_page.rb +48 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +37 -0
- data/lib/mindee/product/invoice/invoice_v4_document.rb +212 -0
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +66 -0
- data/lib/mindee/product/invoice/invoice_v4_page.rb +32 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +36 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +65 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_page.rb +32 -0
- data/lib/mindee/product/passport/passport_v1.rb +36 -0
- data/lib/mindee/{parsing/prediction/fr/id_card/id_card_v1.rb → product/passport/passport_v1_document.rb} +45 -45
- data/lib/mindee/product/passport/passport_v1_page.rb +32 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +36 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +83 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_page.rb +32 -0
- data/lib/mindee/product/receipt/receipt_v4.rb +36 -0
- data/lib/mindee/product/receipt/receipt_v4_document.rb +86 -0
- data/lib/mindee/product/receipt/receipt_v4_page.rb +32 -0
- data/lib/mindee/product/receipt/receipt_v5.rb +36 -0
- data/lib/mindee/product/receipt/receipt_v5_document.rb +138 -0
- data/lib/mindee/product/receipt/receipt_v5_line_item.rb +69 -0
- data/lib/mindee/product/receipt/receipt_v5_page.rb +32 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +38 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +73 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1_page.rb +34 -0
- data/lib/mindee/product.rb +16 -0
- data/lib/mindee/version.rb +2 -1
- data/lib/mindee.rb +3 -1
- metadata +87 -38
- data/docs/code_samples/shipping_containers_v1.txt +0 -14
- data/lib/mindee/document_config.rb +0 -60
- data/lib/mindee/parsing/document.rb +0 -31
- data/lib/mindee/parsing/error.rb +0 -22
- data/lib/mindee/parsing/inference.rb +0 -53
- data/lib/mindee/parsing/page.rb +0 -46
- data/lib/mindee/parsing/prediction/base.rb +0 -30
- data/lib/mindee/parsing/prediction/common_fields/amount.rb +0 -21
- data/lib/mindee/parsing/prediction/common_fields/base.rb +0 -72
- data/lib/mindee/parsing/prediction/common_fields/company_registration.rb +0 -17
- data/lib/mindee/parsing/prediction/common_fields/date.rb +0 -30
- data/lib/mindee/parsing/prediction/common_fields/locale.rb +0 -45
- data/lib/mindee/parsing/prediction/common_fields/payment_details.rb +0 -33
- data/lib/mindee/parsing/prediction/common_fields/position.rb +0 -39
- data/lib/mindee/parsing/prediction/common_fields/tax.rb +0 -40
- data/lib/mindee/parsing/prediction/common_fields/text.rb +0 -12
- data/lib/mindee/parsing/prediction/common_fields.rb +0 -11
- data/lib/mindee/parsing/prediction/custom/custom_v1.rb +0 -58
- data/lib/mindee/parsing/prediction/custom/fields.rb +0 -91
- data/lib/mindee/parsing/prediction/eu/license_plate/license_plate_v1.rb +0 -34
- data/lib/mindee/parsing/prediction/financial_document/financial_document_v1.rb +0 -237
- data/lib/mindee/parsing/prediction/financial_document/financial_document_v1_line_item.rb +0 -58
- data/lib/mindee/parsing/prediction/fr/bank_account_details/bank_account_details_v1.rb +0 -40
- data/lib/mindee/parsing/prediction/fr/carte_vitale/carte_vitale_v1.rb +0 -49
- data/lib/mindee/parsing/prediction/invoice/invoice_v4.rb +0 -212
- data/lib/mindee/parsing/prediction/invoice/invoice_v4_line_item.rb +0 -58
- data/lib/mindee/parsing/prediction/passport/passport_v1.rb +0 -121
- data/lib/mindee/parsing/prediction/proof_of_address/proof_of_address_v1.rb +0 -80
- data/lib/mindee/parsing/prediction/receipt/receipt_v4.rb +0 -87
- data/lib/mindee/parsing/prediction/receipt/receipt_v5.rb +0 -136
- data/lib/mindee/parsing/prediction/receipt/receipt_v5_line_item.rb +0 -37
- data/lib/mindee/parsing/prediction/shipping_container/shipping_container_v1.rb +0 -38
- data/lib/mindee/parsing/prediction/us/bank_check/bank_check_v1.rb +0 -70
- data/lib/mindee/parsing/prediction.rb +0 -15
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../common_fields'
|
|
4
|
-
require_relative '../base'
|
|
5
|
-
require_relative 'receipt_v5_line_item'
|
|
6
|
-
|
|
7
|
-
module Mindee
|
|
8
|
-
module Prediction
|
|
9
|
-
# Expense Receipt v5 prediction results.
|
|
10
|
-
class ReceiptV5 < Prediction
|
|
11
|
-
# The locale identifier in BCP 47 (RFC 5646) format: ISO language code, '-', ISO country code.
|
|
12
|
-
# @return [Mindee::Locale]
|
|
13
|
-
attr_reader :locale
|
|
14
|
-
# The receipt category among predefined classes.
|
|
15
|
-
# @return [Mindee::TextField]
|
|
16
|
-
attr_reader :category
|
|
17
|
-
# The receipt sub category among predefined classes for transport and food.
|
|
18
|
-
# @return [Mindee::TextField]
|
|
19
|
-
attr_reader :subcategory
|
|
20
|
-
# Whether the document is an expense receipt or a credit card receipt.
|
|
21
|
-
# @return [Mindee::TextField]
|
|
22
|
-
attr_reader :document_type
|
|
23
|
-
# The date the purchase was made.
|
|
24
|
-
# @return [Mindee::DateField]
|
|
25
|
-
attr_reader :date
|
|
26
|
-
# Time of purchase with 24 hours formatting (HH:MM).
|
|
27
|
-
# @return [Mindee::TextField]
|
|
28
|
-
attr_reader :time
|
|
29
|
-
# The total amount paid including taxes, discounts, fees, tips, and gratuity.
|
|
30
|
-
# @return [Mindee::AmountField]
|
|
31
|
-
attr_reader :total_amount
|
|
32
|
-
# The total amount excluding taxes.
|
|
33
|
-
# @return [Mindee::AmountField]
|
|
34
|
-
attr_reader :total_net
|
|
35
|
-
# The total amount of taxes.
|
|
36
|
-
# @return [Mindee::AmountField]
|
|
37
|
-
attr_reader :total_tax
|
|
38
|
-
# The total amount of tip and gratuity.
|
|
39
|
-
# @return [Mindee::AmountField]
|
|
40
|
-
attr_reader :tip
|
|
41
|
-
# List of tax lines information including: Amount, tax rate, tax base amount and tax code.
|
|
42
|
-
# @return [Array<Mindee::TaxField>]
|
|
43
|
-
attr_reader :taxes
|
|
44
|
-
# The name of the supplier or merchant.
|
|
45
|
-
# @return [Mindee::TextField]
|
|
46
|
-
attr_reader :supplier_name
|
|
47
|
-
# List of supplier company registrations or identifiers.
|
|
48
|
-
# @return [Array<Mindee::CompanyRegistration>]
|
|
49
|
-
attr_reader :supplier_company_registrations
|
|
50
|
-
# The address of the supplier or merchant returned as a single string.
|
|
51
|
-
# @return [Mindee::TextField]
|
|
52
|
-
attr_reader :supplier_address
|
|
53
|
-
# The Phone number of the supplier or merchant returned as a single string.
|
|
54
|
-
# @return [Mindee::TextField]
|
|
55
|
-
attr_reader :supplier_phone_number
|
|
56
|
-
# Full extraction of lines, including: description, quantity, unit price and total.
|
|
57
|
-
# @return [Array<Mindee::ReceiptV5LineItem>]
|
|
58
|
-
attr_reader :line_items
|
|
59
|
-
|
|
60
|
-
# @param prediction [Hash]
|
|
61
|
-
# @param page_id [Integer, nil]
|
|
62
|
-
def initialize(prediction, page_id)
|
|
63
|
-
super
|
|
64
|
-
@locale = Locale.new(prediction['locale'], page_id)
|
|
65
|
-
@category = TextField.new(prediction['category'], page_id)
|
|
66
|
-
@subcategory = TextField.new(prediction['subcategory'], page_id)
|
|
67
|
-
@document_type = TextField.new(prediction['document_type'], page_id)
|
|
68
|
-
@date = DateField.new(prediction['date'], page_id)
|
|
69
|
-
@time = TextField.new(prediction['time'], page_id)
|
|
70
|
-
@total_amount = AmountField.new(prediction['total_amount'], page_id)
|
|
71
|
-
@total_net = AmountField.new(prediction['total_net'], page_id)
|
|
72
|
-
@total_tax = AmountField.new(prediction['total_tax'], page_id)
|
|
73
|
-
@tip = AmountField.new(prediction['tip'], page_id)
|
|
74
|
-
@taxes = []
|
|
75
|
-
prediction['taxes'].each do |item|
|
|
76
|
-
@taxes.push(TaxField.new(item, page_id))
|
|
77
|
-
end
|
|
78
|
-
@supplier_name = TextField.new(prediction['supplier_name'], page_id)
|
|
79
|
-
@supplier_company_registrations = []
|
|
80
|
-
prediction['supplier_company_registrations'].each do |item|
|
|
81
|
-
@supplier_company_registrations.push(CompanyRegistration.new(item, page_id))
|
|
82
|
-
end
|
|
83
|
-
@supplier_address = TextField.new(prediction['supplier_address'], page_id)
|
|
84
|
-
@supplier_phone_number = TextField.new(prediction['supplier_phone_number'], page_id)
|
|
85
|
-
@line_items = []
|
|
86
|
-
prediction['line_items'].each do |item|
|
|
87
|
-
@line_items.push(ReceiptV5LineItem.new(item, page_id))
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# @return String
|
|
92
|
-
def to_s
|
|
93
|
-
taxes = @taxes.join("\n #{' ' * 7}")
|
|
94
|
-
supplier_company_registrations = @supplier_company_registrations.join("\n #{' ' * 32}")
|
|
95
|
-
line_items = line_items_to_s
|
|
96
|
-
out_str = String.new
|
|
97
|
-
out_str << "\n:Expense Locale: #{@locale}".rstrip
|
|
98
|
-
out_str << "\n:Expense Category: #{@category}".rstrip
|
|
99
|
-
out_str << "\n:Expense Sub Category: #{@subcategory}".rstrip
|
|
100
|
-
out_str << "\n:Document Type: #{@document_type}".rstrip
|
|
101
|
-
out_str << "\n:Purchase Date: #{@date}".rstrip
|
|
102
|
-
out_str << "\n:Purchase Time: #{@time}".rstrip
|
|
103
|
-
out_str << "\n:Total Amount: #{@total_amount}".rstrip
|
|
104
|
-
out_str << "\n:Total Excluding Taxes: #{@total_net}".rstrip
|
|
105
|
-
out_str << "\n:Total Tax: #{@total_tax}".rstrip
|
|
106
|
-
out_str << "\n:Tip and Gratuity: #{@tip}".rstrip
|
|
107
|
-
out_str << "\n:Taxes: #{taxes}".rstrip
|
|
108
|
-
out_str << "\n:Supplier Name: #{@supplier_name}".rstrip
|
|
109
|
-
out_str << "\n:Supplier Company Registrations: #{supplier_company_registrations}".rstrip
|
|
110
|
-
out_str << "\n:Supplier Address: #{@supplier_address}".rstrip
|
|
111
|
-
out_str << "\n:Supplier Phone Number: #{@supplier_phone_number}".rstrip
|
|
112
|
-
out_str << "\n:Line Items:"
|
|
113
|
-
out_str << line_items
|
|
114
|
-
out_str[1..].to_s
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
private
|
|
118
|
-
|
|
119
|
-
def line_items_separator(char)
|
|
120
|
-
" +#{char * 38}+#{char * 10}+#{char * 14}+#{char * 12}+"
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def line_items_to_s
|
|
124
|
-
return '' if @line_items.empty?
|
|
125
|
-
|
|
126
|
-
line_items = @line_items.map(&:to_s).join("\n#{line_items_separator('-')}\n ")
|
|
127
|
-
out_str = String.new
|
|
128
|
-
out_str << "\n#{line_items_separator('-')}"
|
|
129
|
-
out_str << "\n | Description #{' ' * 25}| Quantity | Total Amount | Unit Price |"
|
|
130
|
-
out_str << "\n#{line_items_separator('=')}"
|
|
131
|
-
out_str << "\n #{line_items}"
|
|
132
|
-
out_str << "\n#{line_items_separator('-')}"
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Mindee
|
|
4
|
-
# Full extraction of lines, including: description, quantity, unit price and total.
|
|
5
|
-
class ReceiptV5LineItem
|
|
6
|
-
# The item description.
|
|
7
|
-
# @return [String]
|
|
8
|
-
attr_reader :description
|
|
9
|
-
# The item quantity.
|
|
10
|
-
# @return [Float]
|
|
11
|
-
attr_reader :quantity
|
|
12
|
-
# The item total amount.
|
|
13
|
-
# @return [Float]
|
|
14
|
-
attr_reader :total_amount
|
|
15
|
-
# The item unit price.
|
|
16
|
-
# @return [Float]
|
|
17
|
-
attr_reader :unit_price
|
|
18
|
-
|
|
19
|
-
def initialize(prediction, page_id)
|
|
20
|
-
@description = prediction['description']
|
|
21
|
-
@quantity = prediction['quantity']
|
|
22
|
-
@total_amount = prediction['total_amount']
|
|
23
|
-
@unit_price = prediction['unit_price']
|
|
24
|
-
@page_id = page_id
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# @return String
|
|
28
|
-
def to_s
|
|
29
|
-
out_str = String.new
|
|
30
|
-
out_str << format('| %- 37s', @description)
|
|
31
|
-
out_str << format('| %- 9s', Field.float_to_string(@quantity))
|
|
32
|
-
out_str << format('| %- 13s', Field.float_to_string(@total_amount))
|
|
33
|
-
out_str << format('| %- 11s', Field.float_to_string(@unit_price))
|
|
34
|
-
out_str << '|'
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../common_fields'
|
|
4
|
-
require_relative '../base'
|
|
5
|
-
|
|
6
|
-
module Mindee
|
|
7
|
-
module Prediction
|
|
8
|
-
# License plate prediction.
|
|
9
|
-
class ShippingContainerV1 < Prediction
|
|
10
|
-
# ISO 6346 code for container owner prefix + equipment identifier.
|
|
11
|
-
# @return [Array<Mindee::TextField>]
|
|
12
|
-
attr_reader :owner
|
|
13
|
-
# ISO 6346 code for container serial number (6+1 digits).
|
|
14
|
-
# @return [Array<Mindee::TextField>]
|
|
15
|
-
attr_reader :serial_number
|
|
16
|
-
# ISO 6346 code for container length, height and type.
|
|
17
|
-
# @return [Array<Mindee::TextField>]
|
|
18
|
-
attr_reader :size_type
|
|
19
|
-
|
|
20
|
-
# @param prediction [Hash]
|
|
21
|
-
# @param page_id [Integer, nil]
|
|
22
|
-
def initialize(prediction, page_id)
|
|
23
|
-
super
|
|
24
|
-
@owner = TextField.new(prediction['owner'], page_id)
|
|
25
|
-
@serial_number = TextField.new(prediction['serial_number'], page_id)
|
|
26
|
-
@size_type = TextField.new(prediction['size_type'], page_id)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def to_s
|
|
30
|
-
out_str = String.new
|
|
31
|
-
out_str << "\n:Owner: #{@owner}".rstrip
|
|
32
|
-
out_str << "\n:Serial Number: #{@serial_number}".rstrip
|
|
33
|
-
out_str << "\n:Size and Type: #{@size_type}".rstrip
|
|
34
|
-
out_str[1..].to_s
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../common_fields'
|
|
4
|
-
require_relative '../../base'
|
|
5
|
-
|
|
6
|
-
module Mindee
|
|
7
|
-
module Prediction
|
|
8
|
-
module US
|
|
9
|
-
# License plate prediction.
|
|
10
|
-
class BankCheckV1 < Prediction
|
|
11
|
-
# Payer's bank account number.
|
|
12
|
-
# @return [Array<Mindee::TextField>]
|
|
13
|
-
attr_reader :account_number
|
|
14
|
-
# Amount to be paid.
|
|
15
|
-
# @return [Array<Mindee::AmountField>]
|
|
16
|
-
attr_reader :amount
|
|
17
|
-
# The check number.
|
|
18
|
-
# @return [Mindee::TextField]
|
|
19
|
-
attr_reader :check_number
|
|
20
|
-
# Payer's bank account routing number.
|
|
21
|
-
# @return [Mindee::TextField]
|
|
22
|
-
attr_reader :routing_number
|
|
23
|
-
# Date the check was issued.
|
|
24
|
-
# @return [Mindee::DateField]
|
|
25
|
-
attr_reader :date
|
|
26
|
-
# The positions of the signatures on the image.
|
|
27
|
-
# @return [Array<Mindee::PositionField>]
|
|
28
|
-
attr_reader :signatures_positions
|
|
29
|
-
# Check's position in the image.
|
|
30
|
-
# @return [Mindee::PositionField]
|
|
31
|
-
attr_reader :check_position
|
|
32
|
-
# List of payees (full name or company name).
|
|
33
|
-
# @return [Array<Mindee::TextField>]
|
|
34
|
-
attr_reader :payees
|
|
35
|
-
|
|
36
|
-
# @param prediction [Hash]
|
|
37
|
-
# @param page_id [Integer, nil]
|
|
38
|
-
def initialize(prediction, page_id)
|
|
39
|
-
super
|
|
40
|
-
@account_number = TextField.new(prediction['account_number'], page_id)
|
|
41
|
-
@amount = AmountField.new(prediction['amount'], page_id)
|
|
42
|
-
@check_number = TextField.new(prediction['check_number'], page_id)
|
|
43
|
-
@date = DateField.new(prediction['date'], page_id)
|
|
44
|
-
@check_position = PositionField.new(prediction['check_position'], page_id)
|
|
45
|
-
@routing_number = TextField.new(prediction['routing_number'], page_id)
|
|
46
|
-
@signatures_positions = []
|
|
47
|
-
prediction['signatures_positions'].each do |item|
|
|
48
|
-
@signatures_positions.push(PositionField.new(item, page_id))
|
|
49
|
-
end
|
|
50
|
-
@payees = []
|
|
51
|
-
prediction['payees'].each do |item|
|
|
52
|
-
@payees.push(TextField.new(item, page_id))
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def to_s
|
|
57
|
-
payees = @payees.map(&:value).join(', ')
|
|
58
|
-
out_str = String.new
|
|
59
|
-
out_str << "\n:Routing number: #{@routing_number}".rstrip
|
|
60
|
-
out_str << "\n:Account number: #{@account_number}".rstrip
|
|
61
|
-
out_str << "\n:Check number: #{@check_number}".rstrip
|
|
62
|
-
out_str << "\n:Date: #{@date}".rstrip
|
|
63
|
-
out_str << "\n:Amount: #{@amount}".rstrip
|
|
64
|
-
out_str << "\n:Payees: #{payees}".rstrip
|
|
65
|
-
out_str[1..].to_s
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'prediction/custom/custom_v1'
|
|
4
|
-
require_relative 'prediction/proof_of_address/proof_of_address_v1'
|
|
5
|
-
require_relative 'prediction/financial_document/financial_document_v1'
|
|
6
|
-
require_relative 'prediction/invoice/invoice_v4'
|
|
7
|
-
require_relative 'prediction/passport/passport_v1'
|
|
8
|
-
require_relative 'prediction/receipt/receipt_v4'
|
|
9
|
-
require_relative 'prediction/receipt/receipt_v5'
|
|
10
|
-
require_relative 'prediction/eu/license_plate/license_plate_v1'
|
|
11
|
-
require_relative 'prediction/shipping_container/shipping_container_v1'
|
|
12
|
-
require_relative 'prediction/us/bank_check/bank_check_v1'
|
|
13
|
-
require_relative 'prediction/fr/bank_account_details/bank_account_details_v1'
|
|
14
|
-
require_relative 'prediction/fr/carte_vitale/carte_vitale_v1'
|
|
15
|
-
require_relative 'prediction/fr/id_card/id_card_v1'
|