mindee 3.15.0 → 3.17.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/bin/mindee.rb +20 -2
  4. data/docs/business_card_v1.md +169 -0
  5. data/docs/code_samples/{international_id_v1_async.txt → business_card_v1_async.txt} +1 -1
  6. data/docs/code_samples/delivery_notes_v1_async.txt +19 -0
  7. data/docs/code_samples/driver_license_v1_async.txt +19 -0
  8. data/docs/code_samples/expense_receipts_v5_async.txt +19 -0
  9. data/docs/code_samples/french_healthcard_v1_async.txt +19 -0
  10. data/docs/code_samples/ind_passport_v1_async.txt +19 -0
  11. data/docs/code_samples/payslip_fra_v3_async.txt +19 -0
  12. data/docs/code_samples/workflow_execution.txt +29 -0
  13. data/docs/delivery_notes_v1.md +143 -0
  14. data/docs/driver_license_v1.md +156 -0
  15. data/docs/energy_bill_fra_v1.md +2 -2
  16. data/docs/expense_receipts_v5.md +27 -2
  17. data/docs/financial_document_v1.md +8 -4
  18. data/docs/{carte_vitale_v1.md → french_healthcard_v1.md} +14 -24
  19. data/docs/ind_passport_v1.md +281 -0
  20. data/docs/invoices_v4.md +12 -8
  21. data/docs/payslip_fra_v3.md +319 -0
  22. data/docs/resume_v1.md +17 -16
  23. data/lib/mindee/client.rb +48 -8
  24. data/lib/mindee/http/workflow_endpoint.rb +90 -0
  25. data/lib/mindee/http.rb +1 -0
  26. data/lib/mindee/parsing/common/api_response.rb +22 -1
  27. data/lib/mindee/parsing/common/execution.rb +73 -0
  28. data/lib/mindee/parsing/common/execution_file.rb +24 -0
  29. data/lib/mindee/parsing/common/execution_priority.rb +30 -0
  30. data/lib/mindee/parsing/common.rb +3 -0
  31. data/lib/mindee/product/{international_id/international_id_v1.rb → business_card/business_card_v1.rb} +9 -9
  32. data/lib/mindee/product/business_card/business_card_v1_document.rb +85 -0
  33. data/lib/mindee/product/{international_id/international_id_v1_page.rb → business_card/business_card_v1_page.rb} +7 -7
  34. data/lib/mindee/product/delivery_note/delivery_note_v1.rb +39 -0
  35. data/lib/mindee/product/delivery_note/delivery_note_v1_document.rb +61 -0
  36. data/lib/mindee/product/delivery_note/delivery_note_v1_page.rb +32 -0
  37. data/lib/mindee/product/driver_license/driver_license_v1.rb +39 -0
  38. data/lib/mindee/product/driver_license/driver_license_v1_document.rb +91 -0
  39. data/lib/mindee/product/driver_license/driver_license_v1_page.rb +32 -0
  40. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +1 -1
  41. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  42. data/lib/mindee/product/fr/health_card/health_card_v1.rb +41 -0
  43. data/lib/mindee/product/fr/health_card/health_card_v1_document.rb +52 -0
  44. data/lib/mindee/product/fr/health_card/health_card_v1_page.rb +34 -0
  45. data/lib/mindee/product/fr/payslip/payslip_v3.rb +41 -0
  46. data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +54 -0
  47. data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +166 -0
  48. data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +78 -0
  49. data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +78 -0
  50. data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +78 -0
  51. data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +34 -0
  52. data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +89 -0
  53. data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +100 -0
  54. data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +66 -0
  55. data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +89 -0
  56. data/lib/mindee/product/ind/indian_passport/indian_passport_v1.rb +41 -0
  57. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +143 -0
  58. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +34 -0
  59. data/lib/mindee/product/invoice/invoice_v4_document.rb +1 -1
  60. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  61. data/lib/mindee/product/resume/resume_v1_document.rb +3 -1
  62. data/lib/mindee/product/resume/resume_v1_page.rb +1 -1
  63. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +8 -0
  64. data/lib/mindee/product.rb +13 -8
  65. data/lib/mindee/version.rb +1 -1
  66. metadata +46 -10
  67. data/docs/eu_driver_license_v1.md +0 -227
  68. data/docs/proof_of_address_v1.md +0 -211
  69. data/docs/us_driver_license_v1.md +0 -272
  70. data/lib/mindee/product/international_id/international_id_v1_document.rb +0 -109
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mindee
4
+ module Parsing
5
+ module Common
6
+ # Identifier for the batch to which the execution belongs.
7
+ class Execution
8
+ # Identifier for the batch to which the execution belongs.
9
+ # @return [String]
10
+ attr_reader :batch_name
11
+ # The time at which the execution started.
12
+ # @return [Time, nil]
13
+ attr_reader :created_at
14
+ # File representation within a workflow execution.
15
+ # @return [ExecutionFile]
16
+ attr_reader :file
17
+ # Identifier for the execution.
18
+ # @return [String]
19
+ attr_reader :id
20
+ # Deserialized inference object.
21
+ # @return [Mindee::Inference]
22
+ attr_reader :inference
23
+ # Priority of the execution.
24
+ # @return [ExecutionPriority]
25
+ attr_reader :priority
26
+ # The time at which the file was tagged as reviewed.
27
+ # @return [Time, nil]
28
+ attr_reader :reviewed_at
29
+ # The time at which the file was uploaded to a workflow.
30
+ # @return [Time, nil]
31
+ attr_reader :available_at
32
+ # Reviewed fields and values.
33
+ # @return [Mindee::Product::Generated::GeneratedV1Document]
34
+ attr_reader :reviewed_prediction
35
+ # Execution Status.
36
+ # @return [String]
37
+ attr_reader :status
38
+ # Execution type.
39
+ # @return [String]
40
+ attr_reader :type
41
+ # The time at which the file was uploaded to a workflow.
42
+ # @return [Time, nil]
43
+ attr_reader :uploaded_at
44
+ # Identifier for the workflow.
45
+ # @return [String]
46
+ attr_reader :workflow_id
47
+
48
+ # rubocop:disable Metrics/CyclomaticComplexity
49
+
50
+ # @param product_class [Mindee::Inference]
51
+ # @param http_response [Hash]
52
+ def initialize(product_class, http_response)
53
+ @batch_name = http_response['batch_name']
54
+ @created_at = Time.iso8601(http_response['created_at']) if http_response['created_at']
55
+ @file = ExecutionFile.new(http_response['file']) if http_response['file']
56
+ @id = http_response['id']
57
+ @inference = product_class.new(http_response['inference']) if http_response['inference']
58
+ @priority = Mindee::Parsing::Common::ExecutionPriority.to_priority(http_response['priority'])
59
+ @reviewed_at = Time.iso8601(http_response['reviewed_at']) if http_response['reviewed_at']
60
+ @available_at = Time.iso8601(http_response['available_at']) if http_response['available_at']
61
+ if http_response['reviewed_prediction']
62
+ @reviewed_prediction = GeneratedV1Document.new(http_response['reviewed_prediction'])
63
+ end
64
+ @status = http_response['status']
65
+ @type = http_response['type']
66
+ @uploaded_at = Time.iso8601(http_response['uploaded_at']) if http_response['uploaded_at']
67
+ @workflow_id = http_response['workflow_id']
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mindee
4
+ module Parsing
5
+ module Common
6
+ # Representation of a workflow execution's file data.
7
+ class ExecutionFile
8
+ # File name.
9
+ # @return [String]
10
+ attr_reader :name
11
+
12
+ # Optional alias for the file.
13
+ # @return [String]
14
+ attr_reader :alias
15
+
16
+ # @param http_response [Hash]
17
+ def initialize(http_response)
18
+ @name = http_response['name']
19
+ @alias = http_response['alias']
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mindee
4
+ module Parsing
5
+ module Common
6
+ # Execution policy priority values.
7
+ module ExecutionPriority
8
+ LOW = :low
9
+ MEDIUM = :medium
10
+ HIGH = :high
11
+
12
+ # Sets the priority to one of its possibly values, defaults to nil otherwise.
13
+ # @param [String, nil] priority_str
14
+ # @return [Symbol, nil]
15
+ def self.to_priority(priority_str)
16
+ return nil if priority_str.nil?
17
+
18
+ case priority_str.downcase
19
+ when 'low'
20
+ :low
21
+ when 'high'
22
+ :high
23
+ else
24
+ :medium
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require_relative 'common/api_response'
4
4
  require_relative 'common/document'
5
+ require_relative 'common/execution'
6
+ require_relative 'common/execution_file'
7
+ require_relative 'common/execution_priority'
5
8
  require_relative 'common/inference'
6
9
  require_relative 'common/ocr'
7
10
  require_relative 'common/prediction'
@@ -1,26 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../../parsing'
4
- require_relative 'international_id_v1_document'
5
- require_relative 'international_id_v1_page'
4
+ require_relative 'business_card_v1_document'
5
+ require_relative 'business_card_v1_page'
6
6
 
7
7
  module Mindee
8
8
  module Product
9
- # International ID module.
10
- module InternationalId
11
- # International ID V1 prediction inference.
12
- class InternationalIdV1 < Mindee::Parsing::Common::Inference
13
- @endpoint_name = 'international_id'
9
+ # Business Card module.
10
+ module BusinessCard
11
+ # Business Card API version 1 inference prediction.
12
+ class BusinessCardV1 < Mindee::Parsing::Common::Inference
13
+ @endpoint_name = 'business_card'
14
14
  @endpoint_version = '1'
15
15
 
16
16
  # @param prediction [Hash]
17
17
  def initialize(prediction)
18
18
  super
19
- @prediction = InternationalIdV1Document.new(prediction['prediction'], nil)
19
+ @prediction = BusinessCardV1Document.new(prediction['prediction'], nil)
20
20
  @pages = []
21
21
  prediction['pages'].each do |page|
22
22
  if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
23
- @pages.push(InternationalIdV1Page.new(page))
23
+ @pages.push(BusinessCardV1Page.new(page))
24
24
  end
25
25
  end
26
26
  end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module BusinessCard
8
+ # Business Card API version 1.0 document data.
9
+ class BusinessCardV1Document < Mindee::Parsing::Common::Prediction
10
+ include Mindee::Parsing::Standard
11
+ # The address of the person.
12
+ # @return [Mindee::Parsing::Standard::StringField]
13
+ attr_reader :address
14
+ # The company the person works for.
15
+ # @return [Mindee::Parsing::Standard::StringField]
16
+ attr_reader :company
17
+ # The email address of the person.
18
+ # @return [Mindee::Parsing::Standard::StringField]
19
+ attr_reader :email
20
+ # The Fax number of the person.
21
+ # @return [Mindee::Parsing::Standard::StringField]
22
+ attr_reader :fax_number
23
+ # The given name of the person.
24
+ # @return [Mindee::Parsing::Standard::StringField]
25
+ attr_reader :firstname
26
+ # The job title of the person.
27
+ # @return [Mindee::Parsing::Standard::StringField]
28
+ attr_reader :job_title
29
+ # The lastname of the person.
30
+ # @return [Mindee::Parsing::Standard::StringField]
31
+ attr_reader :lastname
32
+ # The mobile number of the person.
33
+ # @return [Mindee::Parsing::Standard::StringField]
34
+ attr_reader :mobile_number
35
+ # The phone number of the person.
36
+ # @return [Mindee::Parsing::Standard::StringField]
37
+ attr_reader :phone_number
38
+ # The social media profiles of the person or company.
39
+ # @return [Array<Mindee::Parsing::Standard::StringField>]
40
+ attr_reader :social_media
41
+ # The website of the person or company.
42
+ # @return [Mindee::Parsing::Standard::StringField]
43
+ attr_reader :website
44
+
45
+ # @param prediction [Hash]
46
+ # @param page_id [Integer, nil]
47
+ def initialize(prediction, page_id)
48
+ super()
49
+ @address = StringField.new(prediction['address'], page_id)
50
+ @company = StringField.new(prediction['company'], page_id)
51
+ @email = StringField.new(prediction['email'], page_id)
52
+ @fax_number = StringField.new(prediction['fax_number'], page_id)
53
+ @firstname = StringField.new(prediction['firstname'], page_id)
54
+ @job_title = StringField.new(prediction['job_title'], page_id)
55
+ @lastname = StringField.new(prediction['lastname'], page_id)
56
+ @mobile_number = StringField.new(prediction['mobile_number'], page_id)
57
+ @phone_number = StringField.new(prediction['phone_number'], page_id)
58
+ @social_media = []
59
+ prediction['social_media'].each do |item|
60
+ @social_media.push(StringField.new(item, page_id))
61
+ end
62
+ @website = StringField.new(prediction['website'], page_id)
63
+ end
64
+
65
+ # @return [String]
66
+ def to_s
67
+ social_media = @social_media.join("\n #{' ' * 14}")
68
+ out_str = String.new
69
+ out_str << "\n:Firstname: #{@firstname}".rstrip
70
+ out_str << "\n:Lastname: #{@lastname}".rstrip
71
+ out_str << "\n:Job Title: #{@job_title}".rstrip
72
+ out_str << "\n:Company: #{@company}".rstrip
73
+ out_str << "\n:Email: #{@email}".rstrip
74
+ out_str << "\n:Phone Number: #{@phone_number}".rstrip
75
+ out_str << "\n:Mobile Number: #{@mobile_number}".rstrip
76
+ out_str << "\n:Fax Number: #{@fax_number}".rstrip
77
+ out_str << "\n:Address: #{@address}".rstrip
78
+ out_str << "\n:Website: #{@website}".rstrip
79
+ out_str << "\n:Social Media: #{social_media}".rstrip
80
+ out_str[1..].to_s
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -1,25 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../../parsing'
4
- require_relative 'international_id_v1_document'
4
+ require_relative 'business_card_v1_document'
5
5
 
6
6
  module Mindee
7
7
  module Product
8
- module InternationalId
9
- # International ID V1 page.
10
- class InternationalIdV1Page < Mindee::Parsing::Common::Page
8
+ module BusinessCard
9
+ # Business Card API version 1.0 page data.
10
+ class BusinessCardV1Page < Mindee::Parsing::Common::Page
11
11
  # @param prediction [Hash]
12
12
  def initialize(prediction)
13
13
  super(prediction)
14
- @prediction = InternationalIdV1PagePrediction.new(
14
+ @prediction = BusinessCardV1PagePrediction.new(
15
15
  prediction['prediction'],
16
16
  prediction['id']
17
17
  )
18
18
  end
19
19
  end
20
20
 
21
- # International ID V1 page prediction.
22
- class InternationalIdV1PagePrediction < InternationalIdV1Document
21
+ # Business Card V1 page prediction.
22
+ class BusinessCardV1PagePrediction < BusinessCardV1Document
23
23
  # @return [String]
24
24
  def to_s
25
25
  out_str = String.new
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+ require_relative 'delivery_note_v1_document'
5
+ require_relative 'delivery_note_v1_page'
6
+
7
+ module Mindee
8
+ module Product
9
+ # Delivery note module.
10
+ module DeliveryNote
11
+ # Delivery note API version 1 inference prediction.
12
+ class DeliveryNoteV1 < Mindee::Parsing::Common::Inference
13
+ @endpoint_name = 'delivery_notes'
14
+ @endpoint_version = '1'
15
+
16
+ # @param prediction [Hash]
17
+ def initialize(prediction)
18
+ super
19
+ @prediction = DeliveryNoteV1Document.new(prediction['prediction'], nil)
20
+ @pages = []
21
+ prediction['pages'].each do |page|
22
+ if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
23
+ @pages.push(DeliveryNoteV1Page.new(page))
24
+ end
25
+ end
26
+ end
27
+
28
+ class << self
29
+ # Name of the endpoint for this product.
30
+ # @return [String]
31
+ attr_reader :endpoint_name
32
+ # Version for this product.
33
+ # @return [String]
34
+ attr_reader :endpoint_version
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module DeliveryNote
8
+ # Delivery note API version 1.1 document data.
9
+ class DeliveryNoteV1Document < Mindee::Parsing::Common::Prediction
10
+ include Mindee::Parsing::Standard
11
+ # The address of the customer receiving the goods.
12
+ # @return [Mindee::Parsing::Standard::StringField]
13
+ attr_reader :customer_address
14
+ # The name of the customer receiving the goods.
15
+ # @return [Mindee::Parsing::Standard::StringField]
16
+ attr_reader :customer_name
17
+ # The date on which the delivery is scheduled to arrive.
18
+ # @return [Mindee::Parsing::Standard::DateField]
19
+ attr_reader :delivery_date
20
+ # A unique identifier for the delivery note.
21
+ # @return [Mindee::Parsing::Standard::StringField]
22
+ attr_reader :delivery_number
23
+ # The address of the supplier providing the goods.
24
+ # @return [Mindee::Parsing::Standard::StringField]
25
+ attr_reader :supplier_address
26
+ # The name of the supplier providing the goods.
27
+ # @return [Mindee::Parsing::Standard::StringField]
28
+ attr_reader :supplier_name
29
+ # The total monetary value of the goods being delivered.
30
+ # @return [Mindee::Parsing::Standard::AmountField]
31
+ attr_reader :total_amount
32
+
33
+ # @param prediction [Hash]
34
+ # @param page_id [Integer, nil]
35
+ def initialize(prediction, page_id)
36
+ super()
37
+ @customer_address = StringField.new(prediction['customer_address'], page_id)
38
+ @customer_name = StringField.new(prediction['customer_name'], page_id)
39
+ @delivery_date = DateField.new(prediction['delivery_date'], page_id)
40
+ @delivery_number = StringField.new(prediction['delivery_number'], page_id)
41
+ @supplier_address = StringField.new(prediction['supplier_address'], page_id)
42
+ @supplier_name = StringField.new(prediction['supplier_name'], page_id)
43
+ @total_amount = AmountField.new(prediction['total_amount'], page_id)
44
+ end
45
+
46
+ # @return [String]
47
+ def to_s
48
+ out_str = String.new
49
+ out_str << "\n:Delivery Date: #{@delivery_date}".rstrip
50
+ out_str << "\n:Delivery Number: #{@delivery_number}".rstrip
51
+ out_str << "\n:Supplier Name: #{@supplier_name}".rstrip
52
+ out_str << "\n:Supplier Address: #{@supplier_address}".rstrip
53
+ out_str << "\n:Customer Name: #{@customer_name}".rstrip
54
+ out_str << "\n:Customer Address: #{@customer_address}".rstrip
55
+ out_str << "\n:Total Amount: #{@total_amount}".rstrip
56
+ out_str[1..].to_s
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+ require_relative 'delivery_note_v1_document'
5
+
6
+ module Mindee
7
+ module Product
8
+ module DeliveryNote
9
+ # Delivery note API version 1.1 page data.
10
+ class DeliveryNoteV1Page < Mindee::Parsing::Common::Page
11
+ # @param prediction [Hash]
12
+ def initialize(prediction)
13
+ super(prediction)
14
+ @prediction = DeliveryNoteV1PagePrediction.new(
15
+ prediction['prediction'],
16
+ prediction['id']
17
+ )
18
+ end
19
+ end
20
+
21
+ # Delivery note V1 page prediction.
22
+ class DeliveryNoteV1PagePrediction < DeliveryNoteV1Document
23
+ # @return [String]
24
+ def to_s
25
+ out_str = String.new
26
+ out_str << "\n#{super}"
27
+ out_str
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+ require_relative 'driver_license_v1_document'
5
+ require_relative 'driver_license_v1_page'
6
+
7
+ module Mindee
8
+ module Product
9
+ # Driver License module.
10
+ module DriverLicense
11
+ # Driver License API version 1 inference prediction.
12
+ class DriverLicenseV1 < Mindee::Parsing::Common::Inference
13
+ @endpoint_name = 'driver_license'
14
+ @endpoint_version = '1'
15
+
16
+ # @param prediction [Hash]
17
+ def initialize(prediction)
18
+ super
19
+ @prediction = DriverLicenseV1Document.new(prediction['prediction'], nil)
20
+ @pages = []
21
+ prediction['pages'].each do |page|
22
+ if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
23
+ @pages.push(DriverLicenseV1Page.new(page))
24
+ end
25
+ end
26
+ end
27
+
28
+ class << self
29
+ # Name of the endpoint for this product.
30
+ # @return [String]
31
+ attr_reader :endpoint_name
32
+ # Version for this product.
33
+ # @return [String]
34
+ attr_reader :endpoint_version
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module DriverLicense
8
+ # Driver License API version 1.0 document data.
9
+ class DriverLicenseV1Document < Mindee::Parsing::Common::Prediction
10
+ include Mindee::Parsing::Standard
11
+ # The category or class of the driver license.
12
+ # @return [Mindee::Parsing::Standard::StringField]
13
+ attr_reader :category
14
+ # The alpha-3 ISO 3166 code of the country where the driver license was issued.
15
+ # @return [Mindee::Parsing::Standard::StringField]
16
+ attr_reader :country_code
17
+ # The date of birth of the driver license holder.
18
+ # @return [Mindee::Parsing::Standard::DateField]
19
+ attr_reader :date_of_birth
20
+ # The DD number of the driver license.
21
+ # @return [Mindee::Parsing::Standard::StringField]
22
+ attr_reader :dd_number
23
+ # The expiry date of the driver license.
24
+ # @return [Mindee::Parsing::Standard::DateField]
25
+ attr_reader :expiry_date
26
+ # The first name of the driver license holder.
27
+ # @return [Mindee::Parsing::Standard::StringField]
28
+ attr_reader :first_name
29
+ # The unique identifier of the driver license.
30
+ # @return [Mindee::Parsing::Standard::StringField]
31
+ attr_reader :id
32
+ # The date when the driver license was issued.
33
+ # @return [Mindee::Parsing::Standard::DateField]
34
+ attr_reader :issued_date
35
+ # The authority that issued the driver license.
36
+ # @return [Mindee::Parsing::Standard::StringField]
37
+ attr_reader :issuing_authority
38
+ # The last name of the driver license holder.
39
+ # @return [Mindee::Parsing::Standard::StringField]
40
+ attr_reader :last_name
41
+ # The Machine Readable Zone (MRZ) of the driver license.
42
+ # @return [Mindee::Parsing::Standard::StringField]
43
+ attr_reader :mrz
44
+ # The place of birth of the driver license holder.
45
+ # @return [Mindee::Parsing::Standard::StringField]
46
+ attr_reader :place_of_birth
47
+ # Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
48
+ # @return [Mindee::Parsing::Standard::StringField]
49
+ attr_reader :state
50
+
51
+ # @param prediction [Hash]
52
+ # @param page_id [Integer, nil]
53
+ def initialize(prediction, page_id)
54
+ super()
55
+ @category = StringField.new(prediction['category'], page_id)
56
+ @country_code = StringField.new(prediction['country_code'], page_id)
57
+ @date_of_birth = DateField.new(prediction['date_of_birth'], page_id)
58
+ @dd_number = StringField.new(prediction['dd_number'], page_id)
59
+ @expiry_date = DateField.new(prediction['expiry_date'], page_id)
60
+ @first_name = StringField.new(prediction['first_name'], page_id)
61
+ @id = StringField.new(prediction['id'], page_id)
62
+ @issued_date = DateField.new(prediction['issued_date'], page_id)
63
+ @issuing_authority = StringField.new(prediction['issuing_authority'], page_id)
64
+ @last_name = StringField.new(prediction['last_name'], page_id)
65
+ @mrz = StringField.new(prediction['mrz'], page_id)
66
+ @place_of_birth = StringField.new(prediction['place_of_birth'], page_id)
67
+ @state = StringField.new(prediction['state'], page_id)
68
+ end
69
+
70
+ # @return [String]
71
+ def to_s
72
+ out_str = String.new
73
+ out_str << "\n:Country Code: #{@country_code}".rstrip
74
+ out_str << "\n:State: #{@state}".rstrip
75
+ out_str << "\n:ID: #{@id}".rstrip
76
+ out_str << "\n:Category: #{@category}".rstrip
77
+ out_str << "\n:Last Name: #{@last_name}".rstrip
78
+ out_str << "\n:First Name: #{@first_name}".rstrip
79
+ out_str << "\n:Date of Birth: #{@date_of_birth}".rstrip
80
+ out_str << "\n:Place of Birth: #{@place_of_birth}".rstrip
81
+ out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
82
+ out_str << "\n:Issued Date: #{@issued_date}".rstrip
83
+ out_str << "\n:Issuing Authority: #{@issuing_authority}".rstrip
84
+ out_str << "\n:MRZ: #{@mrz}".rstrip
85
+ out_str << "\n:DD Number: #{@dd_number}".rstrip
86
+ out_str[1..].to_s
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../parsing'
4
+ require_relative 'driver_license_v1_document'
5
+
6
+ module Mindee
7
+ module Product
8
+ module DriverLicense
9
+ # Driver License API version 1.0 page data.
10
+ class DriverLicenseV1Page < Mindee::Parsing::Common::Page
11
+ # @param prediction [Hash]
12
+ def initialize(prediction)
13
+ super(prediction)
14
+ @prediction = DriverLicenseV1PagePrediction.new(
15
+ prediction['prediction'],
16
+ prediction['id']
17
+ )
18
+ end
19
+ end
20
+
21
+ # Driver License V1 page prediction.
22
+ class DriverLicenseV1PagePrediction < DriverLicenseV1Document
23
+ # @return [String]
24
+ def to_s
25
+ out_str = String.new
26
+ out_str << "\n#{super}"
27
+ out_str
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -6,7 +6,7 @@ require_relative 'financial_document_v1_line_item'
6
6
  module Mindee
7
7
  module Product
8
8
  module FinancialDocument
9
- # Financial Document API version 1.10 document data.
9
+ # Financial Document API version 1.11 document data.
10
10
  class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
11
11
  include Mindee::Parsing::Standard
12
12
  # The customer's address used for billing.
@@ -6,7 +6,7 @@ require_relative 'financial_document_v1_document'
6
6
  module Mindee
7
7
  module Product
8
8
  module FinancialDocument
9
- # Financial Document API version 1.10 page data.
9
+ # Financial Document API version 1.11 page data.
10
10
  class FinancialDocumentV1Page < Mindee::Parsing::Common::Page
11
11
  # @param prediction [Hash]
12
12
  def initialize(prediction)
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'health_card_v1_document'
5
+ require_relative 'health_card_v1_page'
6
+
7
+ module Mindee
8
+ module Product
9
+ module FR
10
+ # Health Card module.
11
+ module HealthCard
12
+ # Health Card API version 1 inference prediction.
13
+ class HealthCardV1 < Mindee::Parsing::Common::Inference
14
+ @endpoint_name = 'french_healthcard'
15
+ @endpoint_version = '1'
16
+
17
+ # @param prediction [Hash]
18
+ def initialize(prediction)
19
+ super
20
+ @prediction = HealthCardV1Document.new(prediction['prediction'], nil)
21
+ @pages = []
22
+ prediction['pages'].each do |page|
23
+ if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
24
+ @pages.push(HealthCardV1Page.new(page))
25
+ end
26
+ end
27
+ end
28
+
29
+ class << self
30
+ # Name of the endpoint for this product.
31
+ # @return [String]
32
+ attr_reader :endpoint_name
33
+ # Version for this product.
34
+ # @return [String]
35
+ attr_reader :endpoint_version
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end