mindee-lite 5.0.0.rc1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e3f594fd19a65af160aa57c2be44b60a512671b2e73492520eee97c28cbaa64
4
- data.tar.gz: fe9fa1d790baa59e5c8724bcd044470989b1b53fb01a1c3d97837a4aefaf107e
3
+ metadata.gz: 4e134080cbd8093de8ce96f6fbcdd9cf2bf053637e9c35cc4e141feb1d1114b2
4
+ data.tar.gz: a97c1266cde82d49f8fa209fa74cd370ed6da523a1f67e12f2c4f18f4cdc27bc
5
5
  SHA512:
6
- metadata.gz: aae1932c173406f33a3afbe76181324bb6573f23afed02e4ae3f883fa346b3f0f543612f650682a03ddbbc88dbef6ef1e38f4ee555ec38a642ee9645613366de
7
- data.tar.gz: e02b2e5c32354e4ddd98c9bc75ce8a2ffe89894fb611015840f5d8d2a11248ef1963c733ff76918604d9fc6ccc31e695b83985a54db1bcfb410b7c26cd46e601
6
+ metadata.gz: 2d3cbcb02edb9ef33a327b660c073fa926d76d85ca4a46af7ee21c8e10ac9c4086dbf4b85c82918bf676649f38e56b785cddaaa58dce3c32c8dada4330af23be
7
+ data.tar.gz: c542570b0402468b1882739d33fcca7a2ecc1d98ca2deda95a92d41b4c3576bfaf8f1f3c721d3c29a7618fba0716ab8551190a1576d360341e103808c81bd9a2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
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
+
9
+ ## v5.0.0 - 2026-04-20
10
+ ### ¡Breaking Changes!
11
+ * :boom: :recycle: update V1 & V2 syntaxes to match other SDKs
12
+ * :recycle: move V1 client to V1 module
13
+ * :recycle: move V2 client to V2 module
14
+ * :recycle: move legacy products to 'V1' module
15
+ * :recycle: add parsing and extraction to v1 module
16
+ * :recycle: move V1 HTTP to V1 module
17
+ * :recycle: move V2 HTTP module to V2 namespace
18
+ * :recycle: move data schema to extraction parameters namespace
19
+ * :arrow_up: :boom: drop support for ruby < 3.2
20
+ * :recycle: :boom: change raw_http attribute in responses to be actual json strings
21
+ * :recycle: :boom: make logging configurable and default output to stderr
22
+ * :recycle: :boom: remove useless `PDFExtractor` module
23
+ * :recycle: :boom: change `Errors` module to `Error`
24
+ * :recycle: :boom: change Ocr modules and classes to OCR to keep consistency
25
+ * :recycle: :boom: change `FileOperation` module name to `FileOperations`
26
+ * :recycle: :boom: change `Dependency` module name to `Dependencies`
27
+ * :boom: remove support for the following V1 products:
28
+ * :coffin: US Bank Check V1
29
+ * :coffin: Bill of Lading V1
30
+ * :coffin: Business Card V1
31
+ * :coffin: FR Carte Grise V1
32
+ * :coffin: Delivery Notes V1
33
+ * :coffin: Driver License V1
34
+ * :coffin: FR Energy Bill V1
35
+ * :coffin: Nutrition Facts V1
36
+ ### Changes
37
+ * :sparkles: :arrow_up: add support for mindee-lite gem
38
+ * :sparkles: add support for crop operation
39
+ * :sparkles: add support for split operation
40
+ * :sparkles: add support for model search
41
+ * :sparkles: add support for V2 CLI
42
+ * :wrench: :arrow_up: add better tooling and pre-commit hook
43
+ * :arrow_up: and bump all dependencies
44
+ ### Fixes
45
+ * :wrench: fix many typing issues
46
+ * :bug: fix webhook IDs not sending properly
47
+ * :bug: fix miscellaneous issues leading to saved `ExtractedPDF` instances having invalid names
48
+ * :recycle: fix miscellaneous typing issues relating to `ExtractedPDF` and `ExtractedImage` classes
49
+
50
+
3
51
  ## v5.0.0.rc1 - 2026-04-15
4
52
  ### ¡Breaking Changes!
5
53
  * :recycle: :boom: change `FileOperation` module name to `FileOperations`
@@ -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.
@@ -3,7 +3,7 @@
3
3
  # Mindee
4
4
  module Mindee
5
5
  # Current version.
6
- VERSION = '5.0.0.rc1'
6
+ VERSION = '5.1.0'
7
7
 
8
8
  # Finds and return the current platform.
9
9
  # @return [Symbol, Hash[String | Symbol, Regexp], Nil?]
@@ -4,9 +4,13 @@ module Mindee
4
4
  module Parsing
5
5
  module Field
6
6
  class SimpleField < BaseField
7
- attr_reader value: String | Integer | Float | bool | nil
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
@@ -6,6 +6,7 @@ module Mindee
6
6
  module Classification
7
7
  class ClassificationClassifier
8
8
  attr_reader document_type: String
9
+ attr_reader extraction_response: Extraction::ExtractionResponse
9
10
 
10
11
  def initialize: (Hash[String | Symbol, untyped]) -> void
11
12
  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: Mindee::V2::Parsing::Field::FieldLocation
8
+ attr_reader location: Parsing::Field::FieldLocation
8
9
 
9
10
  def initialize: (Hash[String | Symbol, untyped]) -> void
10
11
 
@@ -3,6 +3,7 @@ module Mindee
3
3
  module Product
4
4
  module Split
5
5
  class SplitRange
6
+ attr_reader extraction_response: Extraction::ExtractionResponse
6
7
  attr_reader page_range: Array[Integer]
7
8
  attr_reader document_type: String
8
9
 
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.0.0.rc1
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-04-15 00:00:00.000000000 Z
11
+ date: 2026-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -589,9 +589,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
589
589
  version: '3.2'
590
590
  required_rubygems_version: !ruby/object:Gem::Requirement
591
591
  requirements:
592
- - - ">"
592
+ - - ">="
593
593
  - !ruby/object:Gem::Version
594
- version: 1.3.1
594
+ version: '0'
595
595
  requirements: []
596
596
  rubygems_version: 3.4.19
597
597
  signing_key: