mindee 3.16.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +4 -4
- data/bin/mindee.rb +20 -8
- data/docs/code_samples/{international_id_v1_async.txt → driver_license_v1_async.txt} +1 -1
- data/docs/code_samples/french_healthcard_v1_async.txt +19 -0
- data/docs/code_samples/{carte_vitale_v1.txt → payslip_fra_v3_async.txt} +2 -2
- data/docs/code_samples/workflow_execution.txt +29 -0
- data/docs/custom_v1.md +1 -1
- data/docs/driver_license_v1.md +156 -0
- data/docs/{carte_vitale_v1.md → french_healthcard_v1.md} +14 -24
- data/docs/getting_started.md +5 -5
- data/docs/payslip_fra_v3.md +319 -0
- data/lib/mindee/client.rb +40 -0
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +34 -19
- data/lib/mindee/http/workflow_endpoint.rb +90 -0
- data/lib/mindee/http.rb +1 -0
- data/lib/mindee/input/sources/base64_input_source.rb +31 -0
- data/lib/mindee/input/sources/bytes_input_source.rb +21 -0
- data/lib/mindee/input/sources/file_input_source.rb +20 -0
- data/lib/mindee/input/sources/local_input_source.rb +183 -0
- data/lib/mindee/input/sources/path_input_source.rb +20 -0
- data/lib/mindee/input/sources/url_input_source.rb +127 -0
- data/lib/mindee/input/sources.rb +6 -248
- data/lib/mindee/parsing/common/api_response.rb +22 -1
- data/lib/mindee/parsing/common/execution.rb +73 -0
- data/lib/mindee/parsing/common/execution_file.rb +24 -0
- data/lib/mindee/parsing/common/execution_priority.rb +30 -0
- data/lib/mindee/parsing/common.rb +3 -0
- data/lib/mindee/product/{international_id/international_id_v1.rb → driver_license/driver_license_v1.rb} +9 -9
- data/lib/mindee/product/driver_license/driver_license_v1_document.rb +91 -0
- data/lib/mindee/product/{international_id/international_id_v1_page.rb → driver_license/driver_license_v1_page.rb} +7 -7
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1.rb → health_card/health_card_v1.rb} +9 -9
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1_document.rb → health_card/health_card_v1_document.rb} +6 -6
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1_page.rb → health_card/health_card_v1_page.rb} +7 -7
- data/lib/mindee/product/fr/payslip/payslip_v3.rb +41 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +54 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +166 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +34 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +89 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +100 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +66 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +89 -0
- data/lib/mindee/product/resume/resume_v1_document.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_page.rb +1 -1
- data/lib/mindee/product.rb +3 -2
- data/lib/mindee/version.rb +1 -1
- metadata +36 -14
- data/docs/eu_driver_license_v1.md +0 -227
- data/docs/proof_of_address_v1.md +0 -211
- data/docs/us_driver_license_v1.md +0 -272
- data/lib/mindee/product/international_id/international_id_v1_document.rb +0 -109
@@ -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 '
|
5
|
-
require_relative '
|
4
|
+
require_relative 'driver_license_v1_document'
|
5
|
+
require_relative 'driver_license_v1_page'
|
6
6
|
|
7
7
|
module Mindee
|
8
8
|
module Product
|
9
|
-
#
|
10
|
-
module
|
11
|
-
#
|
12
|
-
class
|
13
|
-
@endpoint_name = '
|
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
14
|
@endpoint_version = '1'
|
15
15
|
|
16
16
|
# @param prediction [Hash]
|
17
17
|
def initialize(prediction)
|
18
18
|
super
|
19
|
-
@prediction =
|
19
|
+
@prediction = DriverLicenseV1Document.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(
|
23
|
+
@pages.push(DriverLicenseV1Page.new(page))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
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
|
@@ -1,25 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../parsing'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'driver_license_v1_document'
|
5
5
|
|
6
6
|
module Mindee
|
7
7
|
module Product
|
8
|
-
module
|
9
|
-
#
|
10
|
-
class
|
8
|
+
module DriverLicense
|
9
|
+
# Driver License API version 1.0 page data.
|
10
|
+
class DriverLicenseV1Page < Mindee::Parsing::Common::Page
|
11
11
|
# @param prediction [Hash]
|
12
12
|
def initialize(prediction)
|
13
13
|
super(prediction)
|
14
|
-
@prediction =
|
14
|
+
@prediction = DriverLicenseV1PagePrediction.new(
|
15
15
|
prediction['prediction'],
|
16
16
|
prediction['id']
|
17
17
|
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
#
|
22
|
-
class
|
21
|
+
# Driver License V1 page prediction.
|
22
|
+
class DriverLicenseV1PagePrediction < DriverLicenseV1Document
|
23
23
|
# @return [String]
|
24
24
|
def to_s
|
25
25
|
out_str = String.new
|
data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1.rb → health_card/health_card_v1.rb}
RENAMED
@@ -1,27 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../parsing'
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
4
|
+
require_relative 'health_card_v1_document'
|
5
|
+
require_relative 'health_card_v1_page'
|
6
6
|
|
7
7
|
module Mindee
|
8
8
|
module Product
|
9
9
|
module FR
|
10
|
-
#
|
11
|
-
module
|
12
|
-
#
|
13
|
-
class
|
14
|
-
@endpoint_name = '
|
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
15
|
@endpoint_version = '1'
|
16
16
|
|
17
17
|
# @param prediction [Hash]
|
18
18
|
def initialize(prediction)
|
19
19
|
super
|
20
|
-
@prediction =
|
20
|
+
@prediction = HealthCardV1Document.new(prediction['prediction'], nil)
|
21
21
|
@pages = []
|
22
22
|
prediction['pages'].each do |page|
|
23
23
|
if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
|
24
|
-
@pages.push(
|
24
|
+
@pages.push(HealthCardV1Page.new(page))
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -5,17 +5,17 @@ require_relative '../../../parsing'
|
|
5
5
|
module Mindee
|
6
6
|
module Product
|
7
7
|
module FR
|
8
|
-
module
|
9
|
-
#
|
10
|
-
class
|
8
|
+
module HealthCard
|
9
|
+
# Health Card API version 1.0 document data.
|
10
|
+
class HealthCardV1Document < Mindee::Parsing::Common::Prediction
|
11
11
|
include Mindee::Parsing::Standard
|
12
|
-
# The given
|
12
|
+
# The given names of the card holder.
|
13
13
|
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
14
14
|
attr_reader :given_names
|
15
|
-
# The date the
|
15
|
+
# The date when the carte vitale document was issued.
|
16
16
|
# @return [Mindee::Parsing::Standard::DateField]
|
17
17
|
attr_reader :issuance_date
|
18
|
-
# The
|
18
|
+
# The social security number of the card holder.
|
19
19
|
# @return [Mindee::Parsing::Standard::StringField]
|
20
20
|
attr_reader :social_security
|
21
21
|
# The surname of the card holder.
|
@@ -1,26 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../parsing'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'health_card_v1_document'
|
5
5
|
|
6
6
|
module Mindee
|
7
7
|
module Product
|
8
8
|
module FR
|
9
|
-
module
|
10
|
-
#
|
11
|
-
class
|
9
|
+
module HealthCard
|
10
|
+
# Health Card API version 1.0 page data.
|
11
|
+
class HealthCardV1Page < Mindee::Parsing::Common::Page
|
12
12
|
# @param prediction [Hash]
|
13
13
|
def initialize(prediction)
|
14
14
|
super(prediction)
|
15
|
-
@prediction =
|
15
|
+
@prediction = HealthCardV1PagePrediction.new(
|
16
16
|
prediction['prediction'],
|
17
17
|
prediction['id']
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
#
|
23
|
-
class
|
22
|
+
# Health Card V1 page prediction.
|
23
|
+
class HealthCardV1PagePrediction < HealthCardV1Document
|
24
24
|
# @return [String]
|
25
25
|
def to_s
|
26
26
|
out_str = String.new
|
@@ -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
|