Skip to content

Commit 89bbeca

Browse files
🔖 Version 4.7.0-rc1 (#195)
1 parent ab1f275 commit 89bbeca

File tree

3 files changed

+34
-223
lines changed

3 files changed

+34
-223
lines changed

CHANGELOG.md

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

3+
## v4.7.0-rc1 - 2025-08-13
4+
### Changes
5+
* :sparkles: add support for client V2 & associated features
6+
7+
### Fixes
8+
* :recycle: add many missing internal types
9+
* :bug: fix invalid types for many V1 features
10+
* :bug: fix V1 errors sometimes having the wrong code
11+
* :bug: fix many presumably immutable fields having non-readonly parameters
12+
* :bug: fix broken `resources` accessor in `ApiRequest` object
13+
14+
315
## v4.6.0 - 2025-06-03
416
### Changes
517
* :sparkles: add support for address fields

README.md

Lines changed: 21 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -4,240 +4,39 @@
44

55
Quickly and easily connect to Mindee's API services using Ruby.
66

7-
## Requirements
7+
## Mindee API Versions
8+
This client library has support for both Mindee platform versions.
89

9-
The following Ruby versions are tested and supported: 3.0, 3.1, 3.2, 3.3, 3.4
10+
### Latest - V2
11+
This is the new platform located here:
1012

11-
## Quick Start
13+
https://app.mindee.com
1214

13-
Here's the TL;DR of getting started.
15+
It uses **API version 2**.
1416

15-
First, get an [API Key](https://developers.mindee.com/docs/create-api-key)
17+
Consult the
18+
**[Latest Documentation](https://docs.mindee.com/integrations/client-libraries-sdk)**
1619

17-
Install by adding this line to your application's Gemfile:
1820

19-
```ruby
20-
gem 'mindee'
21-
```
21+
### Legacy - V1
22+
This is the legacy platform located here:
2223

23-
And then execute:
24+
https://platform.mindee.com/
2425

25-
```sh
26-
bundle install
27-
```
26+
It uses **API version 1**.
2827

29-
Finally, Ruby away!
28+
Consult the
29+
**[Legacy Documentation](https://developers.mindee.com/docs/ruby-getting-started)**
3030

31-
### Environment Variables
31+
## Additional Information
3232

33-
This library offers customizable features through environment variables. While there may be instances where you need to
34-
rely on them, it's crucial to exercise caution when modifying them to avoid unintended consequences.
33+
**[Source Code](https://github.com/mindee/mindee-api-ruby)**
3534

36-
If you're unsure whether you need to adjust these variables, it's advisable to refrain from doing so unless you have a
37-
specific reason. Accidentally overwriting them can lead to unexpected behavior.
35+
**[Reference Documentation](https://mindee.github.io/mindee-api-ruby/)**
3836

39-
Before making any changes, we recommend reviewing the following information to understand the purpose and potential
40-
impact of each environment variable:
37+
**[Feedback](https://feedback.mindee.com/)**
4138

42-
* `MINDEE_API_KEY`:
43-
* **Description**: Your personal Mindee API Key as shown on the platform. Be careful not to show this publicly!
44-
* **Default Value**: `nil`
45-
* `MINDEE_BASE_URL`:
46-
* **Description**: The default base URL of the API endpoint. Use this variable to specify the root URL for API requests. Modify as needed for proxy configurations or changes in API endpoint location.
47-
* **Default Value**: `https://api.mindee.net/v1`
48-
* `MINDEE_REQUEST_TIMEOUT`:
49-
* **Description**: The default timeout for HTTP requests (in seconds).
50-
* **Default Value**: `120`
51-
* `MINDEE_LOG_LEVEL`:
52-
* **Description**: The default logging level for the mindee logger.
53-
* **Default Value**: `WARN`
39+
### License
40+
Copyright © Mindee
5441

55-
### Loading a File and Parsing It
56-
57-
#### Global Documents
58-
59-
```ruby
60-
require 'mindee'
61-
62-
# Init a new client
63-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
64-
65-
# Load a file from disk
66-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
67-
result = mindee_client.parse(
68-
input_source,
69-
Mindee::Product::Invoice::InvoiceV4
70-
)
71-
72-
# Print a full summary of the parsed data in RST format
73-
puts result.document
74-
```
75-
76-
**Note:** Files can also be loaded from:
77-
78-
A URL (`https`):
79-
80-
```rb
81-
input_source = mindee_client.source_from_url("https://my-url")
82-
```
83-
84-
A bytes input stream:
85-
86-
```rb
87-
input_source = mindee_client.source_from_bytes('/path/to/the/file.ext', "name-of-my-file.ext")
88-
```
89-
90-
A base64 encoded string:
91-
92-
```rb
93-
input_source = mindee_client.source_from_b64string('/path/to/the/file.ext', "name-of-my-file.ext")
94-
```
95-
96-
A ruby `file` object:
97-
98-
```rb
99-
input_source = mindee_client.source_from_file(input_file, "name-of-my-file.ext")
100-
```
101-
102-
#### Region-Specific Documents
103-
104-
```ruby
105-
require 'mindee'
106-
107-
# Init a new client
108-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
109-
110-
# Load a file from disk
111-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
112-
113-
result = mindee_client.parse(
114-
input_source,
115-
Mindee::Product::EU::LicensePlate::LicensePlateV1
116-
)
117-
118-
# Print a full summary of the parsed data in RST format
119-
puts result.document
120-
```
121-
122-
### Universal - All Other Documents
123-
124-
The Universal product acts as a catch-all for every and any API if it doesn't have an assigned product name.
125-
126-
```ruby
127-
require 'mindee'
128-
129-
# Init a new client and configure your custom document
130-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
131-
endpoint = mindee_client.create_endpoint(
132-
endpoint_name: 'my-endpoint',
133-
account_name: 'my-account'
134-
)
135-
136-
# Load a file from disk
137-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
138-
139-
result = mindee_client.parse(
140-
input_source,
141-
Mindee::Product::Universal::Universal,
142-
endpoint: endpoint
143-
)
144-
145-
# Print a full summary of the parsed data in RST format
146-
puts result.document
147-
148-
# Looping over all prediction values
149-
result.document.inference.prediction.fields.each do |field_name, field_data|
150-
puts field_name
151-
puts field_data.values
152-
puts field_data.to_s
153-
end
154-
```
155-
156-
157-
## Enqueueing and Parse a Webhook Response
158-
159-
This is an optional way of handling asynchronous APIs.
160-
161-
```rb
162-
require 'mindee'
163-
164-
# Init a new client
165-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
166-
167-
# Load a file from disk
168-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
169-
170-
171-
# Send the file to the server
172-
enqueue_response = mindee_client.enqueue(
173-
input_source,
174-
Mindee::Product::InternationalId::InternationalIdV2
175-
)
176-
177-
job_id = enqueue_response.job.id
178-
179-
# Load the JSON string sent by the Mindee webhook POST callback.
180-
# Reading the callback data will vary greatly depending on your HTTP server.
181-
# This is therefore beyond the scope of this example.
182-
183-
local_response = Mindee::Input::LocalResponse.new(request.body.string)
184-
185-
# You can also use a File object as the input.
186-
# FILE_PATH = File.join('path', 'to', 'file.json').freeze
187-
# local_response = Mindee::Input::LocalResponse.new(FILE_PATH);
188-
189-
# Optional: verify the HMAC signature.
190-
unless local_response.valid_hmac_signature?(my_secret_key, 'invalid signature')
191-
raise "Invalid HMAC signature!"
192-
end
193-
194-
195-
# Deserialize the response:
196-
result = mindee_client.load_prediction(
197-
Mindee::Product::InternationalId::InternationalIdV2,
198-
local_response
199-
)
200-
201-
# Print a full summary of the parsed data in RST format
202-
puts result.document
203-
```
204-
205-
206-
## CLI Tool
207-
208-
A command-line interface tool is available to quickly test documents:
209-
210-
```sh
211-
ruby ./bin/mindee.rb <product_name> path/to/your/file.ext
212-
```
213-
214-
Using the ruby bundler:
215-
216-
```sh
217-
bundle exec ruby ./bin/mindee.rb <product_name> path/to/your/file.ext
218-
```
219-
220-
Where possible values for `<product_name>` can be displayed by running the command with no arguments.
221-
222-
## Further Reading
223-
224-
There's more to it than that for those that need more features, or want to
225-
customize the experience.
226-
227-
* [Ruby Overview](https://developers.mindee.com/docs/ruby-getting-started)
228-
* [Common file operations](https://developers.mindee.com/docs/ruby-common-file-operations)
229-
* [Global products](https://developers.mindee.com/docs/ruby-global-products)
230-
* [Localized products](https://developers.mindee.com/docs/ruby-localized-products)
231-
232-
You can also take a look at the
233-
[Reference Documentation](https://mindee.github.io/mindee-api-ruby/).
234-
235-
## License
236-
237-
Copyright © Mindee, SA
238-
239-
Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
240-
241-
## Questions?
242-
243-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
42+
Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

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 = '4.6.0'
6+
VERSION = '4.7.0-rc1'
77

88
# Finds and return the current platform.
99
# @return [Symbol, Hash[String | Symbol, Regexp], Nil?]

0 commit comments

Comments
 (0)