mindee-lite 5.0.0 → 5.1.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 +6 -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/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/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 +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e134080cbd8093de8ce96f6fbcdd9cf2bf053637e9c35cc4e141feb1d1114b2
|
|
4
|
+
data.tar.gz: a97c1266cde82d49f8fa209fa74cd370ed6da523a1f67e12f2c4f18f4cdc27bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d3cbcb02edb9ef33a327b660c073fa926d76d85ca4a46af7ee21c8e10ac9c4086dbf4b85c82918bf676649f38e56b785cddaaa58dce3c32c8dada4330af23be
|
|
7
|
+
data.tar.gz: c542570b0402468b1882739d33fcca7a2ecc1d98ca2deda95a92d41b4c3576bfaf8f1f3c721d3c29a7618fba0716ab8551190a1576d360341e103808c81bd9a2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Mindee Ruby API Library Changelog
|
|
2
2
|
|
|
3
|
+
## v5.1.0 - 2026-05-13
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: Add support for extraction in crop, split, and classify products
|
|
6
|
+
* :sparkles: add typed accessors for SimpleField
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
## v5.0.0 - 2026-04-20
|
|
4
10
|
### ¡Breaking Changes!
|
|
5
11
|
* :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.
|
|
@@ -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
|
|
@@ -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-lite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.1.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-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|