Skip to content

Commit 70a84c3

Browse files
♻️ update test lib + update doc (#88)
1 parent e58d777 commit 70a84c3

3 files changed

Lines changed: 69 additions & 4 deletions

File tree

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[![License: MIT](https://img.shields.io/github/license/mindee/mindee-api-ruby)](https://opensource.org/licenses/MIT) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mindee/mindee-api-ruby/test.yml)](https://github.com/mindee/mindee-api-ruby) [![Gem Version](https://img.shields.io/gem/v/mindee)](https://rubygems.org/gems/mindee) [![Downloads](https://img.shields.io/gem/dt/mindee.svg)](https://rubygems.org/gems/mindee)
22

33
# Mindee API Helper Library for Ruby
4+
45
Quickly and easily connect to Mindee's API services using Ruby.
56

67
## Requirements
8+
79
The following Ruby versions are tested and supported: 2.6, 2.7, 3.0, 3.1, 3.2
810

911
## Quick Start
12+
1013
Here's the TL;DR of getting started.
1114

1215
First, get an [API Key](https://developers.mindee.com/docs/create-api-key)
@@ -18,15 +21,38 @@ gem 'mindee'
1821
```
1922

2023
And then execute:
24+
2125
```sh
2226
bundle install
2327
```
2428

2529
Finally, Ruby away!
2630

31+
### Environment Variables
32+
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.
35+
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.
38+
39+
Before making any changes, we recommend reviewing the following information to understand the purpose and potential
40+
impact of each environment variable:
41+
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+
2752
### Loading a File and Parsing It
2853

2954
#### Global Documents
55+
3056
```ruby
3157
require 'mindee'
3258

@@ -47,26 +73,31 @@ puts result.document
4773
**Note:** Files can also be loaded from:
4874

4975
A URL (`https`):
76+
5077
```rb
5178
input_source = mindee_client.source_from_url("https://my-url")
5279
```
5380

5481
A bytes input stream:
82+
5583
```rb
5684
input_source = mindee_client.source_from_bytes('/path/to/the/file.ext', "name-of-my-file.ext")
5785
```
5886

5987
A base64 encoded string:
88+
6089
```rb
6190
input_source = mindee_client.source_from_b64string('/path/to/the/file.ext', "name-of-my-file.ext")
6291
```
6392

6493
A ruby `file` object:
94+
6595
```rb
6696
input_source = mindee_client.source_from_file(input_file, "name-of-my-file.ext")
6797
```
6898

6999
#### Region-Specific Documents
100+
70101
```ruby
71102
require 'mindee'
72103

@@ -86,6 +117,7 @@ puts result.document
86117
```
87118

88119
### Custom Document (API Builder)
120+
89121
```ruby
90122
require 'mindee'
91123

@@ -119,17 +151,19 @@ end
119151
## CLI Tool
120152

121153
A command-line interface tool is available to quickly test documents:
154+
122155
```sh
123156
ruby ./bin/mindee.rb invoice path/to/your/file.ext
124157
```
125158

126-
127159
Using the ruby bundler:
160+
128161
```sh
129162
bundle exec ruby ./bin/mindee.rb invoice path/to/your/file.ext
130163
```
131164

132165
## Further Reading
166+
133167
There's more to it than that for those that need more features, or want to
134168
customize the experience.
135169

@@ -157,15 +191,15 @@ customize the experience.
157191
* [Invoice Splitter API Ruby](https://developers.mindee.com/docs/invoice-splitter-api-ruby)
158192
* [Multi Receipts Detector API Ruby](https://developers.mindee.com/docs/multi-receipts-detector-api-ruby)
159193

160-
161194
You can also take a look at the
162195
[Reference Documentation](https://mindee.github.io/mindee-api-ruby/).
163196

164-
165197
## License
198+
166199
Copyright © Mindee, SA
167200

168201
Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
169202

170203
## Questions?
204+
171205
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)

docs/international_id_v2.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@ puts result.document
3131

3232
**Output (RST):**
3333
```rst
34+
########
35+
Document
36+
########
37+
:Mindee ID: cfa20a58-20cf-43b6-8cec-9505fa69d1c2
38+
:Filename: default_sample.jpg
39+
40+
Inference
41+
#########
42+
:Product: mindee/international_id v2.0
43+
:Rotation applied: No
44+
45+
Prediction
46+
==========
47+
:Document Type: IDENTIFICATION_CARD
48+
:Document Number: 12345678A
49+
:Surnames: MUESTRA
50+
MUESTRA
51+
:Given Names: CARMEN
52+
:Sex: F
53+
:Birth Date: 1980-01-01
54+
:Birth Place: CAMPO DE CRIPTANA CIUDAD REAL ESPANA
55+
:Nationality: ESP
56+
:Personal Number: BAB1834284<44282767Q0
57+
:Country of Issue: ESP
58+
:State of Issue: MADRID
59+
:Issue Date:
60+
:Expiration Date: 2030-01-01
61+
:Address: C/REAL N13, 1 DCHA COLLADO VILLALBA MADRID MADRID MADRID
62+
:MRZ Line 1: IDESPBAB1834284<44282767Q0<<<<
63+
:MRZ Line 2: 8001010F1301017ESP<<<<<<<<<<<3
64+
:MRZ Line 3: MUESTRA<MUESTRA<<CARMEN<<<<<<<
3465
```
3566

3667
# Field Types

spec/data

0 commit comments

Comments
 (0)