Class: FdxV660Api::Income

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/income.rb

Overview

Provides a person's employment income details. Applicable only for VOIE (Verification of Income and Employment) data retrieval

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(payroll_frequency:, base_rate: SKIP, other_frequency: SKIP, latest_pay_date: SKIP, latest_pay_period_end_date: SKIP, annual_pay: SKIP, additional_properties: nil) ⇒ Income

Returns a new instance of Income.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fdx_v660_api/models/income.rb', line 67

def initialize(payroll_frequency:, base_rate: SKIP, other_frequency: SKIP,
               latest_pay_date: SKIP, latest_pay_period_end_date: SKIP,
               annual_pay: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @base_rate = base_rate unless base_rate == SKIP
  @payroll_frequency = payroll_frequency
  @other_frequency = other_frequency unless other_frequency == SKIP
  @latest_pay_date = latest_pay_date unless latest_pay_date == SKIP
  unless latest_pay_period_end_date == SKIP
    @latest_pay_period_end_date =
      latest_pay_period_end_date
  end
  @annual_pay = annual_pay unless annual_pay == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#annual_payAnnualPaymentAmounts1

Year-to-date pay for current year and total annual pay for previous years



37
38
39
# File 'lib/fdx_v660_api/models/income.rb', line 37

def annual_pay
  @annual_pay
end

#base_rateBasePayrollRate1

The employee's base payroll rate

Returns:



15
16
17
# File 'lib/fdx_v660_api/models/income.rb', line 15

def base_rate
  @base_rate
end

#latest_pay_dateDate

The date of employee's most recent pay

Returns:

  • (Date)


29
30
31
# File 'lib/fdx_v660_api/models/income.rb', line 29

def latest_pay_date
  @latest_pay_date
end

#latest_pay_period_end_dateDate

The end date of employee's most recent pay period

Returns:

  • (Date)


33
34
35
# File 'lib/fdx_v660_api/models/income.rb', line 33

def latest_pay_period_end_date
  @latest_pay_period_end_date
end

#other_frequencyString

Description of the frequency, required if specified as OTHER

Returns:

  • (String)


25
26
27
# File 'lib/fdx_v660_api/models/income.rb', line 25

def other_frequency
  @other_frequency
end

#payroll_frequencyPayrollFrequencyType1

The frequency of payments. In pay period length order, one of DAILY, WEEKLY, BI-WEEKLY, SEMI-MONTHLY, EVERY 2.6 WEEKS, EVERY 4 WEEKS, MONTHLY, EVERY 5.2 WEEKS, QUARTERLY, SEMI-ANNUALLY, ANNUALLY, OTHER



21
22
23
# File 'lib/fdx_v660_api/models/income.rb', line 21

def payroll_frequency
  @payroll_frequency
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/fdx_v660_api/models/income.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payroll_frequency =
    hash.key?('payrollFrequency') ? hash['payrollFrequency'] : nil
  base_rate = BasePayrollRate1.from_hash(hash['baseRate']) if hash['baseRate']
  other_frequency =
    hash.key?('otherFrequency') ? hash['otherFrequency'] : SKIP
  latest_pay_date =
    hash.key?('latestPayDate') ? hash['latestPayDate'] : SKIP
  latest_pay_period_end_date =
    hash.key?('latestPayPeriodEndDate') ? hash['latestPayPeriodEndDate'] : SKIP
  annual_pay = AnnualPaymentAmounts1.from_hash(hash['annualPay']) if hash['annualPay']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Income.new(payroll_frequency: payroll_frequency,
             base_rate: base_rate,
             other_frequency: other_frequency,
             latest_pay_date: latest_pay_date,
             latest_pay_period_end_date: latest_pay_period_end_date,
             annual_pay: annual_pay,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/fdx_v660_api/models/income.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['base_rate'] = 'baseRate'
  @_hash['payroll_frequency'] = 'payrollFrequency'
  @_hash['other_frequency'] = 'otherFrequency'
  @_hash['latest_pay_date'] = 'latestPayDate'
  @_hash['latest_pay_period_end_date'] = 'latestPayPeriodEndDate'
  @_hash['annual_pay'] = 'annualPay'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/fdx_v660_api/models/income.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
# File 'lib/fdx_v660_api/models/income.rb', line 52

def self.optionals
  %w[
    base_rate
    other_frequency
    latest_pay_date
    latest_pay_period_end_date
    annual_pay
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
134
135
# File 'lib/fdx_v660_api/models/income.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} base_rate: #{@base_rate.inspect}, payroll_frequency:"\
  " #{@payroll_frequency.inspect}, other_frequency: #{@other_frequency.inspect},"\
  " latest_pay_date: #{@latest_pay_date.inspect}, latest_pay_period_end_date:"\
  " #{@latest_pay_period_end_date.inspect}, annual_pay: #{@annual_pay.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
125
# File 'lib/fdx_v660_api/models/income.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} base_rate: #{@base_rate}, payroll_frequency: #{@payroll_frequency},"\
  " other_frequency: #{@other_frequency}, latest_pay_date: #{@latest_pay_date},"\
  " latest_pay_period_end_date: #{@latest_pay_period_end_date}, annual_pay: #{@annual_pay},"\
  " additional_properties: #{@additional_properties}>"
end