Class: FdxV660Api::PayrollReportSummaryEntity

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

Overview

The list of payroll reports for an employee

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_name:, employer_name:, data_as_of: SKIP, employee_id: SKIP, employer_id: SKIP, links: SKIP, additional_properties: nil) ⇒ PayrollReportSummaryEntity

Returns a new instance of PayrollReportSummaryEntity.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 78

def initialize(report_id:, report_type:, generation_date:, employee_name:,
               employer_name:, data_as_of: SKIP, employee_id: SKIP,
               employer_id: 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_id = employee_id unless employee_id == SKIP
  @employee_name = employee_name
  @employer_id = employer_id unless employer_id == SKIP
  @employer_name = employer_name
  @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_summary_entity.rb', line 26

def data_as_of
  @data_as_of
end

#employee_idString

Provider's long-term persistent id for the employee

Returns:

  • (String)


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

def employee_id
  @employee_id
end

#employee_nameIndividualName2

Employee's full name

Returns:



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

def employee_name
  @employee_name
end

#employer_idString

The employer for this report

Returns:

  • (String)


38
39
40
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 38

def employer_id
  @employer_id
end

#employer_nameBusinessName2

The employer's name

Returns:



42
43
44
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 42

def employer_name
  @employer_name
end

#generation_dateDate

The generation date of the report

Returns:

  • (Date)


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

def generation_date
  @generation_date
end

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

Returns:



46
47
48
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 46

def links
  @links
end

#report_idString

The report identification number

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/payroll_report_summary_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_summary_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.



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
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 97

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_name = IndividualName2.from_hash(hash['employeeName']) if hash['employeeName']
  employer_name = BusinessName2.from_hash(hash['employerName']) if hash['employerName']
  data_as_of = hash.key?('dataAsOf') ? hash['dataAsOf'] : SKIP
  employee_id = hash.key?('employeeId') ? hash['employeeId'] : SKIP
  employer_id = hash.key?('employerId') ? hash['employerId'] : SKIP
  # 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.
  PayrollReportSummaryEntity.new(report_id: report_id,
                                 report_type: report_type,
                                 generation_date: generation_date,
                                 employee_name: employee_name,
                                 employer_name: employer_name,
                                 data_as_of: data_as_of,
                                 employee_id: employee_id,
                                 employer_id: employer_id,
                                 links: links,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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_id'] = 'employeeId'
  @_hash['employee_name'] = 'employeeName'
  @_hash['employer_id'] = 'employerId'
  @_hash['employer_name'] = 'employerName'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 64

def self.optionals
  %w[
    data_as_of
    employee_id
    employer_id
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



151
152
153
154
155
156
157
158
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 151

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_id: #{@employee_id.inspect}, employee_name: #{@employee_name.inspect},"\
  " employer_id: #{@employer_id.inspect}, employer_name: #{@employer_name.inspect}, links:"\
  " #{@links.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
148
# File 'lib/fdx_v660_api/models/payroll_report_summary_entity.rb', line 142

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_id: #{@employee_id},"\
  " employee_name: #{@employee_name}, employer_id: #{@employer_id}, employer_name:"\
  " #{@employer_name}, links: #{@links}, additional_properties: #{@additional_properties}>"
end