Class: Mindee::Product::FR::Payslip::PayslipV2Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/fr/payslip/payslip_v2_document.rb

Overview

Payslip API version 2.0 document data.

Direct Known Subclasses

PayslipV2PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ PayslipV2Document

Returns a new instance of PayslipV2Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 47

def initialize(prediction, page_id)
  super()
  @bank_account_details = PayslipV2BankAccountDetail.new(prediction['bank_account_details'], page_id)
  @employee = PayslipV2Employee.new(prediction['employee'], page_id)
  @employer = PayslipV2Employer.new(prediction['employer'], page_id)
  @employment = PayslipV2Employment.new(prediction['employment'], page_id)
  @pay_detail = PayslipV2PayDetail.new(prediction['pay_detail'], page_id)
  @pay_period = PayslipV2PayPeriod.new(prediction['pay_period'], page_id)
  @pto = PayslipV2Pto.new(prediction['pto'], page_id)
  @salary_details = []
  prediction['salary_details'].each do |item|
    @salary_details.push(PayslipV2SalaryDetail.new(item, page_id))
  end
end

Instance Attribute Details

#bank_account_detailsMindee::Product::FR::Payslip::PayslipV2BankAccountDetail (readonly)

Information about the employee's bank account.



22
23
24
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 22

def 
  @bank_account_details
end

#employeeMindee::Product::FR::Payslip::PayslipV2Employee (readonly)

Information about the employee.



25
26
27
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 25

def employee
  @employee
end

#employerMindee::Product::FR::Payslip::PayslipV2Employer (readonly)

Information about the employer.



28
29
30
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 28

def employer
  @employer
end

#employmentMindee::Product::FR::Payslip::PayslipV2Employment (readonly)

Information about the employment.



31
32
33
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 31

def employment
  @employment
end

#pay_detailMindee::Product::FR::Payslip::PayslipV2PayDetail (readonly)

Detailed information about the pay.



34
35
36
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 34

def pay_detail
  @pay_detail
end

#pay_periodMindee::Product::FR::Payslip::PayslipV2PayPeriod (readonly)

Information about the pay period.



37
38
39
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 37

def pay_period
  @pay_period
end

#ptoMindee::Product::FR::Payslip::PayslipV2Pto (readonly)

Information about paid time off.



40
41
42
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 40

def pto
  @pto
end

#salary_detailsArray<Mindee::Product::FR::Payslip::PayslipV2SalaryDetail> (readonly)

Detailed information about the earnings.



43
44
45
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 43

def salary_details
  @salary_details
end

Instance Method Details

#to_sString

Returns:

  • (String)


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mindee/product/fr/payslip/payslip_v2_document.rb', line 63

def to_s
  employee = @employee.to_s
  employer = @employer.to_s
   = @bank_account_details.to_s
  employment = @employment.to_s
  salary_details = salary_details_to_s
  pay_detail = @pay_detail.to_s
  pto = @pto.to_s
  pay_period = @pay_period.to_s
  out_str = String.new
  out_str << "\n:Employee:"
  out_str << employee
  out_str << "\n:Employer:"
  out_str << employer
  out_str << "\n:Bank Account Details:"
  out_str << 
  out_str << "\n:Employment:"
  out_str << employment
  out_str << "\n:Salary Details:"
  out_str << salary_details
  out_str << "\n:Pay Detail:"
  out_str << pay_detail
  out_str << "\n:PTO:"
  out_str << pto
  out_str << "\n:Pay Period:"
  out_str << pay_period
  out_str[1..].to_s
end