mindee 3.17.0 → 3.19.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/CHANGELOG.md +14 -0
- data/README.md +4 -4
- data/bin/mindee.rb +0 -6
- data/docs/code_samples/{carte_vitale_v1.txt → us_mail_v3_async.txt} +2 -2
- data/docs/custom_v1.md +1 -1
- data/docs/getting_started.md +5 -5
- data/docs/{us_mail_v2.md → us_mail_v3.md} +34 -12
- data/lib/mindee/client.rb +2 -2
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +34 -19
- data/lib/mindee/input/sources/base64_input_source.rb +31 -0
- data/lib/mindee/input/sources/bytes_input_source.rb +21 -0
- data/lib/mindee/input/sources/file_input_source.rb +20 -0
- data/lib/mindee/input/sources/local_input_source.rb +183 -0
- data/lib/mindee/input/sources/path_input_source.rb +20 -0
- data/lib/mindee/input/sources/url_input_source.rb +127 -0
- data/lib/mindee/input/sources.rb +6 -248
- data/lib/mindee/parsing/standard/boolean_field.rb +6 -0
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +1 -1
- data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +1 -1
- data/lib/mindee/product/{fr/carte_vitale/carte_vitale_v1.rb → us/us_mail/us_mail_v3.rb} +11 -11
- data/lib/mindee/product/us/us_mail/us_mail_v3_document.rb +107 -0
- data/lib/mindee/product/{fr/carte_vitale/carte_vitale_v1_page.rb → us/us_mail/us_mail_v3_page.rb} +8 -8
- data/lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb +113 -0
- data/lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb +66 -0
- data/lib/mindee/product.rb +1 -1
- data/lib/mindee/version.rb +1 -1
- metadata +18 -10
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +0 -52
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module US
|
8
|
+
module UsMail
|
9
|
+
# The addresses of the recipients.
|
10
|
+
class UsMailV3RecipientAddress < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The city of the recipient's address.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :city
|
15
|
+
# The complete address of the recipient.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :complete
|
18
|
+
# Indicates if the recipient's address is a change of address.
|
19
|
+
# @return [Boolean]
|
20
|
+
attr_reader :is_address_change
|
21
|
+
# The postal code of the recipient's address.
|
22
|
+
# @return [String]
|
23
|
+
attr_reader :postal_code
|
24
|
+
# The private mailbox number of the recipient's address.
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :private_mailbox_number
|
27
|
+
# Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
|
28
|
+
# @return [String]
|
29
|
+
attr_reader :state
|
30
|
+
# The street of the recipient's address.
|
31
|
+
# @return [String]
|
32
|
+
attr_reader :street
|
33
|
+
# The unit number of the recipient's address.
|
34
|
+
# @return [String]
|
35
|
+
attr_reader :unit
|
36
|
+
|
37
|
+
# @param prediction [Hash]
|
38
|
+
# @param page_id [Integer, nil]
|
39
|
+
def initialize(prediction, page_id)
|
40
|
+
super(prediction, page_id)
|
41
|
+
@city = prediction['city']
|
42
|
+
@complete = prediction['complete']
|
43
|
+
@is_address_change = prediction['is_address_change']
|
44
|
+
@postal_code = prediction['postal_code']
|
45
|
+
@private_mailbox_number = prediction['private_mailbox_number']
|
46
|
+
@state = prediction['state']
|
47
|
+
@street = prediction['street']
|
48
|
+
@unit = prediction['unit']
|
49
|
+
@page_id = page_id
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Hash]
|
53
|
+
def printable_values
|
54
|
+
printable = {}
|
55
|
+
printable[:city] = format_for_display(@city)
|
56
|
+
printable[:complete] = format_for_display(@complete)
|
57
|
+
printable[:is_address_change] = format_for_display(@is_address_change)
|
58
|
+
printable[:postal_code] = format_for_display(@postal_code)
|
59
|
+
printable[:private_mailbox_number] = format_for_display(@private_mailbox_number)
|
60
|
+
printable[:state] = format_for_display(@state)
|
61
|
+
printable[:street] = format_for_display(@street)
|
62
|
+
printable[:unit] = format_for_display(@unit)
|
63
|
+
printable
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Hash]
|
67
|
+
def table_printable_values
|
68
|
+
printable = {}
|
69
|
+
printable[:city] = format_for_display(@city, 15)
|
70
|
+
printable[:complete] = format_for_display(@complete, 35)
|
71
|
+
printable[:is_address_change] = format_for_display(@is_address_change, nil)
|
72
|
+
printable[:postal_code] = format_for_display(@postal_code, nil)
|
73
|
+
printable[:private_mailbox_number] = format_for_display(@private_mailbox_number, nil)
|
74
|
+
printable[:state] = format_for_display(@state, nil)
|
75
|
+
printable[:street] = format_for_display(@street, 25)
|
76
|
+
printable[:unit] = format_for_display(@unit, 15)
|
77
|
+
printable
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [String]
|
81
|
+
def to_table_line
|
82
|
+
printable = table_printable_values
|
83
|
+
out_str = String.new
|
84
|
+
out_str << format('| %- 16s', printable[:city])
|
85
|
+
out_str << format('| %- 36s', printable[:complete])
|
86
|
+
out_str << format('| %- 18s', printable[:is_address_change])
|
87
|
+
out_str << format('| %- 12s', printable[:postal_code])
|
88
|
+
out_str << format('| %- 23s', printable[:private_mailbox_number])
|
89
|
+
out_str << format('| %- 6s', printable[:state])
|
90
|
+
out_str << format('| %- 26s', printable[:street])
|
91
|
+
out_str << format('| %- 16s', printable[:unit])
|
92
|
+
out_str << '|'
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [String]
|
96
|
+
def to_s
|
97
|
+
printable = printable_values
|
98
|
+
out_str = String.new
|
99
|
+
out_str << "\n :City: #{printable[:city]}"
|
100
|
+
out_str << "\n :Complete Address: #{printable[:complete]}"
|
101
|
+
out_str << "\n :Is Address Change: #{printable[:is_address_change]}"
|
102
|
+
out_str << "\n :Postal Code: #{printable[:postal_code]}"
|
103
|
+
out_str << "\n :Private Mailbox Number: #{printable[:private_mailbox_number]}"
|
104
|
+
out_str << "\n :State: #{printable[:state]}"
|
105
|
+
out_str << "\n :Street: #{printable[:street]}"
|
106
|
+
out_str << "\n :Unit: #{printable[:unit]}"
|
107
|
+
out_str
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module US
|
8
|
+
module UsMail
|
9
|
+
# The address of the sender.
|
10
|
+
class UsMailV3SenderAddress < Mindee::Parsing::Standard::FeatureField
|
11
|
+
include Mindee::Parsing::Standard
|
12
|
+
# The city of the sender's address.
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :city
|
15
|
+
# The complete address of the sender.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :complete
|
18
|
+
# The postal code of the sender's address.
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :postal_code
|
21
|
+
# Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
|
22
|
+
# @return [String]
|
23
|
+
attr_reader :state
|
24
|
+
# The street of the sender's address.
|
25
|
+
# @return [String]
|
26
|
+
attr_reader :street
|
27
|
+
|
28
|
+
# @param prediction [Hash]
|
29
|
+
# @param page_id [Integer, nil]
|
30
|
+
def initialize(prediction, page_id)
|
31
|
+
super(prediction, page_id)
|
32
|
+
@city = prediction['city']
|
33
|
+
@complete = prediction['complete']
|
34
|
+
@postal_code = prediction['postal_code']
|
35
|
+
@state = prediction['state']
|
36
|
+
@street = prediction['street']
|
37
|
+
@page_id = page_id
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Hash]
|
41
|
+
def printable_values
|
42
|
+
printable = {}
|
43
|
+
printable[:city] = format_for_display(@city)
|
44
|
+
printable[:complete] = format_for_display(@complete)
|
45
|
+
printable[:postal_code] = format_for_display(@postal_code)
|
46
|
+
printable[:state] = format_for_display(@state)
|
47
|
+
printable[:street] = format_for_display(@street)
|
48
|
+
printable
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [String]
|
52
|
+
def to_s
|
53
|
+
printable = printable_values
|
54
|
+
out_str = String.new
|
55
|
+
out_str << "\n :City: #{printable[:city]}"
|
56
|
+
out_str << "\n :Complete Address: #{printable[:complete]}"
|
57
|
+
out_str << "\n :Postal Code: #{printable[:postal_code]}"
|
58
|
+
out_str << "\n :State: #{printable[:state]}"
|
59
|
+
out_str << "\n :Street: #{printable[:street]}"
|
60
|
+
out_str
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/mindee/product.rb
CHANGED
@@ -13,7 +13,6 @@ require_relative 'product/fr/bank_account_details/bank_account_details_v1'
|
|
13
13
|
require_relative 'product/fr/bank_account_details/bank_account_details_v2'
|
14
14
|
require_relative 'product/fr/bank_statement/bank_statement_v1'
|
15
15
|
require_relative 'product/fr/carte_grise/carte_grise_v1'
|
16
|
-
require_relative 'product/fr/carte_vitale/carte_vitale_v1'
|
17
16
|
require_relative 'product/fr/id_card/id_card_v1'
|
18
17
|
require_relative 'product/fr/id_card/id_card_v2'
|
19
18
|
require_relative 'product/fr/energy_bill/energy_bill_v1'
|
@@ -37,4 +36,5 @@ require_relative 'product/us/bank_check/bank_check_v1'
|
|
37
36
|
require_relative 'product/us/driver_license/driver_license_v1'
|
38
37
|
require_relative 'product/us/healthcare_card/healthcare_card_v1'
|
39
38
|
require_relative 'product/us/us_mail/us_mail_v2'
|
39
|
+
require_relative 'product/us/us_mail/us_mail_v3'
|
40
40
|
require_relative 'product/us/w9/w9_v1'
|
data/lib/mindee/version.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.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindee, SA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marcel
|
@@ -166,7 +166,6 @@ files:
|
|
166
166
|
- docs/code_samples/bill_of_lading_v1_async.txt
|
167
167
|
- docs/code_samples/business_card_v1_async.txt
|
168
168
|
- docs/code_samples/carte_grise_v1.txt
|
169
|
-
- docs/code_samples/carte_vitale_v1.txt
|
170
169
|
- docs/code_samples/cropper_v1.txt
|
171
170
|
- docs/code_samples/custom_v1.txt
|
172
171
|
- docs/code_samples/default.txt
|
@@ -199,6 +198,7 @@ files:
|
|
199
198
|
- docs/code_samples/us_driver_license_v1.txt
|
200
199
|
- docs/code_samples/us_healthcare_cards_v1_async.txt
|
201
200
|
- docs/code_samples/us_mail_v2_async.txt
|
201
|
+
- docs/code_samples/us_mail_v3_async.txt
|
202
202
|
- docs/code_samples/us_w9_v1.txt
|
203
203
|
- docs/code_samples/workflow_execution.txt
|
204
204
|
- docs/cropper_v1.md
|
@@ -224,7 +224,7 @@ files:
|
|
224
224
|
- docs/payslip_fra_v3.md
|
225
225
|
- docs/resume_v1.md
|
226
226
|
- docs/us_healthcare_cards_v1.md
|
227
|
-
- docs/
|
227
|
+
- docs/us_mail_v3.md
|
228
228
|
- docs/us_w9_v1.md
|
229
229
|
- examples/auto_invoice_splitter_extraction.rb
|
230
230
|
- examples/auto_multi_receipts_detector_extraction.rb
|
@@ -260,6 +260,12 @@ files:
|
|
260
260
|
- lib/mindee/input.rb
|
261
261
|
- lib/mindee/input/local_response.rb
|
262
262
|
- lib/mindee/input/sources.rb
|
263
|
+
- lib/mindee/input/sources/base64_input_source.rb
|
264
|
+
- lib/mindee/input/sources/bytes_input_source.rb
|
265
|
+
- lib/mindee/input/sources/file_input_source.rb
|
266
|
+
- lib/mindee/input/sources/local_input_source.rb
|
267
|
+
- lib/mindee/input/sources/path_input_source.rb
|
268
|
+
- lib/mindee/input/sources/url_input_source.rb
|
263
269
|
- lib/mindee/parsing.rb
|
264
270
|
- lib/mindee/parsing/common.rb
|
265
271
|
- lib/mindee/parsing/common/api_response.rb
|
@@ -353,9 +359,6 @@ files:
|
|
353
359
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1.rb
|
354
360
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb
|
355
361
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb
|
356
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb
|
357
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb
|
358
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb
|
359
362
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1.rb
|
360
363
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb
|
361
364
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb
|
@@ -468,6 +471,11 @@ files:
|
|
468
471
|
- lib/mindee/product/us/us_mail/us_mail_v2_page.rb
|
469
472
|
- lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb
|
470
473
|
- lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb
|
474
|
+
- lib/mindee/product/us/us_mail/us_mail_v3.rb
|
475
|
+
- lib/mindee/product/us/us_mail/us_mail_v3_document.rb
|
476
|
+
- lib/mindee/product/us/us_mail/us_mail_v3_page.rb
|
477
|
+
- lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb
|
478
|
+
- lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb
|
471
479
|
- lib/mindee/product/us/w9/w9_v1.rb
|
472
480
|
- lib/mindee/product/us/w9/w9_v1_document.rb
|
473
481
|
- lib/mindee/product/us/w9/w9_v1_page.rb
|
@@ -481,7 +489,7 @@ metadata:
|
|
481
489
|
source_code_uri: https://github.com/mindee/mindee-api-ruby
|
482
490
|
changelog_uri: https://github.com/mindee/mindee-api-ruby/blob/main/CHANGELOG.md
|
483
491
|
rubygems_mfa_required: 'true'
|
484
|
-
post_install_message:
|
492
|
+
post_install_message:
|
485
493
|
rdoc_options: []
|
486
494
|
require_paths:
|
487
495
|
- lib
|
@@ -497,7 +505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
497
505
|
version: '0'
|
498
506
|
requirements: []
|
499
507
|
rubygems_version: 3.1.6
|
500
|
-
signing_key:
|
508
|
+
signing_key:
|
501
509
|
specification_version: 4
|
502
510
|
summary: Mindee API Helper Library for Ruby
|
503
511
|
test_files: []
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../parsing'
|
4
|
-
|
5
|
-
module Mindee
|
6
|
-
module Product
|
7
|
-
module FR
|
8
|
-
module CarteVitale
|
9
|
-
# Carte Vitale API version 1.1 document data.
|
10
|
-
class CarteVitaleV1Document < Mindee::Parsing::Common::Prediction
|
11
|
-
include Mindee::Parsing::Standard
|
12
|
-
# The given name(s) of the card holder.
|
13
|
-
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
14
|
-
attr_reader :given_names
|
15
|
-
# The date the card was issued.
|
16
|
-
# @return [Mindee::Parsing::Standard::DateField]
|
17
|
-
attr_reader :issuance_date
|
18
|
-
# The Social Security Number (Numéro de Sécurité Sociale) of the card holder
|
19
|
-
# @return [Mindee::Parsing::Standard::StringField]
|
20
|
-
attr_reader :social_security
|
21
|
-
# The surname of the card holder.
|
22
|
-
# @return [Mindee::Parsing::Standard::StringField]
|
23
|
-
attr_reader :surname
|
24
|
-
|
25
|
-
# @param prediction [Hash]
|
26
|
-
# @param page_id [Integer, nil]
|
27
|
-
def initialize(prediction, page_id)
|
28
|
-
super()
|
29
|
-
@given_names = []
|
30
|
-
prediction['given_names'].each do |item|
|
31
|
-
@given_names.push(StringField.new(item, page_id))
|
32
|
-
end
|
33
|
-
@issuance_date = DateField.new(prediction['issuance_date'], page_id)
|
34
|
-
@social_security = StringField.new(prediction['social_security'], page_id)
|
35
|
-
@surname = StringField.new(prediction['surname'], page_id)
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return [String]
|
39
|
-
def to_s
|
40
|
-
given_names = @given_names.join("\n #{' ' * 15}")
|
41
|
-
out_str = String.new
|
42
|
-
out_str << "\n:Given Name(s): #{given_names}".rstrip
|
43
|
-
out_str << "\n:Surname: #{@surname}".rstrip
|
44
|
-
out_str << "\n:Social Security Number: #{@social_security}".rstrip
|
45
|
-
out_str << "\n:Issuance Date: #{@issuance_date}".rstrip
|
46
|
-
out_str[1..].to_s
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|