mindee 5.5.0 → 5.6.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.betterleaks.toml +15 -0
  3. data/.editorconfig +1 -1
  4. data/CHANGELOG.md +6 -0
  5. data/CONTRIBUTING.md +11 -51
  6. data/bin/v1/products.rb +0 -6
  7. data/lib/mindee/v1/client.rb +1 -74
  8. data/lib/mindee/v1/http.rb +0 -1
  9. data/lib/mindee/v1/product.rb +0 -3
  10. data/lib/mindee/v2/client.rb +45 -26
  11. data/lib/mindee/v2/http/mindee_api_v2.rb +34 -49
  12. data/lib/mindee/v2/product/classification/classification_classifier.rb +5 -4
  13. data/lib/mindee/v2/product/crop/crop_item.rb +5 -4
  14. data/lib/mindee/v2/product/split/split_range.rb +5 -4
  15. data/lib/mindee/v2/search/models/model_search_parameters.rb +8 -5
  16. data/lib/mindee/version.rb +1 -1
  17. data/mindee.gemspec +1 -2
  18. data/prek.toml +45 -0
  19. data/sig/mindee/v1/client.rbs +1 -15
  20. data/sig/mindee/v2/client.rbs +4 -0
  21. data/sig/mindee/v2/http/mindee_api_v2.rbs +7 -9
  22. data/sig/mindee/v2/product/classification/classification_classifier.rbs +1 -1
  23. data/sig/mindee/v2/product/crop/crop_item.rbs +1 -1
  24. data/sig/mindee/v2/product/split/split_range.rbs +1 -1
  25. metadata +7 -45
  26. data/.git-hooks/pre_commit/gitleaks.rb +0 -19
  27. data/.overcommit.yml +0 -46
  28. data/docs/code_samples/bank_account_details_v1.txt +0 -24
  29. data/docs/code_samples/barcode_reader_v1.txt +0 -24
  30. data/docs/code_samples/idcard_fr_v1.txt +0 -24
  31. data/docs/code_samples/workflow_execution.txt +0 -28
  32. data/lib/mindee/v1/http/workflow_endpoint.rb +0 -93
  33. data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1.rb +0 -47
  34. data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rb +0 -47
  35. data/lib/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rb +0 -38
  36. data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rb +0 -49
  37. data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rb +0 -49
  38. data/lib/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rb +0 -40
  39. data/lib/mindee/v1/product/fr/id_card/id_card_v1.rb +0 -49
  40. data/lib/mindee/v1/product/fr/id_card/id_card_v1_document.rb +0 -106
  41. data/lib/mindee/v1/product/fr/id_card/id_card_v1_page.rb +0 -57
  42. data/sig/mindee/v1/http/workflow_endpoint.rbs +0 -22
  43. data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1.rbs +0 -13
  44. data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rbs +0 -16
  45. data/sig/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rbs +0 -17
  46. data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1.rbs +0 -15
  47. data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_document.rbs +0 -19
  48. data/sig/mindee/v1/product/fr/bank_account_details/bank_account_details_v1_page.rbs +0 -19
  49. data/sig/mindee/v1/product/fr/id_card/id_card_v1.rbs +0 -15
  50. data/sig/mindee/v1/product/fr/id_card/id_card_v1_document.rbs +0 -26
  51. data/sig/mindee/v1/product/fr/id_card/id_card_v1_page.rbs +0 -20
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../parsing'
4
- require_relative 'barcode_reader_v1_document'
5
-
6
- module Mindee
7
- module V1
8
- module Product
9
- module BarcodeReader
10
- # Barcode Reader API version 1.0 page data.
11
- class BarcodeReaderV1Page < Mindee::V1::Parsing::Common::Page
12
- # @param prediction [Hash]
13
- def initialize(prediction)
14
- super
15
- @prediction = if prediction['prediction'].empty?
16
- nil
17
- else
18
- BarcodeReaderV1PagePrediction.new(
19
- prediction['prediction'],
20
- prediction['id']
21
- )
22
- end
23
- end
24
- end
25
-
26
- # Barcode Reader V1 page prediction.
27
- class BarcodeReaderV1PagePrediction < BarcodeReaderV1Document
28
- # @return [String]
29
- def to_s
30
- out_str = String.new
31
- out_str << "\n#{super}"
32
- out_str
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'bank_account_details_v1_document'
5
- require_relative 'bank_account_details_v1_page'
6
-
7
- module Mindee
8
- module V1
9
- module Product
10
- module FR
11
- # Bank Account Details module.
12
- module BankAccountDetails
13
- # Bank Account Details API version 1 inference prediction.
14
- class BankAccountDetailsV1 < Mindee::V1::Parsing::Common::Inference
15
- @endpoint_name = 'bank_account_details'
16
- @endpoint_version = '1'
17
- @has_async = false
18
- @has_sync = true
19
-
20
- # @param prediction [Hash]
21
- def initialize(prediction)
22
- super
23
- @prediction = BankAccountDetailsV1Document.new(prediction['prediction'], nil)
24
- @pages = []
25
- prediction['pages'].each do |page|
26
- @pages.push(BankAccountDetailsV1Page.new(page))
27
- end
28
- end
29
-
30
- class << self
31
- # Name of the endpoint for this product.
32
- # @return [String]
33
- attr_reader :endpoint_name
34
- # Version for this product.
35
- # @return [String]
36
- attr_reader :endpoint_version
37
- # Whether this product has access to an asynchronous endpoint.
38
- # @return [bool]
39
- attr_reader :has_async
40
- # Whether this product has access to synchronous endpoint.
41
- # @return [bool]
42
- attr_reader :has_sync
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module V1
7
- module Product
8
- module FR
9
- module BankAccountDetails
10
- # Bank Account Details API version 1.0 document data.
11
- class BankAccountDetailsV1Document < Mindee::V1::Parsing::Common::Prediction
12
- include Mindee::V1::Parsing::Standard
13
-
14
- # The name of the account holder as seen on the document.
15
- # @return [Mindee::V1::Parsing::Standard::StringField]
16
- attr_reader :account_holder_name
17
- # The International Bank Account Number (IBAN).
18
- # @return [Mindee::V1::Parsing::Standard::StringField]
19
- attr_reader :iban
20
- # The bank's SWIFT Business Identifier Code (BIC).
21
- # @return [Mindee::V1::Parsing::Standard::StringField]
22
- attr_reader :swift
23
-
24
- # @param prediction [Hash]
25
- # @param page_id [Integer, nil]
26
- def initialize(prediction, page_id)
27
- super
28
- @account_holder_name = Parsing::Standard::StringField.new(
29
- prediction['account_holder_name'],
30
- page_id
31
- )
32
- @iban = Parsing::Standard::StringField.new(prediction['iban'], page_id)
33
- @swift = Parsing::Standard::StringField.new(prediction['swift'], page_id)
34
- end
35
-
36
- # @return [String]
37
- def to_s
38
- out_str = String.new
39
- out_str << "\n:IBAN: #{@iban}".rstrip
40
- out_str << "\n:Account Holder's Name: #{@account_holder_name}".rstrip
41
- out_str << "\n:SWIFT Code: #{@swift}".rstrip
42
- out_str[1..].to_s
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'bank_account_details_v1_document'
5
-
6
- module Mindee
7
- module V1
8
- module Product
9
- module FR
10
- module BankAccountDetails
11
- # Bank Account Details API version 1.0 page data.
12
- class BankAccountDetailsV1Page < Mindee::V1::Parsing::Common::Page
13
- # @param prediction [Hash]
14
- def initialize(prediction)
15
- super
16
- @prediction = if prediction['prediction'].empty?
17
- nil
18
- else
19
- BankAccountDetailsV1PagePrediction.new(
20
- prediction['prediction'],
21
- prediction['id']
22
- )
23
- end
24
- end
25
- end
26
-
27
- # Bank Account Details V1 page prediction.
28
- class BankAccountDetailsV1PagePrediction < BankAccountDetailsV1Document
29
- # @return [String]
30
- def to_s
31
- out_str = String.new
32
- out_str << "\n#{super}"
33
- out_str
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'id_card_v1_document'
5
- require_relative 'id_card_v1_page'
6
-
7
- module Mindee
8
- module V1
9
- module Product
10
- module FR
11
- # Carte Nationale d'Identité module.
12
- module IdCard
13
- # Carte Nationale d'Identité API version 1 inference prediction.
14
- class IdCardV1 < Mindee::V1::Parsing::Common::Inference
15
- @endpoint_name = 'idcard_fr'
16
- @endpoint_version = '1'
17
- @has_async = false
18
- @has_sync = true
19
-
20
- # @param prediction [Hash]
21
- def initialize(prediction)
22
- super
23
- @prediction = IdCardV1Document.new(prediction['prediction'], nil)
24
- @pages = []
25
- prediction['pages'].each do |page|
26
- @pages.push(IdCardV1Page.new(page))
27
- end
28
- end
29
-
30
- class << self
31
- # Name of the endpoint for this product.
32
- # @return [String]
33
- attr_reader :endpoint_name
34
- # Version for this product.
35
- # @return [String]
36
- attr_reader :endpoint_version
37
- # Whether this product has access to an asynchronous endpoint.
38
- # @return [bool]
39
- attr_reader :has_async
40
- # Whether this product has access to synchronous endpoint.
41
- # @return [bool]
42
- attr_reader :has_sync
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module V1
7
- module Product
8
- module FR
9
- module IdCard
10
- # Carte Nationale d'Identité API version 1.1 document data.
11
- class IdCardV1Document < Mindee::V1::Parsing::Common::Prediction
12
- include Mindee::V1::Parsing::Standard
13
-
14
- # The name of the issuing authority.
15
- # @return [Mindee::V1::Parsing::Standard::StringField]
16
- attr_reader :authority
17
- # The date of birth of the card holder.
18
- # @return [Mindee::V1::Parsing::Standard::DateField]
19
- attr_reader :birth_date
20
- # The place of birth of the card holder.
21
- # @return [Mindee::V1::Parsing::Standard::StringField]
22
- attr_reader :birth_place
23
- # The expiry date of the identification card.
24
- # @return [Mindee::V1::Parsing::Standard::DateField]
25
- attr_reader :expiry_date
26
- # The gender of the card holder.
27
- # @return [Mindee::V1::Parsing::Standard::StringField]
28
- attr_reader :gender
29
- # The given name(s) of the card holder.
30
- # @return [Array<Mindee::V1::Parsing::Standard::StringField>]
31
- attr_reader :given_names
32
- # The identification card number.
33
- # @return [Mindee::V1::Parsing::Standard::StringField]
34
- attr_reader :id_number
35
- # Machine Readable Zone, first line
36
- # @return [Mindee::V1::Parsing::Standard::StringField]
37
- attr_reader :mrz1
38
- # Machine Readable Zone, second line
39
- # @return [Mindee::V1::Parsing::Standard::StringField]
40
- attr_reader :mrz2
41
- # The surname of the card holder.
42
- # @return [Mindee::V1::Parsing::Standard::StringField]
43
- attr_reader :surname
44
-
45
- # @param prediction [Hash]
46
- # @param page_id [Integer, nil]
47
- def initialize(prediction, page_id)
48
- super
49
- @authority = Parsing::Standard::StringField.new(
50
- prediction['authority'],
51
- page_id
52
- )
53
- @birth_date = Parsing::Standard::DateField.new(
54
- prediction['birth_date'],
55
- page_id
56
- )
57
- @birth_place = Parsing::Standard::StringField.new(
58
- prediction['birth_place'],
59
- page_id
60
- )
61
- @expiry_date = Parsing::Standard::DateField.new(
62
- prediction['expiry_date'],
63
- page_id
64
- )
65
- @gender = Parsing::Standard::StringField.new(
66
- prediction['gender'],
67
- page_id
68
- )
69
- @given_names = [] # : Array[Parsing::Standard::StringField]
70
- prediction['given_names'].each do |item|
71
- @given_names.push(Parsing::Standard::StringField.new(item, page_id))
72
- end
73
- @id_number = Parsing::Standard::StringField.new(
74
- prediction['id_number'],
75
- page_id
76
- )
77
- @mrz1 = Parsing::Standard::StringField.new(prediction['mrz1'], page_id)
78
- @mrz2 = Parsing::Standard::StringField.new(prediction['mrz2'], page_id)
79
- @surname = Parsing::Standard::StringField.new(
80
- prediction['surname'],
81
- page_id
82
- )
83
- end
84
-
85
- # @return [String]
86
- def to_s
87
- given_names = @given_names.join("\n #{' ' * 15}")
88
- out_str = String.new
89
- out_str << "\n:Identity Number: #{@id_number}".rstrip
90
- out_str << "\n:Given Name(s): #{given_names}".rstrip
91
- out_str << "\n:Surname: #{@surname}".rstrip
92
- out_str << "\n:Date of Birth: #{@birth_date}".rstrip
93
- out_str << "\n:Place of Birth: #{@birth_place}".rstrip
94
- out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
95
- out_str << "\n:Issuing Authority: #{@authority}".rstrip
96
- out_str << "\n:Gender: #{@gender}".rstrip
97
- out_str << "\n:MRZ Line 1: #{@mrz1}".rstrip
98
- out_str << "\n:MRZ Line 2: #{@mrz2}".rstrip
99
- out_str[1..].to_s
100
- end
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'id_card_v1_document'
5
-
6
- module Mindee
7
- module V1
8
- module Product
9
- module FR
10
- module IdCard
11
- # Carte Nationale d'Identité API version 1.1 page data.
12
- class IdCardV1Page < Mindee::V1::Parsing::Common::Page
13
- # @param prediction [Hash]
14
- def initialize(prediction)
15
- super
16
- @prediction = if prediction['prediction'].empty?
17
- nil
18
- else
19
- IdCardV1PagePrediction.new(
20
- prediction['prediction'],
21
- prediction['id']
22
- )
23
- end
24
- end
25
- end
26
-
27
- # Carte Nationale d'Identité V1 page prediction.
28
- class IdCardV1PagePrediction < IdCardV1Document
29
- include Mindee::V1::Parsing::Standard
30
-
31
- # The side of the document which is visible.
32
- # @return [Mindee::V1::Parsing::Standard::ClassificationField]
33
- attr_reader :document_side
34
-
35
- # @param prediction [Hash]
36
- # @param page_id [Integer, nil]
37
- def initialize(prediction, page_id)
38
- @document_side = Parsing::Standard::ClassificationField.new(
39
- prediction['document_side'],
40
- page_id
41
- )
42
- super
43
- end
44
-
45
- # @return [String]
46
- def to_s
47
- out_str = String.new
48
- out_str << "\n:Document Side: #{@document_side}".rstrip
49
- out_str << "\n#{super}"
50
- out_str
51
- end
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,22 +0,0 @@
1
- # lib/mindee/v1/http/workflow_endpoint.rb
2
- module Mindee
3
- module V1
4
- module HTTP
5
- class WorkflowEndpoint
6
- def api_key: -> String
7
-
8
- def request_timeout: -> Integer
9
-
10
- def url: -> String
11
-
12
- def initialize: (untyped, ?api_key: String) -> String
13
-
14
- def execute_workflow: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> [Hash[String, untyped], String]
15
-
16
- def workflow_execution_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> Net::HTTPResponse?
17
-
18
- def check_api_key: -> nil
19
- end
20
- end
21
- end
22
- end
@@ -1,13 +0,0 @@
1
- # lib/mindee/v1/product/barcode_reader/barcode_reader_v1.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module BarcodeReader
7
- class BarcodeReaderV1 < Parsing::Common::Inference
8
- def initialize: (Hash[String | Symbol, untyped]) -> void
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- # lib/mindee/v1/product/barcode_reader/barcode_reader_v1_document.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module BarcodeReader
7
- class BarcodeReaderV1Document < Parsing::Common::Prediction
8
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
9
- def codes_1d: -> (Array[Parsing::Standard::StringField])
10
- def codes_2d: -> (Array[Parsing::Standard::StringField])
11
- def to_s: -> String
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,17 +0,0 @@
1
- # lib/mindee/v1/product/barcode_reader/barcode_reader_v1_page.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module BarcodeReader
7
- class BarcodeReaderV1Page < Parsing::Common::Page
8
- def initialize: (Hash[String | Symbol, untyped]) -> void
9
- end
10
- class BarcodeReaderV1PagePrediction < BarcodeReaderV1Document
11
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
12
- def to_s: -> String
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,15 +0,0 @@
1
- # lib/mindee/v1/product/bank_account_details/bank_account_details_v1.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module BankAccountDetails
8
- class BankAccountDetailsV1 < Parsing::Common::Inference
9
- def initialize: (Hash[String | Symbol, untyped]) -> void
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- # lib/mindee/v1/product/bank_account_details/bank_account_details_v1_document.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module BankAccountDetails
8
- class BankAccountDetailsV1Document < Parsing::Common::Prediction
9
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
10
- def account_holder_name: -> (Parsing::Standard::StringField)
11
- def iban: -> (Parsing::Standard::StringField)
12
- def swift: -> (Parsing::Standard::StringField)
13
- def to_s: -> String
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # lib/mindee/v1/product/bank_account_details/bank_account_details_v1_page.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module BankAccountDetails
8
- class BankAccountDetailsV1Page < Parsing::Common::Page
9
- def initialize: (Hash[String | Symbol, untyped]) -> void
10
- end
11
- class BankAccountDetailsV1PagePrediction < BankAccountDetailsV1Document
12
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
13
- def to_s: -> String
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- # lib/mindee/v1/product/id_card/id_card_v1.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module IdCard
8
- class IdCardV1 < Parsing::Common::Inference
9
- def initialize: (Hash[String | Symbol, untyped]) -> void
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,26 +0,0 @@
1
- # lib/mindee/v1/product/id_card/id_card_v1_document.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module IdCard
8
- class IdCardV1Document < Parsing::Common::Prediction
9
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
10
- def authority: -> (Parsing::Standard::StringField)
11
- def birth_date: -> (Parsing::Standard::DateField)
12
- def birth_place: -> (Parsing::Standard::StringField)
13
- def expiry_date: -> (Parsing::Standard::DateField)
14
- def gender: -> (Parsing::Standard::StringField)
15
- def given_names: -> (Array[Parsing::Standard::StringField])
16
- def id_number: -> (Parsing::Standard::StringField)
17
- def mrz1: -> (Parsing::Standard::StringField)
18
- def mrz2: -> (Parsing::Standard::StringField)
19
- def surname: -> (Parsing::Standard::StringField)
20
- def to_s: -> String
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,20 +0,0 @@
1
- # lib/mindee/v1/product/id_card/id_card_v1_page.rb
2
-
3
- module Mindee
4
- module V1
5
- module Product
6
- module FR
7
- module IdCard
8
- class IdCardV1Page < Parsing::Common::Page
9
- def initialize: (Hash[String | Symbol, untyped]) -> void
10
- end
11
- class IdCardV1PagePrediction < IdCardV1Document
12
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
13
- def document_side: -> Parsing::Standard::ClassificationField
14
- def to_s: -> String
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end