Class: FdxV660Api::PayrollReportEntity1

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

Overview

PayrollReport entity as a JSON response if not encrypted, or as the JSON payload which is encrypted for an application/jwt response

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) ⇒ PayrollReportEntity1

Returns a new instance of PayrollReportEntity1.



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

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)


27
28
29
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 27

def data_as_of
  @data_as_of
end

#employeeEmployeeEntity1

The employee

Returns:



31
32
33
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 31

def employee
  @employee
end

#employmentEmployment1

The employee's employment

Returns:



35
36
37
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 35

def employment
  @employment
end

#generation_dateDate

The generation date of the report

Returns:

  • (Date)


23
24
25
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 23

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:



41
42
43
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 41

def incomes
  @incomes
end

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

Returns:



45
46
47
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 45

def links
  @links
end

#report_idString

The report identification number

Returns:

  • (String)


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

def report_id
  @report_id
end

#report_typePayrollReportType1

The type of report

Returns:



19
20
21
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 19

def report_type
  @report_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
142
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 93

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.
  PayrollReportEntity1.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.



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

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



71
72
73
# File 'lib/fdx_v660_api/models/payroll_report_entity1.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



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

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