mindee 5.5.0 → 5.6.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/.betterleaks.toml +15 -0
- data/.editorconfig +1 -1
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +11 -51
- data/bin/v1/products.rb +0 -6
- data/lib/mindee/v1/client.rb +1 -74
- data/lib/mindee/v1/http.rb +0 -1
- data/lib/mindee/v1/product.rb +0 -3
- data/lib/mindee/v2/client.rb +45 -26
- data/lib/mindee/v2/http/mindee_api_v2.rb +34 -49
- data/lib/mindee/v2/product/classification/classification_classifier.rb +5 -4
- data/lib/mindee/v2/product/crop/crop_item.rb +5 -4
- data/lib/mindee/v2/product/split/split_range.rb +5 -4
- data/lib/mindee/v2/search/models/model_search_parameters.rb +8 -5
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +1 -2
- data/prek.toml +45 -0
- data/sig/mindee/v1/client.rbs +1 -15
- data/sig/mindee/v2/client.rbs +4 -0
- data/sig/mindee/v2/http/mindee_api_v2.rbs +7 -9
- data/sig/mindee/v2/product/classification/classification_classifier.rbs +1 -1
- data/sig/mindee/v2/product/crop/crop_item.rbs +1 -1
- data/sig/mindee/v2/product/split/split_range.rbs +1 -1
- metadata +7 -45
- data/.git-hooks/pre_commit/gitleaks.rb +0 -19
- data/.overcommit.yml +0 -46
- data/docs/code_samples/bank_account_details_v1.txt +0 -24
- data/docs/code_samples/barcode_reader_v1.txt +0 -24
- data/docs/code_samples/idcard_fr_v1.txt +0 -24
- data/docs/code_samples/workflow_execution.txt +0 -28
- data/lib/mindee/v1/http/workflow_endpoint.rb +0 -93
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1.rb +0 -47
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rb +0 -47
- data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rb +0 -38
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rb +0 -49
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rb +0 -49
- data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rb +0 -40
- data/lib/mindee/v1/product/fr/id_card/id_card_v1.rb +0 -49
- data/lib/mindee/v1/product/fr/id_card/id_card_v1_document.rb +0 -106
- data/lib/mindee/v1/product/fr/id_card/id_card_v1_page.rb +0 -57
- data/sig/mindee/v1/http/workflow_endpoint.rbs +0 -22
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1.rbs +0 -13
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rbs +0 -16
- data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rbs +0 -17
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rbs +0 -15
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rbs +0 -19
- data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rbs +0 -19
- data/sig/mindee/v1/product/fr/id_card/id_card_v1.rbs +0 -15
- data/sig/mindee/v1/product/fr/id_card/id_card_v1_document.rbs +0 -26
- data/sig/mindee/v1/product/fr/id_card/id_card_v1_page.rbs +0 -20
data/sig/mindee/v1/client.rbs
CHANGED
|
@@ -19,18 +19,6 @@ module Mindee
|
|
|
19
19
|
def initialize: (params: Hash[String | Symbol, untyped]) -> void
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
class WorkflowOptions
|
|
23
|
-
attr_accessor document_alias: (String?)
|
|
24
|
-
attr_accessor priority: (Symbol?)
|
|
25
|
-
attr_accessor full_text: bool
|
|
26
|
-
attr_accessor rag: bool?
|
|
27
|
-
attr_accessor public_url: (String?)
|
|
28
|
-
attr_accessor page_options: (PageOptions)
|
|
29
|
-
attr_accessor close_file: bool
|
|
30
|
-
|
|
31
|
-
def initialize: (params: Hash[String | Symbol, untyped]) -> void
|
|
32
|
-
end
|
|
33
|
-
|
|
34
22
|
class Client
|
|
35
23
|
@api_key: String?
|
|
36
24
|
|
|
@@ -48,8 +36,6 @@ module Mindee
|
|
|
48
36
|
|
|
49
37
|
def enqueue_and_parse: (Input::Source::URLInputSource | Input::Source::LocalInputSource, singleton(V1::Parsing::Common::Inference), V1::HTTP::Endpoint, ParseOptions) -> V1::Parsing::Common::ApiResponse
|
|
50
38
|
|
|
51
|
-
def execute_workflow: (Input::Source::URLInputSource | Input::Source::LocalInputSource, String, options: (Hash[String | Symbol, untyped] | WorkflowOptions)) -> V1::Parsing::Common::WorkflowResponse
|
|
52
|
-
|
|
53
39
|
def load_prediction: (singleton(V1::Parsing::Common::Inference), Input::LocalResponse) -> V1::Parsing::Common::ApiResponse
|
|
54
40
|
|
|
55
41
|
def source_from_path: (String, ?repair_pdf: bool) -> Input::Source::PathInputSource
|
|
@@ -68,7 +54,7 @@ module Mindee
|
|
|
68
54
|
|
|
69
55
|
def normalize_parse_options: ((Hash[String | Symbol, untyped] | ParseOptions)) -> ParseOptions
|
|
70
56
|
|
|
71
|
-
def process_pdf_if_required: (Input::Source::LocalInputSource, ParseOptions
|
|
57
|
+
def process_pdf_if_required: (Input::Source::LocalInputSource, ParseOptions ) -> void
|
|
72
58
|
|
|
73
59
|
def initialize_endpoint: (singleton(V1::Parsing::Common::Inference), ?endpoint_name: String, ?account_name: String, ?version: String) -> V1::HTTP::Endpoint
|
|
74
60
|
|
data/sig/mindee/v2/client.rbs
CHANGED
|
@@ -15,6 +15,10 @@ module Mindee
|
|
|
15
15
|
|
|
16
16
|
def get_job: (String job_id) -> V2::Parsing::JobResponse
|
|
17
17
|
|
|
18
|
+
def get_result_by_url: [T] (HTTP::_ProductClass[T] product, String url) -> T
|
|
19
|
+
|
|
20
|
+
def get_job_by_url: (String url) -> V2::Parsing::JobResponse
|
|
21
|
+
|
|
18
22
|
def enqueue: [T] (HTTP::_ProductClass[T] product, Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | ClientOptions::BaseProductParameters params) -> V2::Parsing::JobResponse
|
|
19
23
|
|
|
20
24
|
def enqueue_and_get_result: [T] (HTTP::_ProductClass[T] product, Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | ClientOptions::BaseProductParameters params, ?Hash[String | Symbol, untyped] | Input::PollingOptions | nil) -> T
|
|
@@ -27,18 +27,20 @@ module Mindee
|
|
|
27
27
|
|
|
28
28
|
def initialize: (?api_key: String?) -> void
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def req_get_result_by_id: [T] (_ProductClass[T] product, String inference_id) -> T
|
|
31
31
|
|
|
32
32
|
def req_post_product_enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ClientOptions::BaseProductParameters) -> V2::Parsing::JobResponse
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def req_get_job_by_id: (String job_id) -> V2::Parsing::JobResponse
|
|
35
|
+
|
|
36
|
+
def req_get_job_by_url: (String url) -> V2::Parsing::JobResponse
|
|
37
|
+
|
|
38
|
+
def req_get_result_by_url: [T] (_ProductClass[T] product, String url) -> T
|
|
35
39
|
|
|
36
40
|
def process_response: (Net::HTTPResponse?) -> Hash[String | Symbol, untyped]
|
|
37
41
|
|
|
38
42
|
def poll: (String) -> Net::HTTPResponse
|
|
39
43
|
|
|
40
|
-
def result_req_get: [T] (String, _ProductClass[T] product) -> Net::HTTPResponse
|
|
41
|
-
|
|
42
44
|
def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ClientOptions::BaseProductParameters) -> Net::HTTPResponse?
|
|
43
45
|
|
|
44
46
|
def req_get_search: [T] (_SearchParameters[T] params) -> T
|
|
@@ -47,11 +49,7 @@ module Mindee
|
|
|
47
49
|
|
|
48
50
|
def enqueue_form_options: (Array[Array[untyped]], V2::Product::Extraction::Params::ExtractionParameters) -> Array[Array[untyped]]
|
|
49
51
|
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
-
def req_get_result_url: [T] (_ResponseFactory[T] result_class, String url) -> T
|
|
53
|
-
|
|
54
|
-
def uri?: (String) -> bool
|
|
52
|
+
def validate_https_url!: (String) -> void
|
|
55
53
|
end
|
|
56
54
|
end
|
|
57
55
|
end
|
|
@@ -6,7 +6,7 @@ module Mindee
|
|
|
6
6
|
module Classification
|
|
7
7
|
class ClassificationClassifier
|
|
8
8
|
attr_reader document_type: String
|
|
9
|
-
attr_reader extraction_response: Extraction::ExtractionResponse
|
|
9
|
+
attr_reader extraction_response: Extraction::ExtractionResponse | nil
|
|
10
10
|
|
|
11
11
|
def initialize: (Hash[String | Symbol, untyped]) -> void
|
|
12
12
|
end
|
|
@@ -3,7 +3,7 @@ module Mindee
|
|
|
3
3
|
module Product
|
|
4
4
|
module Crop
|
|
5
5
|
class CropItem
|
|
6
|
-
attr_reader extraction_response: Extraction::ExtractionResponse
|
|
6
|
+
attr_reader extraction_response: Extraction::ExtractionResponse | nil
|
|
7
7
|
attr_reader object_type: String
|
|
8
8
|
attr_reader location: Parsing::Field::FieldLocation
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ module Mindee
|
|
|
3
3
|
module Product
|
|
4
4
|
module Split
|
|
5
5
|
class SplitRange
|
|
6
|
-
attr_reader extraction_response: Extraction::ExtractionResponse
|
|
6
|
+
attr_reader extraction_response: Extraction::ExtractionResponse | nil
|
|
7
7
|
attr_reader page_range: Array[Integer]
|
|
8
8
|
attr_reader document_type: String
|
|
9
9
|
|
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: 5.
|
|
4
|
+
version: 5.6.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: 2026-
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -114,20 +114,6 @@ dependencies:
|
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
116
|
version: 0.2.0
|
|
117
|
-
- !ruby/object:Gem::Dependency
|
|
118
|
-
name: overcommit
|
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - "~>"
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0.71'
|
|
124
|
-
type: :development
|
|
125
|
-
prerelease: false
|
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - "~>"
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '0.71'
|
|
131
117
|
- !ruby/object:Gem::Dependency
|
|
132
118
|
name: rbs
|
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -148,14 +134,14 @@ dependencies:
|
|
|
148
134
|
requirements:
|
|
149
135
|
- - "~>"
|
|
150
136
|
- !ruby/object:Gem::Version
|
|
151
|
-
version:
|
|
137
|
+
version: 1.91.0
|
|
152
138
|
type: :development
|
|
153
139
|
prerelease: false
|
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
|
155
141
|
requirements:
|
|
156
142
|
- - "~>"
|
|
157
143
|
- !ruby/object:Gem::Version
|
|
158
|
-
version:
|
|
144
|
+
version: 1.91.0
|
|
159
145
|
- !ruby/object:Gem::Dependency
|
|
160
146
|
name: steep
|
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -188,17 +174,16 @@ description: Quickly and easily connect to Mindee's API services using Ruby.
|
|
|
188
174
|
email:
|
|
189
175
|
- opensource@mindee.co
|
|
190
176
|
executables:
|
|
191
|
-
- console
|
|
192
177
|
- mindee.rb
|
|
178
|
+
- console
|
|
193
179
|
extensions: []
|
|
194
180
|
extra_rdoc_files: []
|
|
195
181
|
files:
|
|
182
|
+
- ".betterleaks.toml"
|
|
196
183
|
- ".editorconfig"
|
|
197
|
-
- ".git-hooks/pre_commit/gitleaks.rb"
|
|
198
184
|
- ".gitattributes"
|
|
199
185
|
- ".gitignore"
|
|
200
186
|
- ".gitmodules"
|
|
201
|
-
- ".overcommit.yml"
|
|
202
187
|
- ".rubocop.yml"
|
|
203
188
|
- ".yardopts"
|
|
204
189
|
- CHANGELOG.md
|
|
@@ -217,10 +202,8 @@ files:
|
|
|
217
202
|
- bin/v2/parser.rb
|
|
218
203
|
- bin/v2/products.rb
|
|
219
204
|
- bin/v2/search_commands.rb
|
|
220
|
-
- docs/code_samples/bank_account_details_v1.txt
|
|
221
205
|
- docs/code_samples/bank_account_details_v2.txt
|
|
222
206
|
- docs/code_samples/bank_statement_fr_v2_async.txt
|
|
223
|
-
- docs/code_samples/barcode_reader_v1.txt
|
|
224
207
|
- docs/code_samples/cropper_v1.txt
|
|
225
208
|
- docs/code_samples/default.txt
|
|
226
209
|
- docs/code_samples/default_async.txt
|
|
@@ -228,7 +211,6 @@ files:
|
|
|
228
211
|
- docs/code_samples/expense_receipts_v5_async.txt
|
|
229
212
|
- docs/code_samples/financial_document_v1.txt
|
|
230
213
|
- docs/code_samples/financial_document_v1_async.txt
|
|
231
|
-
- docs/code_samples/idcard_fr_v1.txt
|
|
232
214
|
- docs/code_samples/idcard_fr_v2.txt
|
|
233
215
|
- docs/code_samples/international_id_v2_async.txt
|
|
234
216
|
- docs/code_samples/invoice_splitter_v1_async.txt
|
|
@@ -243,7 +225,6 @@ files:
|
|
|
243
225
|
- docs/code_samples/v2_extraction_webhook.txt
|
|
244
226
|
- docs/code_samples/v2_ocr.txt
|
|
245
227
|
- docs/code_samples/v2_split.txt
|
|
246
|
-
- docs/code_samples/workflow_execution.txt
|
|
247
228
|
- docs/code_samples/workflow_polling.txt
|
|
248
229
|
- examples/auto_invoice_splitter_extraction.rb
|
|
249
230
|
- examples/auto_multi_receipts_detector_extraction.rb
|
|
@@ -299,7 +280,6 @@ files:
|
|
|
299
280
|
- lib/mindee/v1/http.rb
|
|
300
281
|
- lib/mindee/v1/http/.rubocop.yml
|
|
301
282
|
- lib/mindee/v1/http/endpoint.rb
|
|
302
|
-
- lib/mindee/v1/http/workflow_endpoint.rb
|
|
303
283
|
- lib/mindee/v1/parsing.rb
|
|
304
284
|
- lib/mindee/v1/parsing/common.rb
|
|
305
285
|
- lib/mindee/v1/parsing/common/api_request.rb
|
|
@@ -343,9 +323,6 @@ files:
|
|
|
343
323
|
- lib/mindee/v1/parsing/universal/universal_object_field.rb
|
|
344
324
|
- lib/mindee/v1/product.rb
|
|
345
325
|
- lib/mindee/v1/product/.rubocop.yml
|
|
346
|
-
- lib/mindee/v1/product/barcode_reader/barcode_reader_v1.rb
|
|
347
|
-
- lib/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rb
|
|
348
|
-
- lib/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rb
|
|
349
326
|
- lib/mindee/v1/product/cropper/cropper_v1.rb
|
|
350
327
|
- lib/mindee/v1/product/cropper/cropper_v1_document.rb
|
|
351
328
|
- lib/mindee/v1/product/cropper/cropper_v1_page.rb
|
|
@@ -354,9 +331,6 @@ files:
|
|
|
354
331
|
- lib/mindee/v1/product/financial_document/financial_document_v1_line_item.rb
|
|
355
332
|
- lib/mindee/v1/product/financial_document/financial_document_v1_line_items.rb
|
|
356
333
|
- lib/mindee/v1/product/financial_document/financial_document_v1_page.rb
|
|
357
|
-
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rb
|
|
358
|
-
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rb
|
|
359
|
-
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rb
|
|
360
334
|
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2.rb
|
|
361
335
|
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_bban.rb
|
|
362
336
|
- lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_document.rb
|
|
@@ -366,9 +340,6 @@ files:
|
|
|
366
340
|
- lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_page.rb
|
|
367
341
|
- lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb
|
|
368
342
|
- lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transactions.rb
|
|
369
|
-
- lib/mindee/v1/product/fr/id_card/id_card_v1.rb
|
|
370
|
-
- lib/mindee/v1/product/fr/id_card/id_card_v1_document.rb
|
|
371
|
-
- lib/mindee/v1/product/fr/id_card/id_card_v1_page.rb
|
|
372
343
|
- lib/mindee/v1/product/fr/id_card/id_card_v2.rb
|
|
373
344
|
- lib/mindee/v1/product/fr/id_card/id_card_v2_document.rb
|
|
374
345
|
- lib/mindee/v1/product/fr/id_card/id_card_v2_page.rb
|
|
@@ -502,6 +473,7 @@ files:
|
|
|
502
473
|
- lib/mindee/version.rb
|
|
503
474
|
- mindee-lite.gemspec
|
|
504
475
|
- mindee.gemspec
|
|
476
|
+
- prek.toml
|
|
505
477
|
- sig/custom/marcel.rbs
|
|
506
478
|
- sig/custom/mini_magick.rbs
|
|
507
479
|
- sig/custom/net_http.rbs
|
|
@@ -545,7 +517,6 @@ files:
|
|
|
545
517
|
- sig/mindee/v1/client.rbs
|
|
546
518
|
- sig/mindee/v1/extraction/multi_receipts_extractor.rbs
|
|
547
519
|
- sig/mindee/v1/http/endpoint.rbs
|
|
548
|
-
- sig/mindee/v1/http/workflow_endpoint.rbs
|
|
549
520
|
- sig/mindee/v1/parsing/common/api_request.rbs
|
|
550
521
|
- sig/mindee/v1/parsing/common/api_response.rbs
|
|
551
522
|
- sig/mindee/v1/parsing/common/document.rbs
|
|
@@ -581,9 +552,6 @@ files:
|
|
|
581
552
|
- sig/mindee/v1/parsing/standard/tax_field.rbs
|
|
582
553
|
- sig/mindee/v1/parsing/universal/universal_list_field.rbs
|
|
583
554
|
- sig/mindee/v1/parsing/universal/universal_object_field.rbs
|
|
584
|
-
- sig/mindee/v1/product/barcode_reader/barcode_reader_v1.rbs
|
|
585
|
-
- sig/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rbs
|
|
586
|
-
- sig/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rbs
|
|
587
555
|
- sig/mindee/v1/product/cropper/cropper_v1.rbs
|
|
588
556
|
- sig/mindee/v1/product/cropper/cropper_v1_document.rbs
|
|
589
557
|
- sig/mindee/v1/product/cropper/cropper_v1_page.rbs
|
|
@@ -592,9 +560,6 @@ files:
|
|
|
592
560
|
- sig/mindee/v1/product/financial_document/financial_document_v1_line_item.rbs
|
|
593
561
|
- sig/mindee/v1/product/financial_document/financial_document_v1_line_items.rbs
|
|
594
562
|
- sig/mindee/v1/product/financial_document/financial_document_v1_page.rbs
|
|
595
|
-
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rbs
|
|
596
|
-
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rbs
|
|
597
|
-
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rbs
|
|
598
563
|
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2.rbs
|
|
599
564
|
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_bban.rbs
|
|
600
565
|
- sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v2_document.rbs
|
|
@@ -604,9 +569,6 @@ files:
|
|
|
604
569
|
- sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_page.rbs
|
|
605
570
|
- sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rbs
|
|
606
571
|
- sig/mindee/v1/product/fr/bank_statement/bank_statement_v2_transactions.rbs
|
|
607
|
-
- sig/mindee/v1/product/fr/id_card/id_card_v1.rbs
|
|
608
|
-
- sig/mindee/v1/product/fr/id_card/id_card_v1_document.rbs
|
|
609
|
-
- sig/mindee/v1/product/fr/id_card/id_card_v1_page.rbs
|
|
610
572
|
- sig/mindee/v1/product/fr/id_card/id_card_v2.rbs
|
|
611
573
|
- sig/mindee/v1/product/fr/id_card/id_card_v2_document.rbs
|
|
612
574
|
- sig/mindee/v1/product/fr/id_card/id_card_v2_page.rbs
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Overcommit
|
|
4
|
-
module Hook
|
|
5
|
-
module PreCommit
|
|
6
|
-
# Local script to run gitleaks
|
|
7
|
-
class Gitleaks < Base
|
|
8
|
-
# Runs the command.
|
|
9
|
-
def run
|
|
10
|
-
result = execute(['gitleaks', 'git', '--staged', '-v', '.'])
|
|
11
|
-
|
|
12
|
-
return :pass if result.success?
|
|
13
|
-
|
|
14
|
-
[:fail, result.stdout + result.stderr]
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/.overcommit.yml
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
PreCommit:
|
|
2
|
-
MergeConflicts:
|
|
3
|
-
enabled: true
|
|
4
|
-
|
|
5
|
-
YamlSyntax:
|
|
6
|
-
enabled: true
|
|
7
|
-
|
|
8
|
-
TrailingWhitespace:
|
|
9
|
-
enabled: true
|
|
10
|
-
|
|
11
|
-
FileSize:
|
|
12
|
-
enabled: true
|
|
13
|
-
byte_limit: 1048576
|
|
14
|
-
|
|
15
|
-
RuboCop:
|
|
16
|
-
enabled: true
|
|
17
|
-
required_executable: 'bundle'
|
|
18
|
-
command: ['bundle', 'exec', 'rubocop', '--force-exclusion', '--no-server']
|
|
19
|
-
|
|
20
|
-
CustomScript:
|
|
21
|
-
enabled: true
|
|
22
|
-
description: 'Run Steep type checking'
|
|
23
|
-
required_executable: 'bundle'
|
|
24
|
-
command: ['bundle', 'exec', 'steep', 'check']
|
|
25
|
-
|
|
26
|
-
Gitleaks:
|
|
27
|
-
enabled: true
|
|
28
|
-
required_executable: 'gitleaks'
|
|
29
|
-
CommitMsg:
|
|
30
|
-
enabled: false
|
|
31
|
-
CapitalizedSubject:
|
|
32
|
-
enabled: false
|
|
33
|
-
TextWidth:
|
|
34
|
-
enabled: false
|
|
35
|
-
TrailingPeriod:
|
|
36
|
-
enabled: false
|
|
37
|
-
SingleLineSubject:
|
|
38
|
-
enabled: false
|
|
39
|
-
EmptyMessage:
|
|
40
|
-
enabled: false
|
|
41
|
-
|
|
42
|
-
PrePush:
|
|
43
|
-
BundleAudit:
|
|
44
|
-
enabled: true
|
|
45
|
-
required_executable: 'bundle'
|
|
46
|
-
command: ['sh', '-c', 'bundle exec bundle-audit check']
|
|
@@ -1,24 +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::V1::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::V1::Product::FR::BankAccountDetails::BankAccountDetailsV1
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Print a full summary of the parsed data in RST format
|
|
21
|
-
puts result.document
|
|
22
|
-
|
|
23
|
-
# Print the document-level parsed data
|
|
24
|
-
# puts result.document.inference.prediction
|
|
@@ -1,24 +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::V1::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::V1::Product::BarcodeReader::BarcodeReaderV1
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Print a full summary of the parsed data in RST format
|
|
21
|
-
puts result.document
|
|
22
|
-
|
|
23
|
-
# Print the document-level parsed data
|
|
24
|
-
# puts result.document.inference.prediction
|
|
@@ -1,24 +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::V1::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::V1::Product::FR::IdCard::IdCardV1
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# Print a full summary of the parsed data in RST format
|
|
21
|
-
puts result.document
|
|
22
|
-
|
|
23
|
-
# Print the document-level parsed data
|
|
24
|
-
# puts result.document.inference.prediction
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Install the Ruby client library by running:
|
|
3
|
-
# gem install mindee
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
require 'mindee'
|
|
7
|
-
|
|
8
|
-
workflow_id = 'workflow-id'
|
|
9
|
-
|
|
10
|
-
# Init a new client
|
|
11
|
-
mindee_client = Mindee::V1::Client.new
|
|
12
|
-
|
|
13
|
-
# Load a file from disk
|
|
14
|
-
input_source = mindee_client.source_from_path('path/to/my/file.ext')
|
|
15
|
-
|
|
16
|
-
# Send the file to the workflow
|
|
17
|
-
result = mindee_client.execute_workflow(
|
|
18
|
-
input_source,
|
|
19
|
-
workflow_id,
|
|
20
|
-
# options: { # Optionally, you can provide the following parameters:
|
|
21
|
-
# document_alias: 'my-document-alias', # Potential alias for the document
|
|
22
|
-
# priority: Mindee::V1::Parsing::Common::ExecutionPriority::LOW, # Priority of the execution
|
|
23
|
-
# rag: true # Whether to enable Retrieval-Augmented Generation
|
|
24
|
-
# }
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
# Print the execution's ID to make sure it worked
|
|
28
|
-
puts result.execution.id
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'json'
|
|
4
|
-
require 'net/http'
|
|
5
|
-
require_relative '../../http/http_error_handler'
|
|
6
|
-
|
|
7
|
-
module Mindee
|
|
8
|
-
module V1
|
|
9
|
-
module HTTP
|
|
10
|
-
# Handles the routing for workflow calls.
|
|
11
|
-
class WorkflowEndpoint
|
|
12
|
-
# @return [String]
|
|
13
|
-
attr_reader :api_key
|
|
14
|
-
# @return [Integer]
|
|
15
|
-
attr_reader :request_timeout
|
|
16
|
-
# @return [String]
|
|
17
|
-
attr_reader :url
|
|
18
|
-
|
|
19
|
-
def initialize(workflow_id, api_key: '')
|
|
20
|
-
@request_timeout = ENV.fetch(REQUEST_TIMEOUT_ENV_NAME, TIMEOUT_DEFAULT).to_i
|
|
21
|
-
@api_key = api_key.nil? || api_key.empty? ? ENV.fetch(API_KEY_ENV_NAME, API_KEY_DEFAULT) : api_key
|
|
22
|
-
base_url = ENV.fetch(BASE_URL_ENV_NAME, BASE_URL_DEFAULT)
|
|
23
|
-
@url = "#{base_url.chomp('/')}/workflows/#{workflow_id}/executions"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Sends a document to the workflow.
|
|
27
|
-
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
|
28
|
-
# @param opts [WorkflowOptions] Options to configure workflow execution behavior.
|
|
29
|
-
# @return [Array]
|
|
30
|
-
def execute_workflow(input_source, opts)
|
|
31
|
-
check_api_key
|
|
32
|
-
response = workflow_execution_req_post(input_source, opts)
|
|
33
|
-
if response.nil?
|
|
34
|
-
raise Mindee::Error::MindeeHTTPError.new(
|
|
35
|
-
{ code: 0, details: 'Server response was nil.', message: 'Unknown error.' }, @url, 0
|
|
36
|
-
)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
hashed_response = JSON.parse(response.body, object_class: Hash)
|
|
40
|
-
return [hashed_response, response.body] if Mindee::HTTP::ResponseValidation.valid_async_response?(response)
|
|
41
|
-
|
|
42
|
-
Mindee::HTTP::ResponseValidation.clean_request!(response)
|
|
43
|
-
error = Mindee::HTTP::ErrorHandler.handle_error(@url_name, response)
|
|
44
|
-
raise error
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource]
|
|
48
|
-
# @param opts [WorkflowOptions] Options to configure workflow execution behavior.
|
|
49
|
-
# @return [Net::HTTPResponse, nil]
|
|
50
|
-
def workflow_execution_req_post(input_source, opts)
|
|
51
|
-
uri = URI(@url)
|
|
52
|
-
params = {} # : Hash[String | Symbol, untyped]
|
|
53
|
-
params[:full_text_ocr] = 'true' if opts.full_text
|
|
54
|
-
params[:rag] = 'true' if opts.rag
|
|
55
|
-
uri.query = URI.encode_www_form(params) if params.any?
|
|
56
|
-
|
|
57
|
-
headers = {
|
|
58
|
-
'Authorization' => "Token #{@api_key}",
|
|
59
|
-
'User-Agent' => USER_AGENT,
|
|
60
|
-
}
|
|
61
|
-
req = Net::HTTP::Post.new(uri, headers)
|
|
62
|
-
form_data = [] # : Array[untyped]
|
|
63
|
-
if input_source.is_a?(Mindee::Input::Source::URLInputSource)
|
|
64
|
-
form_data.push ['document', input_source.url]
|
|
65
|
-
else
|
|
66
|
-
form_data.push ['document', *input_source.read_contents(close: opts.close_file)]
|
|
67
|
-
end
|
|
68
|
-
form_data.push ['alias', opts.document_alias] if opts.document_alias
|
|
69
|
-
form_data.push ['public_url', opts.public_url] if opts.public_url
|
|
70
|
-
form_data.push ['priority', opts.priority.to_s] if opts.priority
|
|
71
|
-
|
|
72
|
-
req.set_form(form_data, 'multipart/form-data')
|
|
73
|
-
req['Transfer-Encoding'] = 'chunked'
|
|
74
|
-
|
|
75
|
-
response = nil
|
|
76
|
-
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @request_timeout) do |http|
|
|
77
|
-
response = http.request(req)
|
|
78
|
-
end
|
|
79
|
-
response
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Checks API key
|
|
83
|
-
def check_api_key
|
|
84
|
-
return unless @api_key.nil? || @api_key.empty?
|
|
85
|
-
|
|
86
|
-
raise Error::MindeeConfigurationError, "Missing API key. Check your Client Configuration.\n" \
|
|
87
|
-
"You can set this using the '#{HTTP::API_KEY_ENV_NAME}'" \
|
|
88
|
-
'environment variable.'
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../parsing'
|
|
4
|
-
require_relative 'barcode_reader_v1_document'
|
|
5
|
-
require_relative 'barcode_reader_v1_page'
|
|
6
|
-
|
|
7
|
-
module Mindee
|
|
8
|
-
module V1
|
|
9
|
-
module Product
|
|
10
|
-
# Barcode Reader module.
|
|
11
|
-
module BarcodeReader
|
|
12
|
-
# Barcode Reader API version 1 inference prediction.
|
|
13
|
-
class BarcodeReaderV1 < Mindee::V1::Parsing::Common::Inference
|
|
14
|
-
@endpoint_name = 'barcode_reader'
|
|
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 = BarcodeReaderV1Document.new(prediction['prediction'], nil)
|
|
23
|
-
@pages = []
|
|
24
|
-
prediction['pages'].each do |page|
|
|
25
|
-
@pages.push(BarcodeReaderV1Page.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,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../../parsing'
|
|
4
|
-
|
|
5
|
-
module Mindee
|
|
6
|
-
module V1
|
|
7
|
-
module Product
|
|
8
|
-
module BarcodeReader
|
|
9
|
-
# Barcode Reader API version 1.0 document data.
|
|
10
|
-
class BarcodeReaderV1Document < Mindee::V1::Parsing::Common::Prediction
|
|
11
|
-
include Mindee::V1::Parsing::Standard
|
|
12
|
-
|
|
13
|
-
# List of decoded 1D barcodes.
|
|
14
|
-
# @return [Array<Mindee::V1::Parsing::Standard::StringField>]
|
|
15
|
-
attr_reader :codes_1d
|
|
16
|
-
# List of decoded 2D barcodes.
|
|
17
|
-
# @return [Array<Mindee::V1::Parsing::Standard::StringField>]
|
|
18
|
-
attr_reader :codes_2d
|
|
19
|
-
|
|
20
|
-
# @param prediction [Hash]
|
|
21
|
-
# @param page_id [Integer, nil]
|
|
22
|
-
def initialize(prediction, page_id)
|
|
23
|
-
super
|
|
24
|
-
@codes_1d = [] # : Array[Parsing::Standard::StringField]
|
|
25
|
-
prediction['codes_1d'].each do |item|
|
|
26
|
-
@codes_1d.push(Parsing::Standard::StringField.new(item, page_id))
|
|
27
|
-
end
|
|
28
|
-
@codes_2d = [] # : Array[Parsing::Standard::StringField]
|
|
29
|
-
prediction['codes_2d'].each do |item|
|
|
30
|
-
@codes_2d.push(Parsing::Standard::StringField.new(item, page_id))
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# @return [String]
|
|
35
|
-
def to_s
|
|
36
|
-
codes_1d = @codes_1d.join("\n #{' ' * 13}")
|
|
37
|
-
codes_2d = @codes_2d.join("\n #{' ' * 13}")
|
|
38
|
-
out_str = String.new
|
|
39
|
-
out_str << "\n:Barcodes 1D: #{codes_1d}".rstrip
|
|
40
|
-
out_str << "\n:Barcodes 2D: #{codes_2d}".rstrip
|
|
41
|
-
out_str[1..].to_s
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|