mindee 4.1.2 → 4.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32781169244b37ef1d839e05d09ffc0c58a677b33a3f7266a2a0597e9dc0e114
4
- data.tar.gz: 9d3793675e7bef501031be3f70454c7681b48317bffaf61be576a13c043c5c1a
3
+ metadata.gz: 05c6fc0946b9d844042798b1b01160d5fbbdfa69f7b4a4e02ffb79e062680671
4
+ data.tar.gz: 23bfb847706e7c3d9bb15cd0acae3aa25d33c8fbbd126d8a6db0d55a00cb268c
5
5
  SHA512:
6
- metadata.gz: bb14b3e6a1fe2e52bdc1d93836f0b70f91e0ddf8a3fd667ca68cc2661f145da9e3a070c0d6124d5e9ce916a1e0110abd8723afd43312043c04b2138e311c0372
7
- data.tar.gz: 12a99519ce9fbf03c69aea9651205aa17fdd96ab8bdbd2a54ad1768304baf374c1e3f53d791375ce0f91fe66589d84bf24c3d496dc294212913dd409ce8d6322
6
+ metadata.gz: d693ccee678f81b71efaf221b6a5342e55e826458d345a9d5ae4f2d8644a729be6cd58b50e43481d12b5d8ed46afe02772acdc3c4b7f2fb9442de35e3d971b15
7
+ data.tar.gz: ee173692eff34f62deed6930e703d25996cdaf5910e5ff8a6ec6f771ad366af397122cb45f99a96755f0014a517b226c13f1c5a2af83588d1697f0599425a13f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v4.3.0 - 2025-04-08
4
+ ### Changes
5
+ * :sparkles: add support for Financial Document V1.12
6
+ * :sparkles: add support for Invoices V4.10
7
+ * :sparkles: add support for US Healthcare Cards V1.2
8
+
9
+
10
+ ## v4.2.0 - 2025-03-28
11
+ ### Changes
12
+ * :coffin: remove support for US W9
13
+
14
+
3
15
  ## v4.1.2 - 2025-03-26
4
16
  ### Fixes
5
17
  * :wrench: loosen version restrictions on most dependencies
@@ -18,6 +30,7 @@
18
30
  ### Fixes
19
31
  * :recycle: update CLI syntax for easier product creation
20
32
 
33
+
21
34
  ## v4.0.0 - 2025-02-27
22
35
  ### ¡Breaking Changes!
23
36
  * :boom: drop support for ruby versions < 3.0
data/bin/cli_products.rb CHANGED
@@ -163,10 +163,4 @@ PRODUCTS = {
163
163
  sync: false,
164
164
  async: true,
165
165
  },
166
- "us-w9" => {
167
- description: "W9",
168
- doc_class: Mindee::Product::US::W9::W9V1,
169
- sync: true,
170
- async: false,
171
- },
172
166
  }
@@ -227,6 +227,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
227
227
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
228
228
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
229
229
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
230
+ * **value** (`Float`): the value of the tax. Can be `nil`.
230
231
 
231
232
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
232
233
  structure.
@@ -12,7 +12,7 @@ The Ruby Client Library supports the [Financial Document API](https://platform.m
12
12
  > | Specification | Details |
13
13
  > | ------------------------------ | -------------------------------------------------- |
14
14
  > | Endpoint Name | `financial_document` |
15
- > | Recommended Version | `v1.11` |
15
+ > | Recommended Version | `v1.12` |
16
16
  > | Supports Polling/Webhooks | ✔️ Yes |
17
17
  > | Support Synchronous HTTP Calls | ✔️ Yes |
18
18
  > | Geography | 🌐 Global |
@@ -93,7 +93,7 @@ puts result.document
93
93
  ########
94
94
  Document
95
95
  ########
96
- :Mindee ID: f469a24d-3875-4a83-ad43-e0d5aa9da604
96
+ :Mindee ID: a80ac0ee-26f6-4e2e-988a-960b240d5ba7
97
97
  :Filename: default_sample.jpg
98
98
 
99
99
  Inference
@@ -118,7 +118,7 @@ Prediction
118
118
  +---------------+--------+----------+---------------+
119
119
  | Base | Code | Rate (%) | Amount |
120
120
  +===============+========+==========+===============+
121
- | | | 5.00 | 9.75 |
121
+ | 195.00 | | 5.00 | 9.75 |
122
122
  +---------------+--------+----------+---------------+
123
123
  :Supplier Payment Details:
124
124
  :Supplier Name: JOHN SMITH
@@ -170,7 +170,7 @@ Page 0
170
170
  +---------------+--------+----------+---------------+
171
171
  | Base | Code | Rate (%) | Amount |
172
172
  +===============+========+==========+===============+
173
- | | | 5.00 | 9.75 |
173
+ | 195.00 | | 5.00 | 9.75 |
174
174
  +---------------+--------+----------+---------------+
175
175
  :Supplier Payment Details:
176
176
  :Supplier Name: JOHN SMITH
@@ -272,6 +272,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
272
272
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
273
273
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
274
274
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
275
+ * **value** (`Float`): the value of the tax. Can be `nil`.
275
276
 
276
277
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
277
278
  structure.
@@ -381,6 +382,24 @@ puts result.document.inference.prediction.document_number.value
381
382
  puts result.document.inference.prediction.document_type.value
382
383
  ```
383
384
 
385
+ ## Document Type Extended
386
+ **document_type_extended** ([ClassificationField](#classification-field)): Document type extended.
387
+
388
+ #### Possible values include:
389
+ - 'CREDIT NOTE'
390
+ - 'INVOICE'
391
+ - 'OTHER'
392
+ - 'OTHER_FINANCIAL'
393
+ - 'PAYSLIP'
394
+ - 'PURCHASE ORDER'
395
+ - 'QUOTE'
396
+ - 'RECEIPT'
397
+ - 'STATEMENT'
398
+
399
+ ```rb
400
+ puts result.document.inference.prediction.document_type_extended.value
401
+ ```
402
+
384
403
  ## Due Date
385
404
  **due_date** ([DateField](#date-field)): The date on which the payment is due.
386
405
 
@@ -12,7 +12,7 @@ The Ruby Client Library supports the [Invoice API](https://platform.mindee.com/m
12
12
  > | Specification | Details |
13
13
  > | ------------------------------ | -------------------------------------------------- |
14
14
  > | Endpoint Name | `invoices` |
15
- > | Recommended Version | `v4.9` |
15
+ > | Recommended Version | `v4.10` |
16
16
  > | Supports Polling/Webhooks | ✔️ Yes |
17
17
  > | Support Synchronous HTTP Calls | ✔️ Yes |
18
18
  > | Geography | 🌐 Global |
@@ -93,7 +93,7 @@ puts result.document
93
93
  ########
94
94
  Document
95
95
  ########
96
- :Mindee ID: 86b1833f-138b-4a01-8387-860204b0e631
96
+ :Mindee ID: b55db8f9-ae3b-4f05-b2f1-ec0ced5e5b70
97
97
  :Filename: default_sample.jpg
98
98
 
99
99
  Inference
@@ -117,7 +117,7 @@ Prediction
117
117
  +---------------+--------+----------+---------------+
118
118
  | Base | Code | Rate (%) | Amount |
119
119
  +===============+========+==========+===============+
120
- | | | 8.00 | 193.20 |
120
+ | 2145.00 | | 8.00 | 193.20 |
121
121
  +---------------+--------+----------+---------------+
122
122
  :Supplier Payment Details:
123
123
  :Supplier Name: TURNPIKE DESIGNS
@@ -163,7 +163,7 @@ Page 0
163
163
  +---------------+--------+----------+---------------+
164
164
  | Base | Code | Rate (%) | Amount |
165
165
  +===============+========+==========+===============+
166
- | | | 8.00 | 193.20 |
166
+ | 2145.00 | | 8.00 | 193.20 |
167
167
  +---------------+--------+----------+---------------+
168
168
  :Supplier Payment Details:
169
169
  :Supplier Name: TURNPIKE DESIGNS
@@ -260,6 +260,7 @@ Aside from the basic `Field` attributes, the tax field `TaxField` also implement
260
260
  * **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
261
261
  * **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
262
262
  * **base** (`Float`): base amount used for the tax. Can be `nil`.
263
+ * **value** (`Float`): the value of the tax. Can be `nil`.
263
264
 
264
265
  > Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
265
266
  structure.
@@ -343,6 +344,24 @@ puts result.document.inference.prediction.date.value
343
344
  puts result.document.inference.prediction.document_type.value
344
345
  ```
345
346
 
347
+ ## Document Type Extended
348
+ **document_type_extended** ([ClassificationField](#classification-field)): Document type extended.
349
+
350
+ #### Possible values include:
351
+ - 'CREDIT NOTE'
352
+ - 'INVOICE'
353
+ - 'OTHER'
354
+ - 'OTHER_FINANCIAL'
355
+ - 'PAYSLIP'
356
+ - 'PURCHASE ORDER'
357
+ - 'QUOTE'
358
+ - 'RECEIPT'
359
+ - 'STATEMENT'
360
+
361
+ ```rb
362
+ puts result.document.inference.prediction.document_type_extended.value
363
+ ```
364
+
346
365
  ## Due Date
347
366
  **due_date** ([DateField](#date-field)): The date on which the payment is due.
348
367
 
@@ -12,7 +12,7 @@ The Ruby Client Library supports the [Healthcare Card API](https://platform.mind
12
12
  > | Specification | Details |
13
13
  > | ------------------------------ | -------------------------------------------------- |
14
14
  > | Endpoint Name | `us_healthcare_cards` |
15
- > | Recommended Version | `v1.1` |
15
+ > | Recommended Version | `v1.2` |
16
16
  > | Supports Polling/Webhooks | ✔️ Yes |
17
17
  > | Support Synchronous HTTP Calls | ❌ No |
18
18
  > | Geography | 🇺🇸 United States |
@@ -138,6 +138,15 @@ A `HealthcareCardV1Copay` implements the following attributes:
138
138
  * `service_fees` (Float): The price of service.
139
139
  * `service_name` (String): The name of service of the copay.
140
140
 
141
+ #### Possible values include:
142
+ - primary_care
143
+ - emergency_room
144
+ - urgent_care
145
+ - specialist
146
+ - office_visit
147
+ - prescription
148
+
149
+
141
150
  # Attributes
142
151
  The following fields are extracted for Healthcare Card V1:
143
152
 
@@ -222,6 +231,13 @@ puts result.document.inference.prediction.rx_bin.value
222
231
  puts result.document.inference.prediction.rx_grp.value
223
232
  ```
224
233
 
234
+ ## RX ID
235
+ **rx_id** ([StringField](#string-field)): The ID number for prescription drug coverage.
236
+
237
+ ```rb
238
+ puts result.document.inference.prediction.rx_id.value
239
+ ```
240
+
225
241
  ## RX PCN
226
242
  **rx_pcn** ([StringField](#string-field)): The PCN number for prescription drug coverage.
227
243
 
@@ -6,7 +6,7 @@ require_relative 'financial_document_v1_line_items'
6
6
  module Mindee
7
7
  module Product
8
8
  module FinancialDocument
9
- # Financial Document API version 1.11 document data.
9
+ # Financial Document API version 1.12 document data.
10
10
  class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
11
11
  include Mindee::Parsing::Standard
12
12
  # The customer's address used for billing.
@@ -37,6 +37,9 @@ module Mindee
37
37
  # RECEIPT if it is a receipt.
38
38
  # @return [Mindee::Parsing::Standard::ClassificationField]
39
39
  attr_reader :document_type
40
+ # Document type extended.
41
+ # @return [Mindee::Parsing::Standard::ClassificationField]
42
+ attr_reader :document_type_extended
40
43
  # The date on which the payment is due.
41
44
  # @return [Mindee::Parsing::Standard::DateField]
42
45
  attr_reader :due_date
@@ -144,6 +147,10 @@ module Mindee
144
147
  prediction['document_type'],
145
148
  page_id
146
149
  )
150
+ @document_type_extended = Parsing::Standard::ClassificationField.new(
151
+ prediction['document_type_extended'],
152
+ page_id
153
+ )
147
154
  @due_date = Parsing::Standard::DateField.new(
148
155
  prediction['due_date'],
149
156
  page_id
@@ -262,6 +269,7 @@ module Mindee
262
269
  out_str << "\n:Shipping Address: #{@shipping_address}".rstrip
263
270
  out_str << "\n:Billing Address: #{@billing_address}".rstrip
264
271
  out_str << "\n:Document Type: #{@document_type}".rstrip
272
+ out_str << "\n:Document Type Extended: #{@document_type_extended}".rstrip
265
273
  out_str << "\n:Purchase Subcategory: #{@subcategory}".rstrip
266
274
  out_str << "\n:Purchase Category: #{@category}".rstrip
267
275
  out_str << "\n:Total Tax: #{@total_tax}".rstrip
@@ -6,7 +6,7 @@ require_relative 'financial_document_v1_document'
6
6
  module Mindee
7
7
  module Product
8
8
  module FinancialDocument
9
- # Financial Document API version 1.11 page data.
9
+ # Financial Document API version 1.12 page data.
10
10
  class FinancialDocumentV1Page < Mindee::Parsing::Common::Page
11
11
  # @param prediction [Hash]
12
12
  def initialize(prediction)
@@ -6,7 +6,7 @@ require_relative 'invoice_v4_line_items'
6
6
  module Mindee
7
7
  module Product
8
8
  module Invoice
9
- # Invoice API version 4.9 document data.
9
+ # Invoice API version 4.10 document data.
10
10
  class InvoiceV4Document < Mindee::Parsing::Common::Prediction
11
11
  include Mindee::Parsing::Standard
12
12
  # The customer billing address.
@@ -30,6 +30,9 @@ module Mindee
30
30
  # Document type: INVOICE or CREDIT NOTE.
31
31
  # @return [Mindee::Parsing::Standard::ClassificationField]
32
32
  attr_reader :document_type
33
+ # Document type extended.
34
+ # @return [Mindee::Parsing::Standard::ClassificationField]
35
+ attr_reader :document_type_extended
33
36
  # The date on which the payment is due.
34
37
  # @return [Mindee::Parsing::Standard::DateField]
35
38
  attr_reader :due_date
@@ -117,6 +120,10 @@ module Mindee
117
120
  prediction['document_type'],
118
121
  page_id
119
122
  )
123
+ @document_type_extended = Parsing::Standard::ClassificationField.new(
124
+ prediction['document_type_extended'],
125
+ page_id
126
+ )
120
127
  @due_date = Parsing::Standard::DateField.new(
121
128
  prediction['due_date'],
122
129
  page_id
@@ -222,6 +229,7 @@ module Mindee
222
229
  out_str << "\n:Shipping Address: #{@shipping_address}".rstrip
223
230
  out_str << "\n:Billing Address: #{@billing_address}".rstrip
224
231
  out_str << "\n:Document Type: #{@document_type}".rstrip
232
+ out_str << "\n:Document Type Extended: #{@document_type_extended}".rstrip
225
233
  out_str << "\n:Line Items:"
226
234
  out_str << line_items
227
235
  out_str[1..].to_s
@@ -6,7 +6,7 @@ require_relative 'invoice_v4_document'
6
6
  module Mindee
7
7
  module Product
8
8
  module Invoice
9
- # Invoice API version 4.9 page data.
9
+ # Invoice API version 4.10 page data.
10
10
  class InvoiceV4Page < Mindee::Parsing::Common::Page
11
11
  # @param prediction [Hash]
12
12
  def initialize(prediction)
@@ -39,7 +39,7 @@ module Mindee
39
39
  printable = {}
40
40
  printable[:service_fees] =
41
41
  @service_fees.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@service_fees)
42
- printable[:service_name] = format_for_display(@service_name, nil)
42
+ printable[:service_name] = format_for_display(@service_name, 20)
43
43
  printable
44
44
  end
45
45
 
@@ -48,7 +48,7 @@ module Mindee
48
48
  printable = table_printable_values
49
49
  out_str = String.new
50
50
  out_str << format('| %- 13s', printable[:service_fees])
51
- out_str << format('| %- 13s', printable[:service_name])
51
+ out_str << format('| %- 21s', printable[:service_name])
52
52
  out_str << '|'
53
53
  end
54
54
 
@@ -27,7 +27,7 @@ module Mindee
27
27
  def self.line_items_separator(char)
28
28
  out_str = String.new
29
29
  out_str << "+#{char * 14}"
30
- out_str << "+#{char * 14}"
30
+ out_str << "+#{char * 22}"
31
31
  out_str
32
32
  end
33
33
 
@@ -41,7 +41,7 @@ module Mindee
41
41
  out_str = String.new
42
42
  out_str << ("\n#{self.class.line_items_separator('-')}\n ")
43
43
  out_str << ' | Service Fees'
44
- out_str << ' | Service Name'
44
+ out_str << ' | Service Name '
45
45
  out_str << (" |\n#{self.class.line_items_separator('=')}")
46
46
  out_str + lines
47
47
  end
@@ -7,7 +7,7 @@ module Mindee
7
7
  module Product
8
8
  module US
9
9
  module HealthcareCard
10
- # Healthcare Card API version 1.1 document data.
10
+ # Healthcare Card API version 1.2 document data.
11
11
  class HealthcareCardV1Document < Mindee::Parsing::Common::Prediction
12
12
  include Mindee::Parsing::Standard
13
13
  # The name of the company that provides the healthcare plan.
@@ -43,6 +43,9 @@ module Mindee
43
43
  # The group number for prescription drug coverage.
44
44
  # @return [Mindee::Parsing::Standard::StringField]
45
45
  attr_reader :rx_grp
46
+ # The ID number for prescription drug coverage.
47
+ # @return [Mindee::Parsing::Standard::StringField]
48
+ attr_reader :rx_id
46
49
  # The PCN number for prescription drug coverage.
47
50
  # @return [Mindee::Parsing::Standard::StringField]
48
51
  attr_reader :rx_pcn
@@ -92,6 +95,7 @@ module Mindee
92
95
  prediction['rx_grp'],
93
96
  page_id
94
97
  )
98
+ @rx_id = Parsing::Standard::StringField.new(prediction['rx_id'], page_id)
95
99
  @rx_pcn = Parsing::Standard::StringField.new(
96
100
  prediction['rx_pcn'],
97
101
  page_id
@@ -111,6 +115,7 @@ module Mindee
111
115
  out_str << "\n:Group Number: #{@group_number}".rstrip
112
116
  out_str << "\n:Payer ID: #{@payer_id}".rstrip
113
117
  out_str << "\n:RX BIN: #{@rx_bin}".rstrip
118
+ out_str << "\n:RX ID: #{@rx_id}".rstrip
114
119
  out_str << "\n:RX GRP: #{@rx_grp}".rstrip
115
120
  out_str << "\n:RX PCN: #{@rx_pcn}".rstrip
116
121
  out_str << "\n:copays:"
@@ -127,7 +132,7 @@ module Mindee
127
132
  out_str = String.new
128
133
  out_str << ' '
129
134
  out_str << "+#{char * 14}"
130
- out_str << "+#{char * 14}"
135
+ out_str << "+#{char * 22}"
131
136
  out_str << '+'
132
137
  out_str
133
138
  end
@@ -141,7 +146,7 @@ module Mindee
141
146
  out_str << "\n#{copays_separator('-')}"
142
147
  out_str << "\n |"
143
148
  out_str << ' Service Fees |'
144
- out_str << ' Service Name |'
149
+ out_str << ' Service Name |'
145
150
  out_str << "\n#{copays_separator('=')}"
146
151
  out_str << "\n #{line_items}"
147
152
  out_str << "\n#{copays_separator('-')}"
@@ -7,7 +7,7 @@ module Mindee
7
7
  module Product
8
8
  module US
9
9
  module HealthcareCard
10
- # Healthcare Card API version 1.1 page data.
10
+ # Healthcare Card API version 1.2 page data.
11
11
  class HealthcareCardV1Page < Mindee::Parsing::Common::Page
12
12
  # @param prediction [Hash]
13
13
  def initialize(prediction)
@@ -31,4 +31,3 @@ require_relative 'product/us/bank_check/bank_check_v1'
31
31
  require_relative 'product/us/healthcare_card/healthcare_card_v1'
32
32
  require_relative 'product/us/us_mail/us_mail_v2'
33
33
  require_relative 'product/us/us_mail/us_mail_v3'
34
- require_relative 'product/us/w9/w9_v1'
@@ -3,7 +3,7 @@
3
3
  # Mindee
4
4
  module Mindee
5
5
  # Current version.
6
- VERSION = '4.1.2'
6
+ VERSION = '4.3.0'
7
7
 
8
8
  # Finds and return the current platform.
9
9
  # @return [Symbol, Hash[Symbol | String, Regexp], Nil?]
@@ -14,6 +14,7 @@ module Mindee
14
14
  def date: -> (Parsing::Standard::DateField)
15
15
  def document_number: -> (Parsing::Standard::StringField)
16
16
  def document_type: -> (Parsing::Standard::ClassificationField)
17
+ def document_type_extended: -> (Parsing::Standard::ClassificationField)
17
18
  def due_date: -> (Parsing::Standard::DateField)
18
19
  def invoice_number: -> (Parsing::Standard::StringField)
19
20
  def line_items: -> (Product::FinancialDocument::FinancialDocumentV1LineItems)
@@ -12,6 +12,7 @@ module Mindee
12
12
  def customer_name: -> (Parsing::Standard::StringField)
13
13
  def date: -> (Parsing::Standard::DateField)
14
14
  def document_type: -> (Parsing::Standard::ClassificationField)
15
+ def document_type_extended: -> (Parsing::Standard::ClassificationField)
15
16
  def due_date: -> (Parsing::Standard::DateField)
16
17
  def invoice_number: -> (Parsing::Standard::StringField)
17
18
  def line_items: -> (Product::Invoice::InvoiceV4LineItems)
@@ -17,6 +17,7 @@ module Mindee
17
17
  def payer_id: -> (Parsing::Standard::StringField)
18
18
  def rx_bin: -> (Parsing::Standard::StringField)
19
19
  def rx_grp: -> (Parsing::Standard::StringField)
20
+ def rx_id: -> (Parsing::Standard::StringField)
20
21
  def rx_pcn: -> (Parsing::Standard::StringField)
21
22
  def copays_separator: (String) -> String
22
23
  def copays_to_s: -> String
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: 4.1.2
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindee, SA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -245,7 +245,6 @@ files:
245
245
  - docs/code_samples/us_healthcare_cards_v1_async.txt
246
246
  - docs/code_samples/us_mail_v2_async.txt
247
247
  - docs/code_samples/us_mail_v3_async.txt
248
- - docs/code_samples/us_w9_v1.txt
249
248
  - docs/code_samples/workflow_execution.txt
250
249
  - docs/getting_started.md
251
250
  - docs/global_products.md
@@ -278,7 +277,6 @@ files:
278
277
  - docs/localized_products/payslip_fra_v3.md
279
278
  - docs/localized_products/us_healthcare_cards_v1.md
280
279
  - docs/localized_products/us_mail_v3.md
281
- - docs/localized_products/us_w9_v1.md
282
280
  - examples/auto_invoice_splitter_extraction.rb
283
281
  - examples/auto_multi_receipts_detector_extraction.rb
284
282
  - lib/mindee.rb
@@ -535,9 +533,6 @@ files:
535
533
  - lib/mindee/product/us/us_mail/us_mail_v3_recipient_address.rb
536
534
  - lib/mindee/product/us/us_mail/us_mail_v3_recipient_addresses.rb
537
535
  - lib/mindee/product/us/us_mail/us_mail_v3_sender_address.rb
538
- - lib/mindee/product/us/w9/w9_v1.rb
539
- - lib/mindee/product/us/w9/w9_v1_document.rb
540
- - lib/mindee/product/us/w9/w9_v1_page.rb
541
536
  - lib/mindee/version.rb
542
537
  - mindee.gemspec
543
538
  - sig/custom/marcel.rbs
@@ -1,21 +0,0 @@
1
- #
2
- # Install the Ruby client library by running:
3
- # gem install mindee
4
- #
5
-
6
- require 'mindee'
7
-
8
- # Init a new client
9
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
10
-
11
- # Load a file from disk
12
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
13
-
14
- # Parse the file
15
- result = mindee_client.parse(
16
- input_source,
17
- Mindee::Product::US::W9::W9V1
18
- )
19
-
20
- # Print a full summary of the parsed data in RST format
21
- puts result.document
@@ -1,230 +0,0 @@
1
- ---
2
- title: US W9
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-us-w9-ocr
5
- parentDoc: 67b49e29a2cd6f08d69a40d8
6
- ---
7
- The Ruby Client Library supports the [W9 API](https://platform.mindee.com/mindee/us_w9).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `us_w9` |
15
- > | Recommended Version | `v1.0` |
16
- > | Supports Polling/Webhooks | ❌ No |
17
- > | Support Synchronous HTTP Calls | ✔️ Yes |
18
- > | Geography | 🇺🇸 United States |
19
-
20
-
21
- Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_w9/default_sample.jpg),
22
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
23
- ![W9 sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_w9/default_sample.jpg?raw=true)
24
-
25
- # Quick-Start
26
- ```rb
27
- #
28
- # Install the Ruby client library by running:
29
- # gem install mindee
30
- #
31
-
32
- require 'mindee'
33
-
34
- # Init a new client
35
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
36
-
37
- # Load a file from disk
38
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
39
-
40
- # Parse the file
41
- result = mindee_client.parse(
42
- input_source,
43
- Mindee::Product::US::W9::W9V1
44
- )
45
-
46
- # Print a full summary of the parsed data in RST format
47
- puts result.document
48
- ```
49
-
50
- **Output (RST):**
51
- ```rst
52
- ########
53
- Document
54
- ########
55
- :Mindee ID: d7c5b25f-e0d3-4491-af54-6183afa1aaab
56
- :Filename: default_sample.jpg
57
-
58
- Inference
59
- #########
60
- :Product: mindee/us_w9 v1.0
61
- :Rotation applied: Yes
62
-
63
- Prediction
64
- ==========
65
-
66
- Page Predictions
67
- ================
68
-
69
- Page 0
70
- ------
71
- :Name: Stephen W Hawking
72
- :SSN: 560758145
73
- :Address: Somewhere In Milky Way
74
- :City State Zip: Probably Still At Cambridge P O Box CB1
75
- :Business Name:
76
- :EIN: 942203664
77
- :Tax Classification: individual
78
- :Tax Classification Other Details:
79
- :W9 Revision Date: august 2013
80
- :Signature Position: Polygon with 4 points.
81
- :Signature Date Position:
82
- :Tax Classification LLC:
83
- ```
84
-
85
- # Field Types
86
- ## Standard Fields
87
- These fields are generic and used in several products.
88
-
89
- ### Basic Field
90
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
91
- A typical `Field` object will have the following attributes:
92
-
93
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
94
- * **confidence** (Float, nil): the confidence score of the field prediction.
95
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
96
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
97
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
98
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
99
-
100
-
101
- Aside from the previous attributes, all basic fields have access to a `to_s` method that can be used to print their value as a string.
102
-
103
-
104
- ### Position Field
105
- The position field `PositionField` does not implement all the basic `Field` attributes, only **bounding_box**,
106
- **polygon** and **page_id**. On top of these, it has access to:
107
-
108
- * **rectangle** (`Mindee::Geometry::Quadrilateral`): a Polygon with four points that may be oriented (even beyond
109
- canvas).
110
- * **quadrangle** (`Mindee::Geometry::Quadrilateral`): a free polygon made up of four points.
111
-
112
- ### String Field
113
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
114
-
115
- ## Page-Level Fields
116
- Some fields are constrained to the page level, and so will not be retrievable at document level.
117
-
118
- # Attributes
119
- The following fields are extracted for W9 V1:
120
-
121
- ## Address
122
- [📄](#page-level-fields "This field is only present on individual pages.")**address** ([StringField](#string-field)): The street address (number, street, and apt. or suite no.) of the applicant.
123
-
124
- ```rb
125
- result.document.address.each do |address_elem|
126
- puts address_elem.value
127
- end
128
- ```
129
-
130
- ## Business Name
131
- [📄](#page-level-fields "This field is only present on individual pages.")**business_name** ([StringField](#string-field)): The business name or disregarded entity name, if different from Name.
132
-
133
- ```rb
134
- result.document.business_name.each do |business_name_elem|
135
- puts business_name_elem.value
136
- end
137
- ```
138
-
139
- ## City State Zip
140
- [📄](#page-level-fields "This field is only present on individual pages.")**city_state_zip** ([StringField](#string-field)): The city, state, and ZIP code of the applicant.
141
-
142
- ```rb
143
- result.document.city_state_zip.each do |city_state_zip_elem|
144
- puts city_state_zip_elem.value
145
- end
146
- ```
147
-
148
- ## EIN
149
- [📄](#page-level-fields "This field is only present on individual pages.")**ein** ([StringField](#string-field)): The employer identification number.
150
-
151
- ```rb
152
- result.document.ein.each do |ein_elem|
153
- puts ein_elem.value
154
- end
155
- ```
156
-
157
- ## Name
158
- [📄](#page-level-fields "This field is only present on individual pages.")**name** ([StringField](#string-field)): Name as shown on the applicant's income tax return.
159
-
160
- ```rb
161
- result.document.name.each do |name_elem|
162
- puts name_elem.value
163
- end
164
- ```
165
-
166
- ## Signature Date Position
167
- [📄](#page-level-fields "This field is only present on individual pages.")**signature_date_position** ([PositionField](#position-field)): Position of the signature date on the document.
168
-
169
- ```rb
170
- result.document.signature_date_position.each do |signature_date_position_elem|
171
- puts signature_date_position_elem.polygon
172
- end
173
- ```
174
-
175
- ## Signature Position
176
- [📄](#page-level-fields "This field is only present on individual pages.")**signature_position** ([PositionField](#position-field)): Position of the signature on the document.
177
-
178
- ```rb
179
- result.document.signature_position.each do |signature_position_elem|
180
- puts signature_position_elem.polygon
181
- end
182
- ```
183
-
184
- ## SSN
185
- [📄](#page-level-fields "This field is only present on individual pages.")**ssn** ([StringField](#string-field)): The applicant's social security number.
186
-
187
- ```rb
188
- result.document.ssn.each do |ssn_elem|
189
- puts ssn_elem.value
190
- end
191
- ```
192
-
193
- ## Tax Classification
194
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification** ([StringField](#string-field)): The federal tax classification, which can vary depending on the revision date.
195
-
196
- ```rb
197
- result.document.tax_classification.each do |tax_classification_elem|
198
- puts tax_classification_elem.value
199
- end
200
- ```
201
-
202
- ## Tax Classification LLC
203
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification_llc** ([StringField](#string-field)): Depending on revision year, among S, C, P or D for Limited Liability Company Classification.
204
-
205
- ```rb
206
- result.document.tax_classification_llc.each do |tax_classification_llc_elem|
207
- puts tax_classification_llc_elem.value
208
- end
209
- ```
210
-
211
- ## Tax Classification Other Details
212
- [📄](#page-level-fields "This field is only present on individual pages.")**tax_classification_other_details** ([StringField](#string-field)): Tax Classification Other Details.
213
-
214
- ```rb
215
- result.document.tax_classification_other_details.each do |tax_classification_other_details_elem|
216
- puts tax_classification_other_details_elem.value
217
- end
218
- ```
219
-
220
- ## W9 Revision Date
221
- [📄](#page-level-fields "This field is only present on individual pages.")**w9_revision_date** ([StringField](#string-field)): The Revision month and year of the W9 form.
222
-
223
- ```rb
224
- result.document.w9_revision_date.each do |w9_revision_date_elem|
225
- puts w9_revision_date_elem.value
226
- end
227
- ```
228
-
229
- # Questions?
230
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'w9_v1_document'
5
- require_relative 'w9_v1_page'
6
-
7
- module Mindee
8
- module Product
9
- module US
10
- # W9 module.
11
- module W9
12
- # W9 API version 1 inference prediction.
13
- class W9V1 < Mindee::Parsing::Common::Inference
14
- @endpoint_name = 'us_w9'
15
- @endpoint_version = '1'
16
- @has_async = false
17
- @has_sync = true
18
-
19
- # @param prediction [Hash]
20
- def initialize(prediction)
21
- super
22
- @prediction = W9V1Document.new(prediction['prediction'], nil)
23
- @pages = []
24
- prediction['pages'].each do |page|
25
- @pages.push(W9V1Page.new(page))
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
- # Whether this product has access to an asynchronous endpoint.
37
- # @return [bool]
38
- attr_reader :has_async
39
- # Whether this product has access to synchronous endpoint.
40
- # @return [bool]
41
- attr_reader :has_sync
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module Product
7
- module US
8
- module W9
9
- # W9 API version 1.0 document data.
10
- class W9V1Document < Mindee::Parsing::Common::Prediction
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,133 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'w9_v1_document'
5
-
6
- module Mindee
7
- module Product
8
- module US
9
- module W9
10
- # W9 API version 1.0 page data.
11
- class W9V1Page < Mindee::Parsing::Common::Page
12
- # @param prediction [Hash]
13
- def initialize(prediction)
14
- super
15
- @prediction = if prediction['prediction'].empty?
16
- nil
17
- else
18
- W9V1PagePrediction.new(
19
- prediction['prediction'],
20
- prediction['id']
21
- )
22
- end
23
- end
24
- end
25
-
26
- # W9 V1 page prediction.
27
- class W9V1PagePrediction < W9V1Document
28
- include Mindee::Parsing::Standard
29
-
30
- # The street address (number, street, and apt. or suite no.) of the applicant.
31
- # @return [Mindee::Parsing::Standard::StringField]
32
- attr_reader :address
33
- # The business name or disregarded entity name, if different from Name.
34
- # @return [Mindee::Parsing::Standard::StringField]
35
- attr_reader :business_name
36
- # The city, state, and ZIP code of the applicant.
37
- # @return [Mindee::Parsing::Standard::StringField]
38
- attr_reader :city_state_zip
39
- # The employer identification number.
40
- # @return [Mindee::Parsing::Standard::StringField]
41
- attr_reader :ein
42
- # Name as shown on the applicant's income tax return.
43
- # @return [Mindee::Parsing::Standard::StringField]
44
- attr_reader :name
45
- # Position of the signature date on the document.
46
- # @return [Mindee::Parsing::Standard::PositionField]
47
- attr_reader :signature_date_position
48
- # Position of the signature on the document.
49
- # @return [Mindee::Parsing::Standard::PositionField]
50
- attr_reader :signature_position
51
- # The applicant's social security number.
52
- # @return [Mindee::Parsing::Standard::StringField]
53
- attr_reader :ssn
54
- # The federal tax classification, which can vary depending on the revision date.
55
- # @return [Mindee::Parsing::Standard::StringField]
56
- attr_reader :tax_classification
57
- # Depending on revision year, among S, C, P or D for Limited Liability Company Classification.
58
- # @return [Mindee::Parsing::Standard::StringField]
59
- attr_reader :tax_classification_llc
60
- # Tax Classification Other Details.
61
- # @return [Mindee::Parsing::Standard::StringField]
62
- attr_reader :tax_classification_other_details
63
- # The Revision month and year of the W9 form.
64
- # @return [Mindee::Parsing::Standard::StringField]
65
- attr_reader :w9_revision_date
66
-
67
- # @param prediction [Hash]
68
- # @param page_id [Integer, nil]
69
- def initialize(prediction, page_id)
70
- @address = Parsing::Standard::StringField.new(
71
- prediction['address'],
72
- page_id
73
- )
74
- @business_name = Parsing::Standard::StringField.new(
75
- prediction['business_name'],
76
- page_id
77
- )
78
- @city_state_zip = Parsing::Standard::StringField.new(
79
- prediction['city_state_zip'],
80
- page_id
81
- )
82
- @ein = Parsing::Standard::StringField.new(prediction['ein'], page_id)
83
- @name = Parsing::Standard::StringField.new(prediction['name'], page_id)
84
- @signature_date_position = Parsing::Standard::PositionField.new(
85
- prediction['signature_date_position'],
86
- page_id
87
- )
88
- @signature_position = Parsing::Standard::PositionField.new(
89
- prediction['signature_position'],
90
- page_id
91
- )
92
- @ssn = Parsing::Standard::StringField.new(prediction['ssn'], page_id)
93
- @tax_classification = Parsing::Standard::StringField.new(
94
- prediction['tax_classification'],
95
- page_id
96
- )
97
- @tax_classification_llc = Parsing::Standard::StringField.new(
98
- prediction['tax_classification_llc'],
99
- page_id
100
- )
101
- @tax_classification_other_details = Parsing::Standard::StringField.new(
102
- prediction['tax_classification_other_details'],
103
- page_id
104
- )
105
- @w9_revision_date = Parsing::Standard::StringField.new(
106
- prediction['w9_revision_date'],
107
- page_id
108
- )
109
- super
110
- end
111
-
112
- # @return [String]
113
- def to_s
114
- out_str = String.new
115
- out_str << "\n:Name: #{@name}".rstrip
116
- out_str << "\n:SSN: #{@ssn}".rstrip
117
- out_str << "\n:Address: #{@address}".rstrip
118
- out_str << "\n:City State Zip: #{@city_state_zip}".rstrip
119
- out_str << "\n:Business Name: #{@business_name}".rstrip
120
- out_str << "\n:EIN: #{@ein}".rstrip
121
- out_str << "\n:Tax Classification: #{@tax_classification}".rstrip
122
- out_str << "\n:Tax Classification Other Details: #{@tax_classification_other_details}".rstrip
123
- out_str << "\n:W9 Revision Date: #{@w9_revision_date}".rstrip
124
- out_str << "\n:Signature Position: #{@signature_position}".rstrip
125
- out_str << "\n:Signature Date Position: #{@signature_date_position}".rstrip
126
- out_str << "\n:Tax Classification LLC: #{@tax_classification_llc}".rstrip
127
- out_str
128
- end
129
- end
130
- end
131
- end
132
- end
133
- end