mindee 5.0.0 → 5.2.0
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 +11 -0
- data/docs/code_samples/v2_extraction.txt +7 -0
- data/lib/mindee/v2/parsing/field/simple_field.rb +32 -0
- data/lib/mindee/v2/parsing/search/model_webhook.rb +38 -0
- data/lib/mindee/v2/parsing/search/search_model.rb +7 -0
- data/lib/mindee/v2/parsing/search/search_models.rb +1 -0
- data/lib/mindee/v2/parsing/search/search_response.rb +2 -2
- data/lib/mindee/v2/parsing/search.rb +1 -0
- data/lib/mindee/v2/product/classification/classification_classifier.rb +6 -0
- data/lib/mindee/v2/product/crop/crop_item.rb +6 -0
- data/lib/mindee/v2/product/split/split_range.rb +6 -0
- data/lib/mindee/version.rb +1 -1
- data/sig/mindee/v2/parsing/field/simple_field.rbs +5 -1
- data/sig/mindee/v2/parsing/search/model_webhook.rbs +19 -0
- data/sig/mindee/v2/parsing/search/search_model.rbs +1 -0
- data/sig/mindee/v2/product/classification/classification_classifier.rbs +1 -0
- data/sig/mindee/v2/product/crop/crop_item.rbs +2 -1
- data/sig/mindee/v2/product/split/split_range.rbs +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4035b0201f4458b0bdb6066c4602d132ef2695436d47d2c36f27a5eccf8c5af8
|
|
4
|
+
data.tar.gz: dfa07b33ef6c2da5f5d973fa47c01ff969bcd011e3b595785f2f06dd411b4c4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 620d7b8e30cb6368451485d4119a357f991b5105c73d7407d18294ef440c17d2d0602960a00742fb5a3969d33cd7308a8771833bb01fd2fb8bfd74eb64fc5fef
|
|
7
|
+
data.tar.gz: 10644668f5aa9b0c2848e252cfe8174368c3bd49f5483028c9d0a7e316356986c0300acd875e162156e5338ff53d3d297e47aec5fd33ca9824e39d3d3181272b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Mindee Ruby API Library Changelog
|
|
2
2
|
|
|
3
|
+
## v5.2.0 - 2026-05-19
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add webhook info to model searches
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v5.1.0 - 2026-05-13
|
|
9
|
+
### Changes
|
|
10
|
+
* :sparkles: Add support for extraction in crop, split, and classify products
|
|
11
|
+
* :sparkles: add typed accessors for SimpleField
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## v5.0.0 - 2026-04-20
|
|
4
15
|
### ¡Breaking Changes!
|
|
5
16
|
* :boom: :recycle: update V1 & V2 syntaxes to match other SDKs
|
|
@@ -40,3 +40,10 @@ response = mindee_client.enqueue_and_get_result(
|
|
|
40
40
|
|
|
41
41
|
# Print a brief summary of the parsed data
|
|
42
42
|
puts response.inference
|
|
43
|
+
|
|
44
|
+
# Access the result fields
|
|
45
|
+
fields = response.inference.result.fields
|
|
46
|
+
|
|
47
|
+
# fields.get_simple_field('my_simple_field')
|
|
48
|
+
# fields.get_list_field('my_list_field')
|
|
49
|
+
# fields.get_object_field('my_object_field')
|
|
@@ -38,6 +38,38 @@ module Mindee
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
# Retrieves the field value as a Float.
|
|
42
|
+
# @return [Float, nil]
|
|
43
|
+
# @raise [RuntimeError] If the value is not a Float.
|
|
44
|
+
def float_value
|
|
45
|
+
raise "Value is not a float: #{@value.class}" unless @value.nil? || @value.is_a?(Float)
|
|
46
|
+
|
|
47
|
+
val = @value
|
|
48
|
+
val.is_a?(Float) ? val : nil # @type var val: Float | nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Retrieves the field value as a String.
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
# @raise [RuntimeError] If the value is not a String.
|
|
54
|
+
def string_value
|
|
55
|
+
raise "Value is not a string: #{@value.class}" unless @value.nil? || @value.is_a?(String)
|
|
56
|
+
|
|
57
|
+
val = @value
|
|
58
|
+
val.is_a?(String) ? val : nil # @type var val: String | nil
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Retrieves the field value as a Boolean.
|
|
62
|
+
# @return [Boolean, nil]
|
|
63
|
+
# @raise [RuntimeError] If the value is not a Boolean.
|
|
64
|
+
def boolean_value
|
|
65
|
+
unless @value.nil? || @value.is_a?(TrueClass) || @value.is_a?(FalseClass)
|
|
66
|
+
raise "Value is not a boolean: #{@value.class}"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
val = @value
|
|
70
|
+
@value.is_a?(TrueClass) || @value.is_a?(FalseClass) ? val : nil # @type var val: bool | nil
|
|
71
|
+
end
|
|
72
|
+
|
|
41
73
|
private
|
|
42
74
|
|
|
43
75
|
# Format numeric values to display '.0' in string reps.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mindee
|
|
4
|
+
module V2
|
|
5
|
+
module Parsing
|
|
6
|
+
module Search
|
|
7
|
+
# Individual webhook information.
|
|
8
|
+
class ModelWebhook
|
|
9
|
+
# @return [String] ID of the webhook.
|
|
10
|
+
attr_reader :id
|
|
11
|
+
|
|
12
|
+
# @return [String] Name of the webhook.
|
|
13
|
+
attr_reader :name
|
|
14
|
+
|
|
15
|
+
# @return [String] URL of the webhook.
|
|
16
|
+
attr_reader :url
|
|
17
|
+
|
|
18
|
+
# @param payload [Hash] The parsed JSON payload mapping to the search model.
|
|
19
|
+
def initialize(payload)
|
|
20
|
+
@id = payload['id']
|
|
21
|
+
@name = payload['name']
|
|
22
|
+
@url = payload['url']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# String representation of the model.
|
|
26
|
+
# @return [String]
|
|
27
|
+
def to_s
|
|
28
|
+
[
|
|
29
|
+
":Name: #{@name}",
|
|
30
|
+
":ID: #{@id}",
|
|
31
|
+
":URL: #{@url}",
|
|
32
|
+
].join("\n")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'model_webhook'
|
|
4
|
+
|
|
3
5
|
module Mindee
|
|
4
6
|
module V2
|
|
5
7
|
module Parsing
|
|
@@ -15,11 +17,15 @@ module Mindee
|
|
|
15
17
|
# @return [String] Type of the model.
|
|
16
18
|
attr_reader :model_type
|
|
17
19
|
|
|
20
|
+
# @return [Array<ModelWebhook>] List of webhooks associated with the model.
|
|
21
|
+
attr_reader :webhooks
|
|
22
|
+
|
|
18
23
|
# @param payload [Hash] The parsed JSON payload mapping to the search model.
|
|
19
24
|
def initialize(payload)
|
|
20
25
|
@id = payload['id']
|
|
21
26
|
@name = payload['name']
|
|
22
27
|
@model_type = payload['model_type']
|
|
28
|
+
@webhooks = (payload['webhooks'] || []).map { |w| ModelWebhook.new(w) }
|
|
23
29
|
end
|
|
24
30
|
|
|
25
31
|
# String representation of the model.
|
|
@@ -29,6 +35,7 @@ module Mindee
|
|
|
29
35
|
":Name: #{@name}",
|
|
30
36
|
":ID: #{@id}",
|
|
31
37
|
":Model Type: #{@model_type}",
|
|
38
|
+
":Webhooks: #{@webhooks.join("\n")}",
|
|
32
39
|
].join("\n")
|
|
33
40
|
end
|
|
34
41
|
end
|
|
@@ -8,10 +8,16 @@ module Mindee
|
|
|
8
8
|
class ClassificationClassifier
|
|
9
9
|
# @return [String] The document type, as identified on given classification values.
|
|
10
10
|
attr_reader :document_type
|
|
11
|
+
attr_reader :extraction_response
|
|
11
12
|
|
|
12
13
|
# @param server_response [Hash] Hash representation of the JSON returned by the service.
|
|
13
14
|
def initialize(server_response)
|
|
14
15
|
@document_type = server_response['document_type']
|
|
16
|
+
# rubocop:disable Style/GuardClause
|
|
17
|
+
unless server_response['extraction_response'].nil?
|
|
18
|
+
@extraction_response = V2::Product::Extraction::ExtractionResponse.new(server_response['extraction_response'])
|
|
19
|
+
end
|
|
20
|
+
# rubocop:enable Style/GuardClause
|
|
15
21
|
end
|
|
16
22
|
|
|
17
23
|
# @return [String] String representation.
|
|
@@ -10,11 +10,17 @@ module Mindee
|
|
|
10
10
|
attr_reader :object_type
|
|
11
11
|
# @return [V2::Parsing::Field::FieldLocation] Coordinates of the detected object on the document.
|
|
12
12
|
attr_reader :location
|
|
13
|
+
attr_reader :extraction_response
|
|
13
14
|
|
|
14
15
|
# @param server_response [Hash] Hash representation of the JSON returned by the service.
|
|
15
16
|
def initialize(server_response)
|
|
16
17
|
@object_type = server_response['object_type']
|
|
17
18
|
@location = Mindee::V2::Parsing::Field::FieldLocation.new(server_response['location'])
|
|
19
|
+
# rubocop:disable Style/GuardClause
|
|
20
|
+
unless server_response['extraction_response'].nil?
|
|
21
|
+
@extraction_response = V2::Product::Extraction::ExtractionResponse.new(server_response['extraction_response'])
|
|
22
|
+
end
|
|
23
|
+
# rubocop:enable Style/GuardClause
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
# String representation.
|
|
@@ -11,11 +11,17 @@ module Mindee
|
|
|
11
11
|
attr_reader :page_range
|
|
12
12
|
# @return [String] The document type, as identified on given classification values.
|
|
13
13
|
attr_reader :document_type
|
|
14
|
+
attr_reader :extraction_response
|
|
14
15
|
|
|
15
16
|
# @param server_response [Hash] Hash representation of the JSON returned by the service.
|
|
16
17
|
def initialize(server_response)
|
|
17
18
|
@page_range = server_response['page_range']
|
|
18
19
|
@document_type = server_response['document_type']
|
|
20
|
+
# rubocop:disable Style/GuardClause
|
|
21
|
+
unless server_response['extraction_response'].nil?
|
|
22
|
+
@extraction_response = V2::Product::Extraction::ExtractionResponse.new(server_response['extraction_response'])
|
|
23
|
+
end
|
|
24
|
+
# rubocop:enable Style/GuardClause
|
|
19
25
|
end
|
|
20
26
|
|
|
21
27
|
# String representation.
|
data/lib/mindee/version.rb
CHANGED
|
@@ -4,9 +4,13 @@ module Mindee
|
|
|
4
4
|
module Parsing
|
|
5
5
|
module Field
|
|
6
6
|
class SimpleField < BaseField
|
|
7
|
-
attr_reader value: String |
|
|
7
|
+
attr_reader value: String | Float | bool | nil
|
|
8
8
|
|
|
9
9
|
def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void
|
|
10
|
+
def boolean_value: -> (bool | nil)
|
|
11
|
+
def float_value: -> (Float | nil)
|
|
12
|
+
def string_value: -> (String | nil)
|
|
13
|
+
|
|
10
14
|
def to_s: -> String
|
|
11
15
|
def format_numeric_value: (Integer | Float) -> String
|
|
12
16
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# lib/mindee/v2/parsing/search/model_webhook.rb
|
|
2
|
+
|
|
3
|
+
module Mindee
|
|
4
|
+
module V2
|
|
5
|
+
module Parsing
|
|
6
|
+
module Search
|
|
7
|
+
class ModelWebhook
|
|
8
|
+
attr_reader id: String
|
|
9
|
+
attr_reader name: String
|
|
10
|
+
attr_reader url: String
|
|
11
|
+
|
|
12
|
+
def initialize: (Hash[String | Symbol, untyped]) -> void
|
|
13
|
+
|
|
14
|
+
def to_s: -> String
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -3,8 +3,9 @@ module Mindee
|
|
|
3
3
|
module Product
|
|
4
4
|
module Crop
|
|
5
5
|
class CropItem
|
|
6
|
+
attr_reader extraction_response: Extraction::ExtractionResponse
|
|
6
7
|
attr_reader object_type: String
|
|
7
|
-
attr_reader location:
|
|
8
|
+
attr_reader location: Parsing::Field::FieldLocation
|
|
8
9
|
|
|
9
10
|
def initialize: (Hash[String | Symbol, untyped]) -> void
|
|
10
11
|
|
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: 5.
|
|
4
|
+
version: 5.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mindee, SA
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -430,6 +430,7 @@ files:
|
|
|
430
430
|
- lib/mindee/v2/parsing/raw_text.rb
|
|
431
431
|
- lib/mindee/v2/parsing/raw_text_page.rb
|
|
432
432
|
- lib/mindee/v2/parsing/search.rb
|
|
433
|
+
- lib/mindee/v2/parsing/search/model_webhook.rb
|
|
433
434
|
- lib/mindee/v2/parsing/search/pagination_metadata.rb
|
|
434
435
|
- lib/mindee/v2/parsing/search/search_model.rb
|
|
435
436
|
- lib/mindee/v2/parsing/search/search_models.rb
|
|
@@ -648,6 +649,7 @@ files:
|
|
|
648
649
|
- sig/mindee/v2/parsing/rag_metadata.rbs
|
|
649
650
|
- sig/mindee/v2/parsing/raw_text.rbs
|
|
650
651
|
- sig/mindee/v2/parsing/raw_text_page.rbs
|
|
652
|
+
- sig/mindee/v2/parsing/search/model_webhook.rbs
|
|
651
653
|
- sig/mindee/v2/parsing/search/pagination_metadata.rbs
|
|
652
654
|
- sig/mindee/v2/parsing/search/search_model.rbs
|
|
653
655
|
- sig/mindee/v2/parsing/search/search_response.rbs
|