mindee 3.2.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +17 -0
- data/bin/mindee.rb +1 -1
- data/docs/bank_account_details_v2.md +1 -1
- data/docs/bank_check_v1.md +5 -2
- data/docs/barcode_reader_v1.md +3 -3
- data/docs/carte_grise_v1.md +454 -0
- data/docs/carte_vitale_v1.md +1 -1
- data/docs/code_samples/carte_grise_v1.txt +19 -0
- data/docs/cropper_v1.md +6 -3
- data/docs/custom_v1.md +9 -1
- data/docs/expense_receipts_v5.md +3 -3
- data/docs/financial_document_v1.md +11 -8
- data/docs/idcard_fr_v2.md +1 -1
- data/docs/invoices_v4.md +73 -101
- data/docs/license_plates_v1.md +1 -1
- data/docs/multi_receipts_detector_v1.md +6 -3
- data/docs/passport_v1.md +1 -1
- data/docs/proof_of_address_v1.md +1 -1
- data/docs/us_driver_license_v1.md +1 -1
- data/docs/us_w9_v1.md +4 -4
- data/lib/mindee/client.rb +15 -10
- data/lib/mindee/http/endpoint.rb +5 -1
- data/lib/mindee/http/error.rb +1 -1
- data/lib/mindee/parsing/common/api_response.rb +3 -2
- data/lib/mindee/parsing/common/document.rb +4 -1
- data/lib/mindee/parsing/custom/list_field.rb +7 -5
- data/lib/mindee/parsing/standard/base_field.rb +1 -1
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +2 -2
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +39 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +235 -0
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +34 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +1 -2
- data/lib/mindee/product/invoice/invoice_v4_document.rb +105 -145
- data/lib/mindee/product/invoice/invoice_v4_line_item.rb +54 -30
- data/lib/mindee/product/us/w9/w9_v1.rb +2 -2
- data/lib/mindee/product/us/w9/w9_v1_document.rb +1 -1
- data/lib/mindee/product/us/w9/w9_v1_page.rb +2 -2
- data/lib/mindee/product.rb +1 -0
- data/lib/mindee/version.rb +1 -1
- data/lib/mindee.rb +0 -3
- metadata +7 -2
@@ -5,61 +5,85 @@ require_relative '../../parsing'
|
|
5
5
|
module Mindee
|
6
6
|
module Product
|
7
7
|
module Invoice
|
8
|
-
#
|
9
|
-
class InvoiceV4LineItem
|
10
|
-
include Mindee::Parsing::Common
|
8
|
+
# List of line item details.
|
9
|
+
class InvoiceV4LineItem < Mindee::Parsing::Standard::FeatureField
|
11
10
|
include Mindee::Parsing::Standard
|
12
|
-
#
|
13
|
-
attr_reader :product_code
|
11
|
+
# The item description.
|
14
12
|
# @return [String]
|
15
13
|
attr_reader :description
|
14
|
+
# The product code referring to the item.
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :product_code
|
17
|
+
# The item quantity
|
16
18
|
# @return [Float]
|
17
19
|
attr_reader :quantity
|
20
|
+
# The item tax amount.
|
18
21
|
# @return [Float]
|
19
|
-
attr_reader :
|
22
|
+
attr_reader :tax_amount
|
23
|
+
# The item tax rate in percentage.
|
20
24
|
# @return [Float]
|
21
|
-
attr_reader :total_amount
|
22
|
-
# @return [Float] The item tax rate percentage.
|
23
25
|
attr_reader :tax_rate
|
26
|
+
# The item total amount.
|
24
27
|
# @return [Float]
|
25
|
-
attr_reader :
|
28
|
+
attr_reader :total_amount
|
29
|
+
# The item unit price.
|
26
30
|
# @return [Float]
|
27
|
-
attr_reader :
|
28
|
-
# @return [Integer]
|
29
|
-
attr_reader :page_id
|
30
|
-
# @return [Mindee::Geometry::Quadrilateral]
|
31
|
-
attr_reader :bounding_box
|
32
|
-
# @return [Array<Mindee::Geometry::Polygon>]
|
33
|
-
attr_reader :polygon
|
31
|
+
attr_reader :unit_price
|
34
32
|
|
35
33
|
# @param prediction [Hash]
|
36
34
|
# @param page_id [Integer, nil]
|
37
35
|
def initialize(prediction, page_id)
|
36
|
+
super(prediction, page_id)
|
37
|
+
@description = prediction['description']
|
38
38
|
@product_code = prediction['product_code']
|
39
39
|
@quantity = prediction['quantity']
|
40
|
-
@unit_price = prediction['unit_price']
|
41
|
-
@total_amount = prediction['total_amount']
|
42
40
|
@tax_amount = prediction['tax_amount']
|
43
41
|
@tax_rate = prediction['tax_rate']
|
44
|
-
@
|
42
|
+
@total_amount = prediction['total_amount']
|
43
|
+
@unit_price = prediction['unit_price']
|
45
44
|
@page_id = page_id
|
46
45
|
end
|
47
46
|
|
47
|
+
# @return [Hash]
|
48
|
+
def printable_values
|
49
|
+
printable = {}
|
50
|
+
printable[:description] = format_for_display(@description, 36)
|
51
|
+
printable[:product_code] = format_for_display(@product_code, nil)
|
52
|
+
printable[:quantity] = @quantity.nil? ? '' : Field.float_to_string(@quantity)
|
53
|
+
printable[:tax_amount] = @tax_amount.nil? ? '' : Field.float_to_string(@tax_amount)
|
54
|
+
printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate)
|
55
|
+
printable[:total_amount] = @total_amount.nil? ? '' : Field.float_to_string(@total_amount)
|
56
|
+
printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price)
|
57
|
+
printable
|
58
|
+
end
|
59
|
+
|
48
60
|
# @return [String]
|
49
|
-
def
|
50
|
-
|
51
|
-
tax << " (#{Field.float_to_string(@tax_rate)}%)" unless @tax_rate.nil?
|
52
|
-
description = @description.nil? ? '' : @description
|
53
|
-
description = "#{description[0..32]}..." if description.size > 35
|
61
|
+
def to_table_line
|
62
|
+
printable = printable_values
|
54
63
|
out_str = String.new
|
55
|
-
out_str << format('| %-
|
56
|
-
out_str <<
|
57
|
-
out_str <<
|
58
|
-
out_str <<
|
59
|
-
out_str <<
|
60
|
-
out_str <<
|
64
|
+
out_str << format('| %- 37s', printable[:description])
|
65
|
+
out_str << format('| %- 13s', printable[:product_code])
|
66
|
+
out_str << format('| %- 9s', printable[:quantity])
|
67
|
+
out_str << format('| %- 11s', printable[:tax_amount])
|
68
|
+
out_str << format('| %- 13s', printable[:tax_rate])
|
69
|
+
out_str << format('| %- 13s', printable[:total_amount])
|
70
|
+
out_str << format('| %- 11s', printable[:unit_price])
|
61
71
|
out_str << '|'
|
62
72
|
end
|
73
|
+
|
74
|
+
# @return [String]
|
75
|
+
def to_s
|
76
|
+
printable = printable_values
|
77
|
+
out_str = String.new
|
78
|
+
out_str << "\n :Description: #{printable[:description]}"
|
79
|
+
out_str << "\n :Product code: #{printable[:product_code]}"
|
80
|
+
out_str << "\n :Quantity: #{printable[:quantity]}"
|
81
|
+
out_str << "\n :Tax Amount: #{printable[:tax_amount]}"
|
82
|
+
out_str << "\n :Tax Rate (%): #{printable[:tax_rate]}"
|
83
|
+
out_str << "\n :Total Amount: #{printable[:total_amount]}"
|
84
|
+
out_str << "\n :Unit Price: #{printable[:unit_price]}"
|
85
|
+
out_str
|
86
|
+
end
|
63
87
|
end
|
64
88
|
end
|
65
89
|
end
|
@@ -7,9 +7,9 @@ require_relative 'w9_v1_page'
|
|
7
7
|
module Mindee
|
8
8
|
module Product
|
9
9
|
module US
|
10
|
-
#
|
10
|
+
# W9 module.
|
11
11
|
module W9
|
12
|
-
#
|
12
|
+
# W9 V1 prediction inference.
|
13
13
|
class W9V1 < Mindee::Parsing::Common::Inference
|
14
14
|
@endpoint_name = 'us_w9'
|
15
15
|
@endpoint_version = '1'
|
@@ -7,7 +7,7 @@ module Mindee
|
|
7
7
|
module Product
|
8
8
|
module US
|
9
9
|
module W9
|
10
|
-
#
|
10
|
+
# W9 V1 page.
|
11
11
|
class W9V1Page < Mindee::Parsing::Common::Page
|
12
12
|
# @param prediction [Hash]
|
13
13
|
def initialize(prediction)
|
@@ -19,7 +19,7 @@ module Mindee
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
#
|
22
|
+
# W9 V1 page prediction.
|
23
23
|
class W9V1PagePrediction < W9V1Document
|
24
24
|
include Mindee::Parsing::Standard
|
25
25
|
|
data/lib/mindee/product.rb
CHANGED
@@ -16,6 +16,7 @@ require_relative 'product/fr/bank_account_details/bank_account_details_v2'
|
|
16
16
|
require_relative 'product/fr/carte_vitale/carte_vitale_v1'
|
17
17
|
require_relative 'product/fr/id_card/id_card_v1'
|
18
18
|
require_relative 'product/fr/id_card/id_card_v2'
|
19
|
+
require_relative 'product/fr/carte_grise/carte_grise_v1'
|
19
20
|
require_relative 'product/invoice_splitter/invoice_splitter_v1'
|
20
21
|
require_relative 'product/us/bank_check/bank_check_v1'
|
21
22
|
require_relative 'product/us/driver_license/driver_license_v1'
|
data/lib/mindee/version.rb
CHANGED
data/lib/mindee.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mindee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindee, SA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marcel
|
@@ -120,11 +120,13 @@ files:
|
|
120
120
|
- docs/bank_account_details_v2.md
|
121
121
|
- docs/bank_check_v1.md
|
122
122
|
- docs/barcode_reader_v1.md
|
123
|
+
- docs/carte_grise_v1.md
|
123
124
|
- docs/carte_vitale_v1.md
|
124
125
|
- docs/code_samples/bank_account_details_v1.txt
|
125
126
|
- docs/code_samples/bank_account_details_v2.txt
|
126
127
|
- docs/code_samples/bank_check_v1.txt
|
127
128
|
- docs/code_samples/barcode_reader_v1.txt
|
129
|
+
- docs/code_samples/carte_grise_v1.txt
|
128
130
|
- docs/code_samples/carte_vitale_v1.txt
|
129
131
|
- docs/code_samples/cropper_v1.txt
|
130
132
|
- docs/code_samples/custom_v1.txt
|
@@ -224,6 +226,9 @@ files:
|
|
224
226
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb
|
225
227
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb
|
226
228
|
- lib/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rb
|
229
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1.rb
|
230
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb
|
231
|
+
- lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb
|
227
232
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb
|
228
233
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb
|
229
234
|
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb
|