mindee 3.19.0 → 3.19.1
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 +5 -0
- data/README.md +48 -0
- data/lib/mindee/parsing/common/document.rb +1 -2
- data/lib/mindee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bca81cfda2aa389c5892c16d68e78cb3204a029fe21265180e3de2478a6f8054
|
4
|
+
data.tar.gz: 3004a181239a458018f90258efe35940d1c466a890f92d7f221248970a13a3eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2482ecc51f3259b7ffd0b45c4239ef42ba961a83c8c93bc50fe60503857e033d5397dc41ee3fb1defbcb5320ebb134a6aeba7c8b4ba31fa6255f5c7f95b632c
|
7
|
+
data.tar.gz: 6f3d4b075a60c4e9ca8d01b5474568c4799df6584dc777b74489d2228d2c14d0009eca9def8f3ddda7e07527ab6fb79e80b6e9bee996025516a54256b0846b49
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -162,6 +162,54 @@ Using the ruby bundler:
|
|
162
162
|
bundle exec ruby ./bin/mindee.rb invoice path/to/your/file.ext
|
163
163
|
```
|
164
164
|
|
165
|
+
|
166
|
+
### Enqueue and Parse a Webhook Response
|
167
|
+
This is an optional way of handling asynchronous APIs.
|
168
|
+
|
169
|
+
```rb
|
170
|
+
require 'mindee'
|
171
|
+
|
172
|
+
# Init a new client
|
173
|
+
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
174
|
+
|
175
|
+
# Load a file from disk
|
176
|
+
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
177
|
+
|
178
|
+
|
179
|
+
# Parse the file
|
180
|
+
enqueue_response = mindee_client.enqueue(
|
181
|
+
input_source,
|
182
|
+
Mindee::Product::InternationalId::InternationalIdV2
|
183
|
+
)
|
184
|
+
|
185
|
+
job_id = enqueue_response.job.id
|
186
|
+
|
187
|
+
# Load the JSON string sent by the Mindee webhook POST callback.
|
188
|
+
# Reading the callback data will vary greatly depending on your HTTP server.
|
189
|
+
# This is therefore beyond the scope of this example.
|
190
|
+
|
191
|
+
local_response = Mindee::Input::LocalResponse.new(request.body.string)
|
192
|
+
|
193
|
+
# You can also use a File object as the input.
|
194
|
+
# FILE_PATH = File.join('path', 'to', 'file.json').freeze
|
195
|
+
# local_response = Mindee::Input::LocalResponse.new(FILE_PATH);
|
196
|
+
|
197
|
+
# Optional: verify the HMAC signature.
|
198
|
+
unless local_response.valid_hmac_signature?(my_secret_key, 'invalid signature')
|
199
|
+
raise "Invalid HMAC signature!"
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
# Deserialize the response:
|
204
|
+
result = mindee_client.load_prediction(
|
205
|
+
Mindee::Product::InternationalId::InternationalIdV2,
|
206
|
+
local_response
|
207
|
+
)
|
208
|
+
|
209
|
+
# Print a full summary of the parsed data in RST format
|
210
|
+
puts result.document
|
211
|
+
```
|
212
|
+
|
165
213
|
## Further Reading
|
166
214
|
|
167
215
|
There's more to it than that for those that need more features, or want to
|
@@ -61,8 +61,7 @@ module Mindee
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def inject_full_text_ocr(raw_prediction)
|
64
|
-
return unless raw_prediction.dig('inference', 'pages')
|
65
|
-
raw_prediction['inference']['pages'][0]['extras']['full_text_ocr']
|
64
|
+
return unless raw_prediction.dig('inference', 'pages', 0, 'extras', 'full_text_ocr')
|
66
65
|
|
67
66
|
full_text_ocr = String.new
|
68
67
|
raw_prediction.dig('inference', 'pages').each do |page|
|
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.19.
|
4
|
+
version: 3.19.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: 2025-01-
|
11
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marcel
|