mindee 3.12.0 → 3.14.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +26 -0
  4. data/README.md +23 -23
  5. data/Rakefile +5 -0
  6. data/docs/bank_account_details_v2.md +5 -1
  7. data/docs/bank_check_v1.md +6 -2
  8. data/docs/bank_statement_fr_v1.md +3 -0
  9. data/docs/barcode_reader_v1.md +5 -1
  10. data/docs/bill_of_lading_v1.md +251 -0
  11. data/docs/carte_grise_v1.md +5 -1
  12. data/docs/carte_vitale_v1.md +5 -1
  13. data/docs/code_samples/bill_of_lading_v1_async.txt +19 -0
  14. data/docs/code_samples/energy_bill_fra_v1_async.txt +19 -0
  15. data/docs/code_samples/invoices_v4_async.txt +19 -0
  16. data/docs/code_samples/nutrition_facts_v1_async.txt +19 -0
  17. data/docs/code_samples/payslip_fra_v2_async.txt +19 -0
  18. data/docs/cropper_v1.md +6 -2
  19. data/docs/custom_v1.md +5 -3
  20. data/docs/energy_bill_fra_v1.md +309 -0
  21. data/docs/eu_driver_license_v1.md +6 -2
  22. data/docs/expense_receipts_v5.md +30 -5
  23. data/docs/financial_document_v1.md +43 -1
  24. data/docs/generated_v1.md +3 -0
  25. data/docs/getting_started.md +3 -0
  26. data/docs/idcard_fr_v2.md +15 -2
  27. data/docs/international_id_v2.md +13 -1
  28. data/docs/invoice_splitter_v1.md +16 -13
  29. data/docs/invoices_v4.md +70 -23
  30. data/docs/license_plates_v1.md +5 -1
  31. data/docs/multi_receipts_detector_v1.md +5 -1
  32. data/docs/nutrition_facts_v1.md +374 -0
  33. data/docs/passport_v1.md +5 -1
  34. data/docs/payslip_fra_v2.md +294 -0
  35. data/docs/proof_of_address_v1.md +5 -1
  36. data/docs/resume_v1.md +24 -1
  37. data/docs/us_driver_license_v1.md +6 -2
  38. data/docs/us_healthcare_cards_v1.md +5 -1
  39. data/docs/us_mail_v2.md +6 -2
  40. data/docs/us_w9_v1.md +6 -2
  41. data/examples/auto_invoice_splitter_extraction.rb +48 -0
  42. data/examples/auto_multi_receipts_detector_extraction.rb +31 -0
  43. data/lib/mindee/client.rb +20 -8
  44. data/lib/mindee/{image_extraction → extraction}/common/extracted_image.rb +1 -1
  45. data/lib/mindee/extraction/common/image_extractor.rb +192 -0
  46. data/lib/mindee/{image_extraction → extraction}/common.rb +1 -0
  47. data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +32 -0
  48. data/lib/mindee/extraction/pdf_extractor/extracted_pdf.rb +55 -0
  49. data/lib/mindee/extraction/pdf_extractor/pdf_extractor.rb +111 -0
  50. data/lib/mindee/extraction/pdf_extractor.rb +4 -0
  51. data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +322 -0
  52. data/lib/mindee/extraction/tax_extractor.rb +1 -320
  53. data/lib/mindee/extraction.rb +3 -0
  54. data/lib/mindee/http/endpoint.rb +18 -6
  55. data/lib/mindee/parsing/common/api_response.rb +1 -1
  56. data/lib/mindee/parsing/common/document.rb +31 -1
  57. data/lib/mindee/parsing/common/extras/cropper_extra.rb +29 -0
  58. data/lib/mindee/parsing/common/extras/extras.rb +50 -0
  59. data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +32 -0
  60. data/lib/mindee/parsing/common/extras.rb +5 -0
  61. data/lib/mindee/parsing/common/page.rb +5 -0
  62. data/lib/mindee/parsing/standard/base_field.rb +1 -0
  63. data/lib/mindee/parsing/standard/date_field.rb +4 -0
  64. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +39 -0
  65. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +52 -0
  66. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +95 -0
  67. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +58 -0
  68. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +136 -0
  69. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +58 -0
  70. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +32 -0
  71. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +58 -0
  72. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +11 -1
  73. data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +15 -1
  74. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  75. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +4 -15
  76. data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +41 -0
  77. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +235 -0
  78. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +48 -0
  79. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +48 -0
  80. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +97 -0
  81. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +54 -0
  82. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +34 -0
  83. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +97 -0
  84. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +97 -0
  85. data/lib/mindee/product/fr/payslip/payslip_v2.rb +41 -0
  86. data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +54 -0
  87. data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +128 -0
  88. data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +78 -0
  89. data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +78 -0
  90. data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +72 -0
  91. data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +34 -0
  92. data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +100 -0
  93. data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +66 -0
  94. data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +56 -0
  95. data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +81 -0
  96. data/lib/mindee/product/invoice/invoice_v4_document.rb +11 -1
  97. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +15 -1
  98. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  99. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +1 -1
  100. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +39 -0
  101. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +52 -0
  102. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +52 -0
  103. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +52 -0
  104. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +52 -0
  105. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +173 -0
  106. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +87 -0
  107. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +32 -0
  108. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +52 -0
  109. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +52 -0
  110. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +46 -0
  111. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +58 -0
  112. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +52 -0
  113. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +52 -0
  114. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +52 -0
  115. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +52 -0
  116. data/lib/mindee/product/receipt/receipt_v5_line_item.rb +11 -1
  117. data/lib/mindee/product/resume/resume_v1_certificate.rb +11 -1
  118. data/lib/mindee/product/resume/resume_v1_education.rb +14 -1
  119. data/lib/mindee/product/resume/resume_v1_language.rb +9 -1
  120. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +15 -1
  121. data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +9 -1
  122. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +9 -1
  123. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +14 -1
  124. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +5 -17
  125. data/lib/mindee/product.rb +5 -1
  126. data/lib/mindee/version.rb +1 -1
  127. metadata +71 -9
  128. data/lib/mindee/image_extraction/common/image_extractor.rb +0 -191
  129. data/lib/mindee/image_extraction/multi_receipts_extractor/multi_receipts_extractor.rb +0 -26
  130. data/lib/mindee/image_extraction.rb +0 -4
  131. /data/lib/mindee/{image_extraction → extraction}/multi_receipts_extractor.rb +0 -0
  132. /data/lib/mindee/extraction/{ocr_extractor.rb → tax_extractor/ocr_extractor.rb} +0 -0
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'payslip_v2_employee'
5
+ require_relative 'payslip_v2_employer'
6
+ require_relative 'payslip_v2_bank_account_detail'
7
+ require_relative 'payslip_v2_employment'
8
+ require_relative 'payslip_v2_salary_detail'
9
+ require_relative 'payslip_v2_pay_detail'
10
+ require_relative 'payslip_v2_pto'
11
+ require_relative 'payslip_v2_pay_period'
12
+
13
+ module Mindee
14
+ module Product
15
+ module FR
16
+ module Payslip
17
+ # Payslip API version 2.0 document data.
18
+ class PayslipV2Document < Mindee::Parsing::Common::Prediction
19
+ include Mindee::Parsing::Standard
20
+ # Information about the employee's bank account.
21
+ # @return [Mindee::Product::FR::Payslip::PayslipV2BankAccountDetail]
22
+ attr_reader :bank_account_details
23
+ # Information about the employee.
24
+ # @return [Mindee::Product::FR::Payslip::PayslipV2Employee]
25
+ attr_reader :employee
26
+ # Information about the employer.
27
+ # @return [Mindee::Product::FR::Payslip::PayslipV2Employer]
28
+ attr_reader :employer
29
+ # Information about the employment.
30
+ # @return [Mindee::Product::FR::Payslip::PayslipV2Employment]
31
+ attr_reader :employment
32
+ # Detailed information about the pay.
33
+ # @return [Mindee::Product::FR::Payslip::PayslipV2PayDetail]
34
+ attr_reader :pay_detail
35
+ # Information about the pay period.
36
+ # @return [Mindee::Product::FR::Payslip::PayslipV2PayPeriod]
37
+ attr_reader :pay_period
38
+ # Information about paid time off.
39
+ # @return [Mindee::Product::FR::Payslip::PayslipV2Pto]
40
+ attr_reader :pto
41
+ # Detailed information about the earnings.
42
+ # @return [Array<Mindee::Product::FR::Payslip::PayslipV2SalaryDetail>]
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 = PayslipV2BankAccountDetail.new(prediction['bank_account_details'], page_id)
50
+ @employee = PayslipV2Employee.new(prediction['employee'], page_id)
51
+ @employer = PayslipV2Employer.new(prediction['employer'], page_id)
52
+ @employment = PayslipV2Employment.new(prediction['employment'], page_id)
53
+ @pay_detail = PayslipV2PayDetail.new(prediction['pay_detail'], page_id)
54
+ @pay_period = PayslipV2PayPeriod.new(prediction['pay_period'], page_id)
55
+ @pto = PayslipV2Pto.new(prediction['pto'], page_id)
56
+ @salary_details = []
57
+ prediction['salary_details'].each do |item|
58
+ @salary_details.push(PayslipV2SalaryDetail.new(item, page_id))
59
+ end
60
+ end
61
+
62
+ # @return [String]
63
+ def to_s
64
+ employee = @employee.to_s
65
+ employer = @employer.to_s
66
+ bank_account_details = @bank_account_details.to_s
67
+ employment = @employment.to_s
68
+ salary_details = salary_details_to_s
69
+ pay_detail = @pay_detail.to_s
70
+ pto = @pto.to_s
71
+ pay_period = @pay_period.to_s
72
+ out_str = String.new
73
+ out_str << "\n:Employee:"
74
+ out_str << employee
75
+ out_str << "\n:Employer:"
76
+ out_str << employer
77
+ out_str << "\n:Bank Account Details:"
78
+ out_str << bank_account_details
79
+ out_str << "\n:Employment:"
80
+ out_str << employment
81
+ out_str << "\n:Salary Details:"
82
+ out_str << salary_details
83
+ out_str << "\n:Pay Detail:"
84
+ out_str << pay_detail
85
+ out_str << "\n:PTO:"
86
+ out_str << pto
87
+ out_str << "\n:Pay Period:"
88
+ out_str << pay_period
89
+ out_str[1..].to_s
90
+ end
91
+
92
+ private
93
+
94
+ # @param char [String]
95
+ # @return [String]
96
+ def salary_details_separator(char)
97
+ out_str = String.new
98
+ out_str << ' '
99
+ out_str << "+#{char * 14}"
100
+ out_str << "+#{char * 11}"
101
+ out_str << "+#{char * 38}"
102
+ out_str << "+#{char * 11}"
103
+ out_str << '+'
104
+ out_str
105
+ end
106
+
107
+ # @return [String]
108
+ def salary_details_to_s
109
+ return '' if @salary_details.empty?
110
+
111
+ line_items = @salary_details.map(&:to_table_line).join("\n#{salary_details_separator('-')}\n ")
112
+ out_str = String.new
113
+ out_str << "\n#{salary_details_separator('-')}"
114
+ out_str << "\n |"
115
+ out_str << ' Amount |'
116
+ out_str << ' Base |'
117
+ out_str << ' Description |'
118
+ out_str << ' Rate |'
119
+ out_str << "\n#{salary_details_separator('=')}"
120
+ out_str << "\n #{line_items}"
121
+ out_str << "\n#{salary_details_separator('-')}"
122
+ out_str
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
128
+ 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 PayslipV2Employee < 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 PayslipV2Employer < 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,72 @@
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 PayslipV2Employment < 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 [Float]
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 start date of the employment.
28
+ # @return [String]
29
+ attr_reader :start_date
30
+
31
+ # @param prediction [Hash]
32
+ # @param page_id [Integer, nil]
33
+ def initialize(prediction, page_id)
34
+ super(prediction, page_id)
35
+ @category = prediction['category']
36
+ @coefficient = prediction['coefficient']
37
+ @collective_agreement = prediction['collective_agreement']
38
+ @job_title = prediction['job_title']
39
+ @position_level = prediction['position_level']
40
+ @start_date = prediction['start_date']
41
+ @page_id = page_id
42
+ end
43
+
44
+ # @return [Hash]
45
+ def printable_values
46
+ printable = {}
47
+ printable[:category] = format_for_display(@category)
48
+ printable[:coefficient] = @coefficient.nil? ? '' : Field.float_to_string(@coefficient)
49
+ printable[:collective_agreement] = format_for_display(@collective_agreement)
50
+ printable[:job_title] = format_for_display(@job_title)
51
+ printable[:position_level] = format_for_display(@position_level)
52
+ printable[:start_date] = format_for_display(@start_date)
53
+ printable
54
+ end
55
+
56
+ # @return [String]
57
+ def to_s
58
+ printable = printable_values
59
+ out_str = String.new
60
+ out_str << "\n :Category: #{printable[:category]}"
61
+ out_str << "\n :Coefficient: #{printable[:coefficient]}"
62
+ out_str << "\n :Collective Agreement: #{printable[:collective_agreement]}"
63
+ out_str << "\n :Job Title: #{printable[:job_title]}"
64
+ out_str << "\n :Position Level: #{printable[:position_level]}"
65
+ out_str << "\n :Start Date: #{printable[:start_date]}"
66
+ out_str
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+ require_relative 'payslip_v2_document'
5
+
6
+ module Mindee
7
+ module Product
8
+ module FR
9
+ module Payslip
10
+ # Payslip API version 2.0 page data.
11
+ class PayslipV2Page < Mindee::Parsing::Common::Page
12
+ # @param prediction [Hash]
13
+ def initialize(prediction)
14
+ super(prediction)
15
+ @prediction = PayslipV2PagePrediction.new(
16
+ prediction['prediction'],
17
+ prediction['id']
18
+ )
19
+ end
20
+ end
21
+
22
+ # Payslip V2 page prediction.
23
+ class PayslipV2PagePrediction < PayslipV2Document
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,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../parsing'
4
+
5
+ module Mindee
6
+ module Product
7
+ module FR
8
+ module Payslip
9
+ # Detailed information about the pay.
10
+ class PayslipV2PayDetail < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The gross salary of the employee.
13
+ # @return [Float]
14
+ attr_reader :gross_salary
15
+ # The year-to-date gross salary of the employee.
16
+ # @return [Float]
17
+ attr_reader :gross_salary_ytd
18
+ # The income tax rate of the employee.
19
+ # @return [Float]
20
+ attr_reader :income_tax_rate
21
+ # The income tax withheld from the employee's pay.
22
+ # @return [Float]
23
+ attr_reader :income_tax_withheld
24
+ # The net paid amount of the employee.
25
+ # @return [Float]
26
+ attr_reader :net_paid
27
+ # The net paid amount before tax of the employee.
28
+ # @return [Float]
29
+ attr_reader :net_paid_before_tax
30
+ # The net taxable amount of the employee.
31
+ # @return [Float]
32
+ attr_reader :net_taxable
33
+ # The year-to-date net taxable amount of the employee.
34
+ # @return [Float]
35
+ attr_reader :net_taxable_ytd
36
+ # The total cost to the employer.
37
+ # @return [Float]
38
+ attr_reader :total_cost_employer
39
+ # The total taxes and deductions of the employee.
40
+ # @return [Float]
41
+ attr_reader :total_taxes_and_deductions
42
+
43
+ # @param prediction [Hash]
44
+ # @param page_id [Integer, nil]
45
+ def initialize(prediction, page_id)
46
+ super(prediction, page_id)
47
+ @gross_salary = prediction['gross_salary']
48
+ @gross_salary_ytd = prediction['gross_salary_ytd']
49
+ @income_tax_rate = prediction['income_tax_rate']
50
+ @income_tax_withheld = prediction['income_tax_withheld']
51
+ @net_paid = prediction['net_paid']
52
+ @net_paid_before_tax = prediction['net_paid_before_tax']
53
+ @net_taxable = prediction['net_taxable']
54
+ @net_taxable_ytd = prediction['net_taxable_ytd']
55
+ @total_cost_employer = prediction['total_cost_employer']
56
+ @total_taxes_and_deductions = prediction['total_taxes_and_deductions']
57
+ @page_id = page_id
58
+ end
59
+
60
+ # @return [Hash]
61
+ def printable_values
62
+ printable = {}
63
+ printable[:gross_salary] = @gross_salary.nil? ? '' : Field.float_to_string(@gross_salary)
64
+ printable[:gross_salary_ytd] = @gross_salary_ytd.nil? ? '' : Field.float_to_string(@gross_salary_ytd)
65
+ printable[:income_tax_rate] = @income_tax_rate.nil? ? '' : Field.float_to_string(@income_tax_rate)
66
+ printable[:income_tax_withheld] =
67
+ @income_tax_withheld.nil? ? '' : Field.float_to_string(@income_tax_withheld)
68
+ printable[:net_paid] = @net_paid.nil? ? '' : Field.float_to_string(@net_paid)
69
+ printable[:net_paid_before_tax] =
70
+ @net_paid_before_tax.nil? ? '' : Field.float_to_string(@net_paid_before_tax)
71
+ printable[:net_taxable] = @net_taxable.nil? ? '' : Field.float_to_string(@net_taxable)
72
+ printable[:net_taxable_ytd] = @net_taxable_ytd.nil? ? '' : Field.float_to_string(@net_taxable_ytd)
73
+ printable[:total_cost_employer] =
74
+ @total_cost_employer.nil? ? '' : Field.float_to_string(@total_cost_employer)
75
+ printable[:total_taxes_and_deductions] =
76
+ @total_taxes_and_deductions.nil? ? '' : Field.float_to_string(@total_taxes_and_deductions)
77
+ printable
78
+ end
79
+
80
+ # @return [String]
81
+ def to_s
82
+ printable = printable_values
83
+ out_str = String.new
84
+ out_str << "\n :Gross Salary: #{printable[:gross_salary]}"
85
+ out_str << "\n :Gross Salary YTD: #{printable[:gross_salary_ytd]}"
86
+ out_str << "\n :Income Tax Rate: #{printable[:income_tax_rate]}"
87
+ out_str << "\n :Income Tax Withheld: #{printable[:income_tax_withheld]}"
88
+ out_str << "\n :Net Paid: #{printable[:net_paid]}"
89
+ out_str << "\n :Net Paid Before Tax: #{printable[:net_paid_before_tax]}"
90
+ out_str << "\n :Net Taxable: #{printable[:net_taxable]}"
91
+ out_str << "\n :Net Taxable YTD: #{printable[:net_taxable_ytd]}"
92
+ out_str << "\n :Total Cost Employer: #{printable[:total_cost_employer]}"
93
+ out_str << "\n :Total Taxes and Deductions: #{printable[:total_taxes_and_deductions]}"
94
+ out_str
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,66 @@
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 pay period.
10
+ class PayslipV2PayPeriod < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The end date of the pay period.
13
+ # @return [String]
14
+ attr_reader :end_date
15
+ # The month of the pay period.
16
+ # @return [String]
17
+ attr_reader :month
18
+ # The date of payment for the pay period.
19
+ # @return [String]
20
+ attr_reader :payment_date
21
+ # The start date of the pay period.
22
+ # @return [String]
23
+ attr_reader :start_date
24
+ # The year of the pay period.
25
+ # @return [String]
26
+ attr_reader :year
27
+
28
+ # @param prediction [Hash]
29
+ # @param page_id [Integer, nil]
30
+ def initialize(prediction, page_id)
31
+ super(prediction, page_id)
32
+ @end_date = prediction['end_date']
33
+ @month = prediction['month']
34
+ @payment_date = prediction['payment_date']
35
+ @start_date = prediction['start_date']
36
+ @year = prediction['year']
37
+ @page_id = page_id
38
+ end
39
+
40
+ # @return [Hash]
41
+ def printable_values
42
+ printable = {}
43
+ printable[:end_date] = format_for_display(@end_date)
44
+ printable[:month] = format_for_display(@month)
45
+ printable[:payment_date] = format_for_display(@payment_date)
46
+ printable[:start_date] = format_for_display(@start_date)
47
+ printable[:year] = format_for_display(@year)
48
+ printable
49
+ end
50
+
51
+ # @return [String]
52
+ def to_s
53
+ printable = printable_values
54
+ out_str = String.new
55
+ out_str << "\n :End Date: #{printable[:end_date]}"
56
+ out_str << "\n :Month: #{printable[:month]}"
57
+ out_str << "\n :Payment Date: #{printable[:payment_date]}"
58
+ out_str << "\n :Start Date: #{printable[:start_date]}"
59
+ out_str << "\n :Year: #{printable[:year]}"
60
+ out_str
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,56 @@
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 paid time off.
10
+ class PayslipV2Pto < Mindee::Parsing::Standard::FeatureField
11
+ include Mindee::Parsing::Standard
12
+ # The amount of paid time off accrued in this period.
13
+ # @return [Float]
14
+ attr_reader :accrued_this_period
15
+ # The balance of paid time off at the end of the period.
16
+ # @return [Float]
17
+ attr_reader :balance_end_of_period
18
+ # The amount of paid time off used in this period.
19
+ # @return [Float]
20
+ attr_reader :used_this_period
21
+
22
+ # @param prediction [Hash]
23
+ # @param page_id [Integer, nil]
24
+ def initialize(prediction, page_id)
25
+ super(prediction, page_id)
26
+ @accrued_this_period = prediction['accrued_this_period']
27
+ @balance_end_of_period = prediction['balance_end_of_period']
28
+ @used_this_period = prediction['used_this_period']
29
+ @page_id = page_id
30
+ end
31
+
32
+ # @return [Hash]
33
+ def printable_values
34
+ printable = {}
35
+ printable[:accrued_this_period] =
36
+ @accrued_this_period.nil? ? '' : Field.float_to_string(@accrued_this_period)
37
+ printable[:balance_end_of_period] =
38
+ @balance_end_of_period.nil? ? '' : Field.float_to_string(@balance_end_of_period)
39
+ printable[:used_this_period] = @used_this_period.nil? ? '' : Field.float_to_string(@used_this_period)
40
+ printable
41
+ end
42
+
43
+ # @return [String]
44
+ def to_s
45
+ printable = printable_values
46
+ out_str = String.new
47
+ out_str << "\n :Accrued This Period: #{printable[:accrued_this_period]}"
48
+ out_str << "\n :Balance End of Period: #{printable[:balance_end_of_period]}"
49
+ out_str << "\n :Used This Period: #{printable[:used_this_period]}"
50
+ out_str
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end