Ruby OCR SDK

Mindee API Helper Library for Ruby

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

Requirements

The following Ruby versions are tested and supported: 3.0, 3.1, 3.2, 3.3, 3.4

Quick Start

Here's the TL;DR of getting started.

First, get an API Key

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

gem 'mindee'

And then execute:

bundle install

Finally, Ruby away!

Environment Variables

This library offers customizable features through environment variables. While there may be instances where you need to rely on them, it's crucial to exercise caution when modifying them to avoid unintended consequences.

If you're unsure whether you need to adjust these variables, it's advisable to refrain from doing so unless you have a specific reason. Accidentally overwriting them can lead to unexpected behavior.

Before making any changes, we recommend reviewing the following information to understand the purpose and potential impact of each environment variable:

  • MINDEE_API_KEY:

    • Description: Your personal Mindee API Key as shown on the platform. Be careful not to show this publicly!

    • Default Value: nil

  • MINDEE_BASE_URL:

    • 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.

    • Default Value: https://api.mindee.net/v1

  • MINDEE_REQUEST_TIMEOUT:

    • Description: The default timeout for HTTP requests (in seconds).

    • Default Value: 120

  • MINDEE_LOG_LEVEL:

    • Description: The default logging level for the mindee logger.

    • Default Value: WARN

Loading a File and Parsing It

Global Documents

Note: Files can also be loaded from:

A URL (https):

A bytes input stream:

A base64 encoded string:

A ruby file object:

Region-Specific Documents

Universal - All Other Documents

The Universal product acts as a catch-all for every and any API if it doesn't have an assigned product name.

Enqueueing and Parse a Webhook Response

This is an optional way of handling asynchronous APIs.

CLI Tool

A command-line interface tool is available to quickly test documents:

Using the ruby bundler:

Where possible values for <product_name> can be displayed by running the command with no arguments.

Further Reading

Take a look at the Reference Documentation.

License

Copyright © Mindee, SA

Available as open source under the terms of the MIT License.

Last updated

Was this helpful?