Class: FdxV660Api::PayrollReportEntity

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

Overview

An employee's Payroll Report

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(report_id:, report_type:, generation_date:, employee:, employment:, data_as_of: SKIP, incomes: SKIP, links: SKIP, additional_properties: nil) ⇒ PayrollReportEntity

Returns a new instance of PayrollReportEntity.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 74

def initialize(report_id:, report_type:, generation_date:, employee:,
               employment:, data_as_of: SKIP, incomes: SKIP, links: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @report_id = report_id
  @report_type = report_type
  @generation_date = generation_date
  @data_as_of = data_as_of unless data_as_of == SKIP
  @employee = employee
  @employment = employment
  @incomes = incomes unless incomes == SKIP
  @links = links unless links == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#data_as_ofDate

The data in the report is as of this date

Returns:

  • (Date)


26
27
28
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 26

def data_as_of
  @data_as_of
end

#employeeEmployeeEntity1

The employee

Returns:



30
31
32
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 30

def employee
  @employee
end

#employmentEmployment1

The employee's employment

Returns:



34
35
36
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 34

def employment
  @employment
end

#generation_dateDate

The generation date of the report

Returns:

  • (Date)


22
23
24
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 22

def generation_date
  @generation_date
end

#incomesArray[Income]

The employee's year to date income amounts for current and previous years omitted for Verification of Employment requests (VOE), included for Verification of Income and Employment requests (VOI / VOIE)

Returns:



40
41
42
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 40

def incomes
  @incomes
end

Links to retrieve this payroll report, or to invoke related APIs

Returns:



44
45
46
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 44

def links
  @links
end

#report_idString

The report identification number

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 14

def report_id
  @report_id
end

#report_typePayrollReportType1

The type of report

Returns:



18
19
20
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 18

def report_type
  @report_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_id = hash.key?('reportId') ? hash['reportId'] : nil
  report_type = hash.key?('reportType') ? hash['reportType'] : nil
  generation_date =
    hash.key?('generationDate') ? hash['generationDate'] : nil
  employee = EmployeeEntity1.from_hash(hash['employee']) if hash['employee']
  employment = Employment1.from_hash(hash['employment']) if hash['employment']
  data_as_of = hash.key?('dataAsOf') ? hash['dataAsOf'] : SKIP
  # Parameter is an array, so we need to iterate through it
  incomes = nil
  unless hash['incomes'].nil?
    incomes = []
    hash['incomes'].each do |structure|
      incomes << (Income.from_hash(structure) if structure)
    end
  end

  incomes = SKIP unless hash.key?('incomes')
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (HateoasLink.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')

  # 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.
  PayrollReportEntity.new(report_id: report_id,
                          report_type: report_type,
                          generation_date: generation_date,
                          employee: employee,
                          employment: employment,
                          data_as_of: data_as_of,
                          incomes: incomes,
                          links: links,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_id'] = 'reportId'
  @_hash['report_type'] = 'reportType'
  @_hash['generation_date'] = 'generationDate'
  @_hash['data_as_of'] = 'dataAsOf'
  @_hash['employee'] = 'employee'
  @_hash['employment'] = 'employment'
  @_hash['incomes'] = 'incomes'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 61

def self.optionals
  %w[
    data_as_of
    incomes
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



153
154
155
156
157
158
159
160
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 153

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} report_id: #{@report_id.inspect}, report_type: #{@report_type.inspect},"\
  " generation_date: #{@generation_date.inspect}, data_as_of: #{@data_as_of.inspect},"\
  " employee: #{@employee.inspect}, employment: #{@employment.inspect}, incomes:"\
  " #{@incomes.inspect}, links: #{@links.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
150
# File 'lib/fdx_v660_api/models/payroll_report_entity.rb', line 144

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} report_id: #{@report_id}, report_type: #{@report_type}, generation_date:"\
  " #{@generation_date}, data_as_of: #{@data_as_of}, employee: #{@employee}, employment:"\
  " #{@employment}, incomes: #{@incomes}, links: #{@links}, additional_properties:"\
  " #{@additional_properties}>"
end