Skip to content

Commit 2e3e4a5

Browse files
🔖 Version 3.19.1 (#139)
1 parent 878142e commit 2e3e4a5

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Mindee Ruby API Library Changelog
22

3+
## v3.19.1 - 2025-01-21
4+
### Changes
5+
* :bug: fix extras failing at document level if missing from prediction
6+
7+
38
## v3.19.0 - 2025-01-14
49
### Changes
510
* :sparkles: add support for US Mail V3

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,54 @@ Using the ruby bundler:
162162
bundle exec ruby ./bin/mindee.rb invoice path/to/your/file.ext
163163
```
164164

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+
165213
## Further Reading
166214

167215
There's more to it than that for those that need more features, or want to

lib/mindee/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Mindee
44
module Mindee
55
# Current version.
6-
VERSION = '3.19.0'
6+
VERSION = '3.19.1'
77

88
# Finds and return the current platform.
99
# @return [String]

0 commit comments

Comments
 (0)