mindee 3.12.0 → 3.14.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/.rubocop.yml +1 -1
- data/CHANGELOG.md +26 -0
- data/README.md +23 -23
- data/Rakefile +5 -0
- data/docs/bank_account_details_v2.md +5 -1
- data/docs/bank_check_v1.md +6 -2
- data/docs/bank_statement_fr_v1.md +3 -0
- data/docs/barcode_reader_v1.md +5 -1
- data/docs/bill_of_lading_v1.md +251 -0
- data/docs/carte_grise_v1.md +5 -1
- data/docs/carte_vitale_v1.md +5 -1
- data/docs/code_samples/bill_of_lading_v1_async.txt +19 -0
- data/docs/code_samples/energy_bill_fra_v1_async.txt +19 -0
- data/docs/code_samples/invoices_v4_async.txt +19 -0
- data/docs/code_samples/nutrition_facts_v1_async.txt +19 -0
- data/docs/code_samples/payslip_fra_v2_async.txt +19 -0
- data/docs/cropper_v1.md +6 -2
- data/docs/custom_v1.md +5 -3
- data/docs/energy_bill_fra_v1.md +309 -0
- data/docs/eu_driver_license_v1.md +6 -2
- data/docs/expense_receipts_v5.md +30 -5
- data/docs/financial_document_v1.md +43 -1
- data/docs/generated_v1.md +3 -0
- data/docs/getting_started.md +3 -0
- data/docs/idcard_fr_v2.md +15 -2
- data/docs/international_id_v2.md +13 -1
- data/docs/invoice_splitter_v1.md +16 -13
- data/docs/invoices_v4.md +70 -23
- data/docs/license_plates_v1.md +5 -1
- data/docs/multi_receipts_detector_v1.md +5 -1
- data/docs/nutrition_facts_v1.md +374 -0
- data/docs/passport_v1.md +5 -1
- data/docs/payslip_fra_v2.md +294 -0
- data/docs/proof_of_address_v1.md +5 -1
- data/docs/resume_v1.md +24 -1
- data/docs/us_driver_license_v1.md +6 -2
- data/docs/us_healthcare_cards_v1.md +5 -1
- data/docs/us_mail_v2.md +6 -2
- data/docs/us_w9_v1.md +6 -2
- data/examples/auto_invoice_splitter_extraction.rb +48 -0
- data/examples/auto_multi_receipts_detector_extraction.rb +31 -0
- data/lib/mindee/client.rb +20 -8
- data/lib/mindee/{image_extraction → extraction}/common/extracted_image.rb +1 -1
- data/lib/mindee/extraction/common/image_extractor.rb +192 -0
- data/lib/mindee/{image_extraction → extraction}/common.rb +1 -0
- data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +32 -0
- data/lib/mindee/extraction/pdf_extractor/extracted_pdf.rb +55 -0
- data/lib/mindee/extraction/pdf_extractor/pdf_extractor.rb +111 -0
- data/lib/mindee/extraction/pdf_extractor.rb +4 -0
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +322 -0
- data/lib/mindee/extraction/tax_extractor.rb +1 -320
- data/lib/mindee/extraction.rb +3 -0
- data/lib/mindee/http/endpoint.rb +18 -6
- data/lib/mindee/parsing/common/api_response.rb +1 -1
- data/lib/mindee/parsing/common/document.rb +31 -1
- data/lib/mindee/parsing/common/extras/cropper_extra.rb +29 -0
- data/lib/mindee/parsing/common/extras/extras.rb +50 -0
- data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +32 -0
- data/lib/mindee/parsing/common/extras.rb +5 -0
- data/lib/mindee/parsing/common/page.rb +5 -0
- data/lib/mindee/parsing/standard/base_field.rb +1 -0
- data/lib/mindee/parsing/standard/date_field.rb +4 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +39 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +52 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +95 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +58 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +136 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +58 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +32 -0
- data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +58 -0
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +11 -1
- data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +15 -1
- data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +4 -15
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +41 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +235 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +48 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +48 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +97 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +54 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +34 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +97 -0
- data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +97 -0
- data/lib/mindee/product/fr/payslip/payslip_v2.rb +41 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +54 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +128 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +72 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +34 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +100 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +66 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +56 -0
- data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +81 -0
- data/lib/mindee/product/invoice/invoice_v4_document.rb +11 -1
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +15 -1
- data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +1 -1
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +39 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +173 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +87 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +32 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +46 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +58 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +52 -0
- data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +52 -0
- data/lib/mindee/product/receipt/receipt_v5_line_item.rb +11 -1
- data/lib/mindee/product/resume/resume_v1_certificate.rb +11 -1
- data/lib/mindee/product/resume/resume_v1_education.rb +14 -1
- data/lib/mindee/product/resume/resume_v1_language.rb +9 -1
- data/lib/mindee/product/resume/resume_v1_professional_experience.rb +15 -1
- data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +9 -1
- data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +9 -1
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +14 -1
- data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +5 -17
- data/lib/mindee/product.rb +5 -1
- data/lib/mindee/version.rb +1 -1
- metadata +71 -9
- data/lib/mindee/image_extraction/common/image_extractor.rb +0 -191
- data/lib/mindee/image_extraction/multi_receipts_extractor/multi_receipts_extractor.rb +0 -26
- data/lib/mindee/image_extraction.rb +0 -4
- /data/lib/mindee/{image_extraction → extraction}/multi_receipts_extractor.rb +0 -0
- /data/lib/mindee/extraction/{ocr_extractor.rb → tax_extractor/ocr_extractor.rb} +0 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# The entity that consumes the energy.
|
10
|
+
class EnergyBillV1EnergyConsumer < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The address of the energy consumer.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :address
|
15
|
+
# The name of the energy consumer.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :name
|
18
|
+
|
19
|
+
# @param prediction [Hash]
|
20
|
+
# @param page_id [Integer, nil]
|
21
|
+
def initialize(prediction, page_id)
|
22
|
+
super(prediction, page_id)
|
23
|
+
@address = prediction['address']
|
24
|
+
@name = prediction['name']
|
25
|
+
@page_id = page_id
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Hash]
|
29
|
+
def printable_values
|
30
|
+
printable = {}
|
31
|
+
printable[:address] = format_for_display(@address)
|
32
|
+
printable[:name] = format_for_display(@name)
|
33
|
+
printable
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def to_s
|
38
|
+
printable = printable_values
|
39
|
+
out_str = String.new
|
40
|
+
out_str << "\n :Address: #{printable[:address]}"
|
41
|
+
out_str << "\n :Name: #{printable[:name]}"
|
42
|
+
out_str
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# The company that supplies the energy.
|
10
|
+
class EnergyBillV1EnergySupplier < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The address of the energy supplier.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :address
|
15
|
+
# The name of the energy supplier.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :name
|
18
|
+
|
19
|
+
# @param prediction [Hash]
|
20
|
+
# @param page_id [Integer, nil]
|
21
|
+
def initialize(prediction, page_id)
|
22
|
+
super(prediction, page_id)
|
23
|
+
@address = prediction['address']
|
24
|
+
@name = prediction['name']
|
25
|
+
@page_id = page_id
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Hash]
|
29
|
+
def printable_values
|
30
|
+
printable = {}
|
31
|
+
printable[:address] = format_for_display(@address)
|
32
|
+
printable[:name] = format_for_display(@name)
|
33
|
+
printable
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def to_s
|
38
|
+
printable = printable_values
|
39
|
+
out_str = String.new
|
40
|
+
out_str << "\n :Address: #{printable[:address]}"
|
41
|
+
out_str << "\n :Name: #{printable[:name]}"
|
42
|
+
out_str
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# Details of energy consumption.
|
10
|
+
class EnergyBillV1EnergyUsage < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# Description or details of the energy usage.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :description
|
15
|
+
# The end date of the energy usage.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :end_date
|
18
|
+
# The start date of the energy usage.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :start_date
|
21
|
+
# The rate of tax applied to the total cost.
|
22
|
+
# @return [Float]
|
23
|
+
attr_reader :tax_rate
|
24
|
+
# The total cost of energy consumed.
|
25
|
+
# @return [Float]
|
26
|
+
attr_reader :total
|
27
|
+
# The price per unit of energy consumed.
|
28
|
+
# @return [Float]
|
29
|
+
attr_reader :unit_price
|
30
|
+
|
31
|
+
# @param prediction [Hash]
|
32
|
+
# @param page_id [Integer, nil]
|
33
|
+
def initialize(prediction, page_id)
|
34
|
+
super(prediction, page_id)
|
35
|
+
@description = prediction['description']
|
36
|
+
@end_date = prediction['end_date']
|
37
|
+
@start_date = prediction['start_date']
|
38
|
+
@tax_rate = prediction['tax_rate']
|
39
|
+
@total = prediction['total']
|
40
|
+
@unit_price = prediction['unit_price']
|
41
|
+
@page_id = page_id
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [Hash]
|
45
|
+
def printable_values
|
46
|
+
printable = {}
|
47
|
+
printable[:description] = format_for_display(@description)
|
48
|
+
printable[:end_date] = format_for_display(@end_date)
|
49
|
+
printable[:start_date] = format_for_display(@start_date)
|
50
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
51
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
52
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
53
|
+
printable
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Hash]
|
57
|
+
def table_printable_values
|
58
|
+
printable = {}
|
59
|
+
printable[:description] = format_for_display(@description, 36)
|
60
|
+
printable[:end_date] = format_for_display(@end_date, 10)
|
61
|
+
printable[:start_date] = format_for_display(@start_date, nil)
|
62
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
63
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
64
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
65
|
+
printable
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String]
|
69
|
+
def to_table_line
|
70
|
+
printable = table_printable_values
|
71
|
+
out_str = String.new
|
72
|
+
out_str << format('| %- 37s', printable[:description])
|
73
|
+
out_str << format('| %- 11s', printable[:end_date])
|
74
|
+
out_str << format('| %- 11s', printable[:start_date])
|
75
|
+
out_str << format('| %- 9s', printable[:tax_rate])
|
76
|
+
out_str << format('| %- 10s', printable[:total])
|
77
|
+
out_str << format('| %- 11s', printable[:unit_price])
|
78
|
+
out_str << '|'
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String]
|
82
|
+
def to_s
|
83
|
+
printable = printable_values
|
84
|
+
out_str = String.new
|
85
|
+
out_str << "\n :Description: #{printable[:description]}"
|
86
|
+
out_str << "\n :End Date: #{printable[:end_date]}"
|
87
|
+
out_str << "\n :Start Date: #{printable[:start_date]}"
|
88
|
+
out_str << "\n :Tax Rate: #{printable[:tax_rate]}"
|
89
|
+
out_str << "\n :Total: #{printable[:total]}"
|
90
|
+
out_str << "\n :Unit Price: #{printable[:unit_price]}"
|
91
|
+
out_str
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# Information about the energy meter.
|
10
|
+
class EnergyBillV1MeterDetail < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The unique identifier of the energy meter.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :meter_number
|
15
|
+
# The type of energy meter.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :meter_type
|
18
|
+
# The unit of measurement for energy consumption, which can be kW, m³, or L.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :unit
|
21
|
+
|
22
|
+
# @param prediction [Hash]
|
23
|
+
# @param page_id [Integer, nil]
|
24
|
+
def initialize(prediction, page_id)
|
25
|
+
super(prediction, page_id)
|
26
|
+
@meter_number = prediction['meter_number']
|
27
|
+
@meter_type = prediction['meter_type']
|
28
|
+
@unit = prediction['unit']
|
29
|
+
@page_id = page_id
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash]
|
33
|
+
def printable_values
|
34
|
+
printable = {}
|
35
|
+
printable[:meter_number] = format_for_display(@meter_number)
|
36
|
+
printable[:meter_type] = format_for_display(@meter_type)
|
37
|
+
printable[:unit] = format_for_display(@unit)
|
38
|
+
printable
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def to_s
|
43
|
+
printable = printable_values
|
44
|
+
out_str = String.new
|
45
|
+
out_str << "\n :Meter Number: #{printable[:meter_number]}"
|
46
|
+
out_str << "\n :Meter Type: #{printable[:meter_type]}"
|
47
|
+
out_str << "\n :Unit of Measure: #{printable[:unit]}"
|
48
|
+
out_str
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
require_relative 'energy_bill_v1_document'
|
5
|
+
|
6
|
+
module Mindee
|
7
|
+
module Product
|
8
|
+
module FR
|
9
|
+
module EnergyBill
|
10
|
+
# Energy Bill API version 1.0 page data.
|
11
|
+
class EnergyBillV1Page < Mindee::Parsing::Common::Page
|
12
|
+
# @param prediction [Hash]
|
13
|
+
def initialize(prediction)
|
14
|
+
super(prediction)
|
15
|
+
@prediction = EnergyBillV1PagePrediction.new(
|
16
|
+
prediction['prediction'],
|
17
|
+
prediction['id']
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Energy Bill V1 page prediction.
|
23
|
+
class EnergyBillV1PagePrediction < EnergyBillV1Document
|
24
|
+
# @return [String]
|
25
|
+
def to_s
|
26
|
+
out_str = String.new
|
27
|
+
out_str << "\n#{super}"
|
28
|
+
out_str
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# The subscription details fee for the energy service.
|
10
|
+
class EnergyBillV1Subscription < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# Description or details of the subscription.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :description
|
15
|
+
# The end date of the subscription.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :end_date
|
18
|
+
# The start date of the subscription.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :start_date
|
21
|
+
# The rate of tax applied to the total cost.
|
22
|
+
# @return [Float]
|
23
|
+
attr_reader :tax_rate
|
24
|
+
# The total cost of subscription.
|
25
|
+
# @return [Float]
|
26
|
+
attr_reader :total
|
27
|
+
# The price per unit of subscription.
|
28
|
+
# @return [Float]
|
29
|
+
attr_reader :unit_price
|
30
|
+
|
31
|
+
# @param prediction [Hash]
|
32
|
+
# @param page_id [Integer, nil]
|
33
|
+
def initialize(prediction, page_id)
|
34
|
+
super(prediction, page_id)
|
35
|
+
@description = prediction['description']
|
36
|
+
@end_date = prediction['end_date']
|
37
|
+
@start_date = prediction['start_date']
|
38
|
+
@tax_rate = prediction['tax_rate']
|
39
|
+
@total = prediction['total']
|
40
|
+
@unit_price = prediction['unit_price']
|
41
|
+
@page_id = page_id
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [Hash]
|
45
|
+
def printable_values
|
46
|
+
printable = {}
|
47
|
+
printable[:description] = format_for_display(@description)
|
48
|
+
printable[:end_date] = format_for_display(@end_date)
|
49
|
+
printable[:start_date] = format_for_display(@start_date)
|
50
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
51
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
52
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
53
|
+
printable
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Hash]
|
57
|
+
def table_printable_values
|
58
|
+
printable = {}
|
59
|
+
printable[:description] = format_for_display(@description, 36)
|
60
|
+
printable[:end_date] = format_for_display(@end_date, 10)
|
61
|
+
printable[:start_date] = format_for_display(@start_date, nil)
|
62
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
63
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
64
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
65
|
+
printable
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String]
|
69
|
+
def to_table_line
|
70
|
+
printable = table_printable_values
|
71
|
+
out_str = String.new
|
72
|
+
out_str << format('| %- 37s', printable[:description])
|
73
|
+
out_str << format('| %- 11s', printable[:end_date])
|
74
|
+
out_str << format('| %- 11s', printable[:start_date])
|
75
|
+
out_str << format('| %- 9s', printable[:tax_rate])
|
76
|
+
out_str << format('| %- 10s', printable[:total])
|
77
|
+
out_str << format('| %- 11s', printable[:unit_price])
|
78
|
+
out_str << '|'
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String]
|
82
|
+
def to_s
|
83
|
+
printable = printable_values
|
84
|
+
out_str = String.new
|
85
|
+
out_str << "\n :Description: #{printable[:description]}"
|
86
|
+
out_str << "\n :End Date: #{printable[:end_date]}"
|
87
|
+
out_str << "\n :Start Date: #{printable[:start_date]}"
|
88
|
+
out_str << "\n :Tax Rate: #{printable[:tax_rate]}"
|
89
|
+
out_str << "\n :Total: #{printable[:total]}"
|
90
|
+
out_str << "\n :Unit Price: #{printable[:unit_price]}"
|
91
|
+
out_str
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module EnergyBill
|
9
|
+
# Details of Taxes and Contributions.
|
10
|
+
class EnergyBillV1TaxesAndContribution < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# Description or details of the Taxes and Contributions.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :description
|
15
|
+
# The end date of the Taxes and Contributions.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :end_date
|
18
|
+
# The start date of the Taxes and Contributions.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :start_date
|
21
|
+
# The rate of tax applied to the total cost.
|
22
|
+
# @return [Float]
|
23
|
+
attr_reader :tax_rate
|
24
|
+
# The total cost of Taxes and Contributions.
|
25
|
+
# @return [Float]
|
26
|
+
attr_reader :total
|
27
|
+
# The price per unit of Taxes and Contributions.
|
28
|
+
# @return [Float]
|
29
|
+
attr_reader :unit_price
|
30
|
+
|
31
|
+
# @param prediction [Hash]
|
32
|
+
# @param page_id [Integer, nil]
|
33
|
+
def initialize(prediction, page_id)
|
34
|
+
super(prediction, page_id)
|
35
|
+
@description = prediction['description']
|
36
|
+
@end_date = prediction['end_date']
|
37
|
+
@start_date = prediction['start_date']
|
38
|
+
@tax_rate = prediction['tax_rate']
|
39
|
+
@total = prediction['total']
|
40
|
+
@unit_price = prediction['unit_price']
|
41
|
+
@page_id = page_id
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [Hash]
|
45
|
+
def printable_values
|
46
|
+
printable = {}
|
47
|
+
printable[:description] = format_for_display(@description)
|
48
|
+
printable[:end_date] = format_for_display(@end_date)
|
49
|
+
printable[:start_date] = format_for_display(@start_date)
|
50
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
51
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
52
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
53
|
+
printable
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Hash]
|
57
|
+
def table_printable_values
|
58
|
+
printable = {}
|
59
|
+
printable[:description] = format_for_display(@description, 36)
|
60
|
+
printable[:end_date] = format_for_display(@end_date, 10)
|
61
|
+
printable[:start_date] = format_for_display(@start_date, nil)
|
62
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
63
|
+
printable[:total] = @total.nil? ? '' : Field.float_to_string(@total)
|
64
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
65
|
+
printable
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String]
|
69
|
+
def to_table_line
|
70
|
+
printable = table_printable_values
|
71
|
+
out_str = String.new
|
72
|
+
out_str << format('| %- 37s', printable[:description])
|
73
|
+
out_str << format('| %- 11s', printable[:end_date])
|
74
|
+
out_str << format('| %- 11s', printable[:start_date])
|
75
|
+
out_str << format('| %- 9s', printable[:tax_rate])
|
76
|
+
out_str << format('| %- 10s', printable[:total])
|
77
|
+
out_str << format('| %- 11s', printable[:unit_price])
|
78
|
+
out_str << '|'
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String]
|
82
|
+
def to_s
|
83
|
+
printable = printable_values
|
84
|
+
out_str = String.new
|
85
|
+
out_str << "\n :Description: #{printable[:description]}"
|
86
|
+
out_str << "\n :End Date: #{printable[:end_date]}"
|
87
|
+
out_str << "\n :Start Date: #{printable[:start_date]}"
|
88
|
+
out_str << "\n :Tax Rate: #{printable[:tax_rate]}"
|
89
|
+
out_str << "\n :Total: #{printable[:total]}"
|
90
|
+
out_str << "\n :Unit Price: #{printable[:unit_price]}"
|
91
|
+
out_str
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
require_relative 'payslip_v2_document'
|
5
|
+
require_relative 'payslip_v2_page'
|
6
|
+
|
7
|
+
module Mindee
|
8
|
+
module Product
|
9
|
+
module FR
|
10
|
+
# Payslip module.
|
11
|
+
module Payslip
|
12
|
+
# Payslip API version 2 inference prediction.
|
13
|
+
class PayslipV2 < Mindee::Parsing::Common::Inference
|
14
|
+
@endpoint_name = 'payslip_fra'
|
15
|
+
@endpoint_version = '2'
|
16
|
+
|
17
|
+
# @param prediction [Hash]
|
18
|
+
def initialize(prediction)
|
19
|
+
super
|
20
|
+
@prediction = PayslipV2Document.new(prediction['prediction'], nil)
|
21
|
+
@pages = []
|
22
|
+
prediction['pages'].each do |page|
|
23
|
+
if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
|
24
|
+
@pages.push(PayslipV2Page.new(page))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
# Name of the endpoint for this product.
|
31
|
+
# @return [String]
|
32
|
+
attr_reader :endpoint_name
|
33
|
+
# Version for this product.
|
34
|
+
# @return [String]
|
35
|
+
attr_reader :endpoint_version
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module FR
|
8
|
+
module Payslip
|
9
|
+
# Information about the employee's bank account.
|
10
|
+
class PayslipV2BankAccountDetail < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The name of the bank.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :bank_name
|
15
|
+
# The IBAN of the bank account.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :iban
|
18
|
+
# The SWIFT code of the bank.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :swift
|
21
|
+
|
22
|
+
# @param prediction [Hash]
|
23
|
+
# @param page_id [Integer, nil]
|
24
|
+
def initialize(prediction, page_id)
|
25
|
+
super(prediction, page_id)
|
26
|
+
@bank_name = prediction['bank_name']
|
27
|
+
@iban = prediction['iban']
|
28
|
+
@swift = prediction['swift']
|
29
|
+
@page_id = page_id
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash]
|
33
|
+
def printable_values
|
34
|
+
printable = {}
|
35
|
+
printable[:bank_name] = format_for_display(@bank_name)
|
36
|
+
printable[:iban] = format_for_display(@iban)
|
37
|
+
printable[:swift] = format_for_display(@swift)
|
38
|
+
printable
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def to_s
|
43
|
+
printable = printable_values
|
44
|
+
out_str = String.new
|
45
|
+
out_str << "\n :Bank Name: #{printable[:bank_name]}"
|
46
|
+
out_str << "\n :IBAN: #{printable[:iban]}"
|
47
|
+
out_str << "\n :SWIFT: #{printable[:swift]}"
|
48
|
+
out_str
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|