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,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module HealthCard
9
+ # Health Card API version 1.0 document data.
10
+ class HealthCardV1Document < Mindee::Parsing::Common::Prediction
11
+ include Mindee::Parsing::Standard
12
+ # The given names of the card holder.
13
+ # @return [Array<Mindee::Parsing::Standard::StringField>]
14
+ attr_reader :given_names
15
+ # The date when the carte vitale document was issued.
16
+ # @return [Mindee::Parsing::Standard::DateField]
17
+ attr_reader :issuance_date
18
+ # The social security number of the card holder.
19
+ # @return [Mindee::Parsing::Standard::StringField]
20
+ attr_reader :social_security
21
+ # The surname of the card holder.
22
+ # @return [Mindee::Parsing::Standard::StringField]
23
+ attr_reader :surname
24
+
25
+ # @param prediction [Hash]
26
+ # @param page_id [Integer, nil]
27
+ def initialize(prediction, page_id)
28
+ super()
29
+ @given_names = []
30
+ prediction['given_names'].each do |item|
31
+ @given_names.push(StringField.new(item, page_id))
32
+ end
33
+ @issuance_date = DateField.new(prediction['issuance_date'], page_id)
34
+ @social_security = StringField.new(prediction['social_security'], page_id)
35
+ @surname = StringField.new(prediction['surname'], page_id)
36
+ end
37
+
38
+ # @return [String]
39
+ def to_s
40
+ given_names = @given_names.join("\n #{' ' * 15}")
41
+ out_str = String.new
42
+ out_str << "\n:Given Name(s): #{given_names}".rstrip
43
+ out_str << "\n:Surname: #{@surname}".rstrip
44
+ out_str << "\n:Social Security Number: #{@social_security}".rstrip
45
+ out_str << "\n:Issuance Date: #{@issuance_date}".rstrip
46
+ out_str[1..].to_s
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'health_card_v1_document'
5
+
6
+ module Mindee
7
+ module Product
8
+ module FR
9
+ module HealthCard
10
+ # Health Card API version 1.0 page data.
11
+ class HealthCardV1Page < Mindee::Parsing::Common::Page
12
+ # @param prediction [Hash]
13
+ def initialize(prediction)
14
+ super(prediction)
15
+ @prediction = HealthCardV1PagePrediction.new(
16
+ prediction['prediction'],
17
+ prediction['id']
18
+ )
19
+ end
20
+ end
21
+
22
+ # Health Card V1 page prediction.
23
+ class HealthCardV1PagePrediction < HealthCardV1Document
24
+ # @return [String]
25
+ def to_s
26
+ out_str = String.new
27
+ out_str << "\n#{super}"
28
+ out_str
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'payslip_v3_document'
5
+ require_relative 'payslip_v3_page'
6
+
7
+ module Mindee
8
+ module Product
9
+ module FR
10
+ # Payslip module.
11
+ module Payslip
12
+ # Payslip API version 3 inference prediction.
13
+ class PayslipV3 < Mindee::Parsing::Common::Inference
14
+ @endpoint_name = 'payslip_fra'
15
+ @endpoint_version = '3'
16
+
17
+ # @param prediction [Hash]
18
+ def initialize(prediction)
19
+ super
20
+ @prediction = PayslipV3Document.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(PayslipV3Page.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
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module Payslip
9
+ # Information about the employee's bank account.
10
+ class PayslipV3BankAccountDetail < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The name of the bank.
13
+ # @return [String]
14
+ attr_reader :bank_name
15
+ # The IBAN of the bank account.
16
+ # @return [String]
17
+ attr_reader :iban
18
+ # The SWIFT code of the bank.
19
+ # @return [String]
20
+ attr_reader :swift
21
+
22
+ # @param prediction [Hash]
23
+ # @param page_id [Integer, nil]
24
+ def initialize(prediction, page_id)
25
+ super(prediction, page_id)
26
+ @bank_name = prediction['bank_name']
27
+ @iban = prediction['iban']
28
+ @swift = prediction['swift']
29
+ @page_id = page_id
30
+ end
31
+
32
+ # @return [Hash]
33
+ def printable_values
34
+ printable = {}
35
+ printable[:bank_name] = format_for_display(@bank_name)
36
+ printable[:iban] = format_for_display(@iban)
37
+ printable[:swift] = format_for_display(@swift)
38
+ printable
39
+ end
40
+
41
+ # @return [String]
42
+ def to_s
43
+ printable = printable_values
44
+ out_str = String.new
45
+ out_str << "\n :Bank Name: #{printable[:bank_name]}"
46
+ out_str << "\n :IBAN: #{printable[:iban]}"
47
+ out_str << "\n :SWIFT: #{printable[:swift]}"
48
+ out_str
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,166 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'payslip_v3_pay_period'
5
+ require_relative 'payslip_v3_employee'
6
+ require_relative 'payslip_v3_employer'
7
+ require_relative 'payslip_v3_bank_account_detail'
8
+ require_relative 'payslip_v3_employment'
9
+ require_relative 'payslip_v3_salary_detail'
10
+ require_relative 'payslip_v3_pay_detail'
11
+ require_relative 'payslip_v3_paid_time_off'
12
+
13
+ module Mindee
14
+ module Product
15
+ module FR
16
+ module Payslip
17
+ # Payslip API version 3.0 document data.
18
+ class PayslipV3Document < Mindee::Parsing::Common::Prediction
19
+ include Mindee::Parsing::Standard
20
+ # Information about the employee's bank account.
21
+ # @return [Mindee::Product::FR::Payslip::PayslipV3BankAccountDetail]
22
+ attr_reader :bank_account_details
23
+ # Information about the employee.
24
+ # @return [Mindee::Product::FR::Payslip::PayslipV3Employee]
25
+ attr_reader :employee
26
+ # Information about the employer.
27
+ # @return [Mindee::Product::FR::Payslip::PayslipV3Employer]
28
+ attr_reader :employer
29
+ # Information about the employment.
30
+ # @return [Mindee::Product::FR::Payslip::PayslipV3Employment]
31
+ attr_reader :employment
32
+ # Information about paid time off.
33
+ # @return [Array<Mindee::Product::FR::Payslip::PayslipV3PaidTimeOff>]
34
+ attr_reader :paid_time_off
35
+ # Detailed information about the pay.
36
+ # @return [Mindee::Product::FR::Payslip::PayslipV3PayDetail]
37
+ attr_reader :pay_detail
38
+ # Information about the pay period.
39
+ # @return [Mindee::Product::FR::Payslip::PayslipV3PayPeriod]
40
+ attr_reader :pay_period
41
+ # Detailed information about the earnings.
42
+ # @return [Array<Mindee::Product::FR::Payslip::PayslipV3SalaryDetail>]
43
+ attr_reader :salary_details
44
+
45
+ # @param prediction [Hash]
46
+ # @param page_id [Integer, nil]
47
+ def initialize(prediction, page_id)
48
+ super()
49
+ @bank_account_details = PayslipV3BankAccountDetail.new(prediction['bank_account_details'], page_id)
50
+ @employee = PayslipV3Employee.new(prediction['employee'], page_id)
51
+ @employer = PayslipV3Employer.new(prediction['employer'], page_id)
52
+ @employment = PayslipV3Employment.new(prediction['employment'], page_id)
53
+ @paid_time_off = []
54
+ prediction['paid_time_off'].each do |item|
55
+ @paid_time_off.push(PayslipV3PaidTimeOff.new(item, page_id))
56
+ end
57
+ @pay_detail = PayslipV3PayDetail.new(prediction['pay_detail'], page_id)
58
+ @pay_period = PayslipV3PayPeriod.new(prediction['pay_period'], page_id)
59
+ @salary_details = []
60
+ prediction['salary_details'].each do |item|
61
+ @salary_details.push(PayslipV3SalaryDetail.new(item, page_id))
62
+ end
63
+ end
64
+
65
+ # @return [String]
66
+ def to_s
67
+ pay_period = @pay_period.to_s
68
+ employee = @employee.to_s
69
+ employer = @employer.to_s
70
+ bank_account_details = @bank_account_details.to_s
71
+ employment = @employment.to_s
72
+ salary_details = salary_details_to_s
73
+ pay_detail = @pay_detail.to_s
74
+ paid_time_off = paid_time_off_to_s
75
+ out_str = String.new
76
+ out_str << "\n:Pay Period:"
77
+ out_str << pay_period
78
+ out_str << "\n:Employee:"
79
+ out_str << employee
80
+ out_str << "\n:Employer:"
81
+ out_str << employer
82
+ out_str << "\n:Bank Account Details:"
83
+ out_str << bank_account_details
84
+ out_str << "\n:Employment:"
85
+ out_str << employment
86
+ out_str << "\n:Salary Details:"
87
+ out_str << salary_details
88
+ out_str << "\n:Pay Detail:"
89
+ out_str << pay_detail
90
+ out_str << "\n:Paid Time Off:"
91
+ out_str << paid_time_off
92
+ out_str[1..].to_s
93
+ end
94
+
95
+ private
96
+
97
+ # @param char [String]
98
+ # @return [String]
99
+ def salary_details_separator(char)
100
+ out_str = String.new
101
+ out_str << ' '
102
+ out_str << "+#{char * 14}"
103
+ out_str << "+#{char * 11}"
104
+ out_str << "+#{char * 38}"
105
+ out_str << "+#{char * 8}"
106
+ out_str << "+#{char * 11}"
107
+ out_str << '+'
108
+ out_str
109
+ end
110
+
111
+ # @return [String]
112
+ def salary_details_to_s
113
+ return '' if @salary_details.empty?
114
+
115
+ line_items = @salary_details.map(&:to_table_line).join("\n#{salary_details_separator('-')}\n ")
116
+ out_str = String.new
117
+ out_str << "\n#{salary_details_separator('-')}"
118
+ out_str << "\n |"
119
+ out_str << ' Amount |'
120
+ out_str << ' Base |'
121
+ out_str << ' Description |'
122
+ out_str << ' Number |'
123
+ out_str << ' Rate |'
124
+ out_str << "\n#{salary_details_separator('=')}"
125
+ out_str << "\n #{line_items}"
126
+ out_str << "\n#{salary_details_separator('-')}"
127
+ out_str
128
+ end
129
+
130
+ # @param char [String]
131
+ # @return [String]
132
+ def paid_time_off_separator(char)
133
+ out_str = String.new
134
+ out_str << ' '
135
+ out_str << "+#{char * 11}"
136
+ out_str << "+#{char * 8}"
137
+ out_str << "+#{char * 13}"
138
+ out_str << "+#{char * 11}"
139
+ out_str << "+#{char * 11}"
140
+ out_str << '+'
141
+ out_str
142
+ end
143
+
144
+ # @return [String]
145
+ def paid_time_off_to_s
146
+ return '' if @paid_time_off.empty?
147
+
148
+ line_items = @paid_time_off.map(&:to_table_line).join("\n#{paid_time_off_separator('-')}\n ")
149
+ out_str = String.new
150
+ out_str << "\n#{paid_time_off_separator('-')}"
151
+ out_str << "\n |"
152
+ out_str << ' Accrued |'
153
+ out_str << ' Period |'
154
+ out_str << ' Type |'
155
+ out_str << ' Remaining |'
156
+ out_str << ' Used |'
157
+ out_str << "\n#{paid_time_off_separator('=')}"
158
+ out_str << "\n #{line_items}"
159
+ out_str << "\n#{paid_time_off_separator('-')}"
160
+ out_str
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module Payslip
9
+ # Information about the employee.
10
+ class PayslipV3Employee < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The address of the employee.
13
+ # @return [String]
14
+ attr_reader :address
15
+ # The date of birth of the employee.
16
+ # @return [String]
17
+ attr_reader :date_of_birth
18
+ # The first name of the employee.
19
+ # @return [String]
20
+ attr_reader :first_name
21
+ # The last name of the employee.
22
+ # @return [String]
23
+ attr_reader :last_name
24
+ # The phone number of the employee.
25
+ # @return [String]
26
+ attr_reader :phone_number
27
+ # The registration number of the employee.
28
+ # @return [String]
29
+ attr_reader :registration_number
30
+ # The social security number of the employee.
31
+ # @return [String]
32
+ attr_reader :social_security_number
33
+
34
+ # @param prediction [Hash]
35
+ # @param page_id [Integer, nil]
36
+ def initialize(prediction, page_id)
37
+ super(prediction, page_id)
38
+ @address = prediction['address']
39
+ @date_of_birth = prediction['date_of_birth']
40
+ @first_name = prediction['first_name']
41
+ @last_name = prediction['last_name']
42
+ @phone_number = prediction['phone_number']
43
+ @registration_number = prediction['registration_number']
44
+ @social_security_number = prediction['social_security_number']
45
+ @page_id = page_id
46
+ end
47
+
48
+ # @return [Hash]
49
+ def printable_values
50
+ printable = {}
51
+ printable[:address] = format_for_display(@address)
52
+ printable[:date_of_birth] = format_for_display(@date_of_birth)
53
+ printable[:first_name] = format_for_display(@first_name)
54
+ printable[:last_name] = format_for_display(@last_name)
55
+ printable[:phone_number] = format_for_display(@phone_number)
56
+ printable[:registration_number] = format_for_display(@registration_number)
57
+ printable[:social_security_number] = format_for_display(@social_security_number)
58
+ printable
59
+ end
60
+
61
+ # @return [String]
62
+ def to_s
63
+ printable = printable_values
64
+ out_str = String.new
65
+ out_str << "\n :Address: #{printable[:address]}"
66
+ out_str << "\n :Date of Birth: #{printable[:date_of_birth]}"
67
+ out_str << "\n :First Name: #{printable[:first_name]}"
68
+ out_str << "\n :Last Name: #{printable[:last_name]}"
69
+ out_str << "\n :Phone Number: #{printable[:phone_number]}"
70
+ out_str << "\n :Registration Number: #{printable[:registration_number]}"
71
+ out_str << "\n :Social Security Number: #{printable[:social_security_number]}"
72
+ out_str
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module Payslip
9
+ # Information about the employer.
10
+ class PayslipV3Employer < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The address of the employer.
13
+ # @return [String]
14
+ attr_reader :address
15
+ # The company ID of the employer.
16
+ # @return [String]
17
+ attr_reader :company_id
18
+ # The site of the company.
19
+ # @return [String]
20
+ attr_reader :company_site
21
+ # The NAF code of the employer.
22
+ # @return [String]
23
+ attr_reader :naf_code
24
+ # The name of the employer.
25
+ # @return [String]
26
+ attr_reader :name
27
+ # The phone number of the employer.
28
+ # @return [String]
29
+ attr_reader :phone_number
30
+ # The URSSAF number of the employer.
31
+ # @return [String]
32
+ attr_reader :urssaf_number
33
+
34
+ # @param prediction [Hash]
35
+ # @param page_id [Integer, nil]
36
+ def initialize(prediction, page_id)
37
+ super(prediction, page_id)
38
+ @address = prediction['address']
39
+ @company_id = prediction['company_id']
40
+ @company_site = prediction['company_site']
41
+ @naf_code = prediction['naf_code']
42
+ @name = prediction['name']
43
+ @phone_number = prediction['phone_number']
44
+ @urssaf_number = prediction['urssaf_number']
45
+ @page_id = page_id
46
+ end
47
+
48
+ # @return [Hash]
49
+ def printable_values
50
+ printable = {}
51
+ printable[:address] = format_for_display(@address)
52
+ printable[:company_id] = format_for_display(@company_id)
53
+ printable[:company_site] = format_for_display(@company_site)
54
+ printable[:naf_code] = format_for_display(@naf_code)
55
+ printable[:name] = format_for_display(@name)
56
+ printable[:phone_number] = format_for_display(@phone_number)
57
+ printable[:urssaf_number] = format_for_display(@urssaf_number)
58
+ printable
59
+ end
60
+
61
+ # @return [String]
62
+ def to_s
63
+ printable = printable_values
64
+ out_str = String.new
65
+ out_str << "\n :Address: #{printable[:address]}"
66
+ out_str << "\n :Company ID: #{printable[:company_id]}"
67
+ out_str << "\n :Company Site: #{printable[:company_site]}"
68
+ out_str << "\n :NAF Code: #{printable[:naf_code]}"
69
+ out_str << "\n :Name: #{printable[:name]}"
70
+ out_str << "\n :Phone Number: #{printable[:phone_number]}"
71
+ out_str << "\n :URSSAF Number: #{printable[:urssaf_number]}"
72
+ out_str
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module Payslip
9
+ # Information about the employment.
10
+ class PayslipV3Employment < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The category of the employment.
13
+ # @return [String]
14
+ attr_reader :category
15
+ # The coefficient of the employment.
16
+ # @return [String]
17
+ attr_reader :coefficient
18
+ # The collective agreement of the employment.
19
+ # @return [String]
20
+ attr_reader :collective_agreement
21
+ # The job title of the employee.
22
+ # @return [String]
23
+ attr_reader :job_title
24
+ # The position level of the employment.
25
+ # @return [String]
26
+ attr_reader :position_level
27
+ # The seniority date of the employment.
28
+ # @return [String]
29
+ attr_reader :seniority_date
30
+ # The start date of the employment.
31
+ # @return [String]
32
+ attr_reader :start_date
33
+
34
+ # @param prediction [Hash]
35
+ # @param page_id [Integer, nil]
36
+ def initialize(prediction, page_id)
37
+ super(prediction, page_id)
38
+ @category = prediction['category']
39
+ @coefficient = prediction['coefficient']
40
+ @collective_agreement = prediction['collective_agreement']
41
+ @job_title = prediction['job_title']
42
+ @position_level = prediction['position_level']
43
+ @seniority_date = prediction['seniority_date']
44
+ @start_date = prediction['start_date']
45
+ @page_id = page_id
46
+ end
47
+
48
+ # @return [Hash]
49
+ def printable_values
50
+ printable = {}
51
+ printable[:category] = format_for_display(@category)
52
+ printable[:coefficient] = format_for_display(@coefficient)
53
+ printable[:collective_agreement] = format_for_display(@collective_agreement)
54
+ printable[:job_title] = format_for_display(@job_title)
55
+ printable[:position_level] = format_for_display(@position_level)
56
+ printable[:seniority_date] = format_for_display(@seniority_date)
57
+ printable[:start_date] = format_for_display(@start_date)
58
+ printable
59
+ end
60
+
61
+ # @return [String]
62
+ def to_s
63
+ printable = printable_values
64
+ out_str = String.new
65
+ out_str << "\n :Category: #{printable[:category]}"
66
+ out_str << "\n :Coefficient: #{printable[:coefficient]}"
67
+ out_str << "\n :Collective Agreement: #{printable[:collective_agreement]}"
68
+ out_str << "\n :Job Title: #{printable[:job_title]}"
69
+ out_str << "\n :Position Level: #{printable[:position_level]}"
70
+ out_str << "\n :Seniority Date: #{printable[:seniority_date]}"
71
+ out_str << "\n :Start Date: #{printable[:start_date]}"
72
+ out_str
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'payslip_v3_document'
5
+
6
+ module Mindee
7
+ module Product
8
+ module FR
9
+ module Payslip
10
+ # Payslip API version 3.0 page data.
11
+ class PayslipV3Page < Mindee::Parsing::Common::Page
12
+ # @param prediction [Hash]
13
+ def initialize(prediction)
14
+ super(prediction)
15
+ @prediction = PayslipV3PagePrediction.new(
16
+ prediction['prediction'],
17
+ prediction['id']
18
+ )
19
+ end
20
+ end
21
+
22
+ # Payslip V3 page prediction.
23
+ class PayslipV3PagePrediction < PayslipV3Document
24
+ # @return [String]
25
+ def to_s
26
+ out_str = String.new
27
+ out_str << "\n#{super}"
28
+ out_str
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end