mindee 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba0a25a68b96ba432920774b10de815c3dbf89386d9e74ea22b13fc36535e50a
4
- data.tar.gz: a4f6f9d5da64be2c83ecdd32fdc6f8322998c470c1f94a099dff417ac9419671
3
+ metadata.gz: 9c6039978a362b6a5faab3b92fb4ef24fd9cbf85060f66614b007b371d851843
4
+ data.tar.gz: 4aa9ef461ee5fcc19f483dde6f584c583390e53ebba1889d5283b1864a26169c
5
5
  SHA512:
6
- metadata.gz: f7af6e145ded009966a409c35bc7058158532cee1cc927486b1b05a003a3c8238968305ee4e546cc354abb3b78a5bc45caf4379b1e586bdcf61d800a766368b6
7
- data.tar.gz: 591c6e87b9fcdc25b88bf3da8f6fd38c950fb9b03c6aeb096a14bc1f0da9dbf458c7445f137cbc27cef823126472b03653960ba741ea30083642da443f9f523a
6
+ metadata.gz: 226aa7601ad8b1a80dc6fb1071ad655a9aae647d70118184d0ada431b314503eb3f6157abdc59eb0205e157c3d7d8cc501ceb26258690ed9ad038b4d41336f93
7
+ data.tar.gz: a1d215cb0834ded50c9bcb913d2cf074d7e711ec73aaa67380705c71d51e29b6c15a162fa7afcadcab027954831155fdf065563cee1ce2aa0a7b300359cd7421
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v3.3.1 - 2023-12-15
4
+ ### Changes
5
+ * :recycle: tweak async delays & retry
6
+ * :recycle: tweak default async sample delays & retry
7
+ * :memo: update md doc & fix typos
8
+
9
+
3
10
  ## v3.3.0 - 2023-11-17
4
11
  ### Changes
5
12
  * :sparkles: add support for Carte Grise V1
@@ -81,7 +81,7 @@ A typical `Field` object will have the following attributes:
81
81
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
82
82
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
83
83
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
84
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
84
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
85
85
 
86
86
 
87
87
  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.
@@ -81,7 +81,7 @@ A typical `Field` object will have the following attributes:
81
81
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
82
82
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
83
83
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
84
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
84
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
85
85
 
86
86
 
87
87
  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.
@@ -170,7 +170,10 @@ puts result.document.inference.prediction.routing_number.value
170
170
  ```rb
171
171
  for page in result.document.inference.pages do
172
172
  for signatures_positions_elem in page.prediction.signatures_positions do
173
- puts signatures_positions_elem.polygon
173
+ puts signatures_positions_elem.polygon.to_s
174
+ puts signatures_positions_elem.quadrangle.to_s
175
+ puts signatures_positions_elem.rectangle.to_s
176
+ puts signatures_positions_elem.boundingBox.to_s
174
177
  end
175
178
  end
176
179
  ```
@@ -71,7 +71,7 @@ A typical `Field` object will have the following attributes:
71
71
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
72
72
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
73
73
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
74
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
74
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
75
75
 
76
76
 
77
77
  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.
@@ -147,7 +147,7 @@ A typical `Field` object will have the following attributes:
147
147
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
148
148
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
149
149
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
150
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
150
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
151
151
 
152
152
 
153
153
  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.
@@ -73,7 +73,7 @@ A typical `Field` object will have the following attributes:
73
73
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
74
74
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
75
75
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
76
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
76
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
77
77
 
78
78
 
79
79
  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.
data/docs/cropper_v1.md CHANGED
@@ -64,7 +64,7 @@ A typical `Field` object will have the following attributes:
64
64
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
65
65
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
66
66
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
67
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
67
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
68
68
 
69
69
 
70
70
  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.
@@ -88,7 +88,10 @@ The following fields are extracted for Cropper V1:
88
88
  ```rb
89
89
  for page in result.document.inference.pages do
90
90
  for cropping_elem in page.prediction.cropping do
91
- puts cropping_elem.polygon
91
+ puts cropping_elem.polygon.to_s
92
+ puts cropping_elem.quadrangle.to_s
93
+ puts cropping_elem.rectangle.to_s
94
+ puts cropping_elem.boundingBox.to_s
92
95
  end
93
96
  end
94
97
  ```
@@ -119,7 +119,7 @@ A typical `Field` object will have the following attributes:
119
119
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
120
120
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
121
121
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
122
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
122
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
123
123
 
124
124
 
125
125
  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.
@@ -263,7 +263,7 @@ puts result.document.inference.prediction.supplier_phone_number.value
263
263
 
264
264
  ```rb
265
265
  for taxes_elem in result.document.inference.prediction.taxes do
266
- puts taxes_elem.to_s
266
+ puts taxes_elem.value
267
267
  end
268
268
  ```
269
269
 
@@ -131,7 +131,7 @@ A typical `Field` object will have the following attributes:
131
131
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
132
132
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
133
133
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
134
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
134
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
135
135
 
136
136
 
137
137
  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.
@@ -326,6 +326,9 @@ puts result.document.inference.prediction.supplier_name.value
326
326
  ```rb
327
327
  for supplier_payment_details_elem in result.document.inference.prediction.supplier_payment_details do
328
328
  puts supplier_payment_details_elem.value
329
+ puts supplier_payment_details_elem.rate
330
+ puts supplier_payment_details_elem.code
331
+ puts supplier_payment_details_elem.basis
329
332
  end
330
333
  ```
331
334
 
@@ -341,7 +344,7 @@ puts result.document.inference.prediction.supplier_phone_number.value
341
344
 
342
345
  ```rb
343
346
  for taxes_elem in result.document.inference.prediction.taxes do
344
- puts taxes_elem.to_s
347
+ puts taxes_elem.value
345
348
  end
346
349
  ```
347
350
 
data/docs/idcard_fr_v2.md CHANGED
@@ -99,7 +99,7 @@ A typical `Field` object will have the following attributes:
99
99
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
100
100
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
101
101
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
102
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
102
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
103
103
 
104
104
 
105
105
  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.
data/docs/invoices_v4.md CHANGED
@@ -127,7 +127,7 @@ A typical `Field` object will have the following attributes:
127
127
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
128
128
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
129
129
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
130
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
130
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
131
131
 
132
132
 
133
133
  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.
@@ -308,6 +308,9 @@ puts result.document.inference.prediction.supplier_name.value
308
308
  ```rb
309
309
  for supplier_payment_details_elem in result.document.inference.prediction.supplier_payment_details do
310
310
  puts supplier_payment_details_elem.value
311
+ puts supplier_payment_details_elem.rate
312
+ puts supplier_payment_details_elem.code
313
+ puts supplier_payment_details_elem.basis
311
314
  end
312
315
  ```
313
316
 
@@ -316,7 +319,7 @@ end
316
319
 
317
320
  ```rb
318
321
  for taxes_elem in result.document.inference.prediction.taxes do
319
- puts taxes_elem.to_s
322
+ puts taxes_elem.value
320
323
  end
321
324
  ```
322
325
 
@@ -67,7 +67,7 @@ A typical `Field` object will have the following attributes:
67
67
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
68
68
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
69
69
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
70
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
70
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
71
71
 
72
72
 
73
73
  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.
@@ -77,7 +77,7 @@ A typical `Field` object will have the following attributes:
77
77
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
78
78
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
79
79
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
80
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
80
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
81
81
 
82
82
 
83
83
  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.
@@ -97,7 +97,10 @@ The following fields are extracted for Multi Receipts Detector V1:
97
97
 
98
98
  ```rb
99
99
  for receipts_elem in result.document.inference.prediction.receipts do
100
- puts receipts_elem.polygon
100
+ puts receipts_elem.polygon.to_s
101
+ puts receipts_elem.quadrangle.to_s
102
+ puts receipts_elem.rectangle.to_s
103
+ puts receipts_elem.boundingBox.to_s
101
104
  end
102
105
  ```
103
106
 
data/docs/passport_v1.md CHANGED
@@ -87,7 +87,7 @@ A typical `Field` object will have the following attributes:
87
87
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
88
88
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
89
89
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
90
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
90
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
91
91
 
92
92
 
93
93
  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.
@@ -105,7 +105,7 @@ A typical `Field` object will have the following attributes:
105
105
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
106
106
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
107
107
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
108
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
108
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
109
109
 
110
110
 
111
111
  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.
@@ -101,7 +101,7 @@ A typical `Field` object will have the following attributes:
101
101
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
102
102
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
103
103
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
104
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
104
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
105
105
 
106
106
 
107
107
  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.
data/docs/us_w9_v1.md CHANGED
@@ -74,7 +74,7 @@ A typical `Field` object will have the following attributes:
74
74
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
75
75
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
76
76
  * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
77
- * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
77
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
78
78
 
79
79
 
80
80
  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.
data/lib/mindee/client.rb CHANGED
@@ -137,9 +137,9 @@ module Mindee
137
137
  # * `:on_min_pages` Apply the operation only if document has at least this many pages.
138
138
  # @param cropper [Boolean, nil] Whether to include cropper results for each page.
139
139
  # This performs a cropping operation on the server and will increase response time.
140
- # @param initial_delay_sec [Integer, Float, nil] initial delay before polling. Defaults to 6.
141
- # @param delay_sec [Integer, Float, nil] delay between polling attempts. Defaults to 3.
142
- # @param max_retries [Integer, nil] maximum amount of retries. Defaults to 10.
140
+ # @param initial_delay_sec [Integer, Float, nil] initial delay before polling. Defaults to 4.
141
+ # @param delay_sec [Integer, Float, nil] delay between polling attempts. Defaults to 2.
142
+ # @param max_retries [Integer, nil] maximum amount of retries. Defaults to 30.
143
143
  # @return [Mindee::Parsing::Common::ApiResponse]
144
144
  def enqueue_and_parse(
145
145
  input_source,
@@ -149,9 +149,9 @@ module Mindee
149
149
  close_file: true,
150
150
  page_options: nil,
151
151
  cropper: false,
152
- initial_delay_sec: 6,
153
- delay_sec: 3,
154
- max_retries: 10
152
+ initial_delay_sec: 4,
153
+ delay_sec: 2,
154
+ max_retries: 30
155
155
  )
156
156
  enqueue_res = enqueue(
157
157
  input_source,
@@ -243,11 +243,16 @@ module Mindee
243
243
  # Validates the parameters for async auto-polling
244
244
  # @param initial_delay_sec [Integer, Float] initial delay before polling
245
245
  # @param delay_sec [Integer, Float] delay between polling attempts
246
- # @param max_retries [Integer, nil] maximum amount of retries. Defaults to 10.
246
+ # @param max_retries [Integer, nil] maximum amount of retries.
247
247
  def validate_async_params(initial_delay_sec, delay_sec, max_retries)
248
- raise 'Cannot set auto-poll delay to less than 2 seconds' if delay_sec < 2
249
- raise 'Cannot set initial parsing delay to less than 4 seconds' if initial_delay_sec < 4
250
- raise 'Cannot set auto-poll delay to less than 2 seconds' unless max_retries.is_a? Integer
248
+ min_delay_sec = 1
249
+ min_initial_delay_sec = 2
250
+ min_retries = 2
251
+ raise "Cannot set auto-poll delay to less than #{min_delay_sec} seconds" if delay_sec < min_delay_sec
252
+ if initial_delay_sec < min_initial_delay_sec
253
+ raise "Cannot set initial parsing delay to less than #{min_initial_delay_sec} seconds"
254
+ end
255
+ raise "Cannot set auto-poll delay to less than #{min_retries} seconds" if max_retries < min_retries
251
256
  end
252
257
 
253
258
  # Creates an endpoint with the given values. Raises an error if the endpoint is invalid.
@@ -3,7 +3,7 @@
3
3
  # Mindee
4
4
  module Mindee
5
5
  # Current version.
6
- VERSION = '3.3.0'
6
+ VERSION = '3.3.1'
7
7
 
8
8
  # Finds and return the current platform.
9
9
  # @return [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: 3.3.0
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-17 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: marcel