Class: Merge::Hris::RemoteFieldApiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/hris/types/remote_field_api_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(benefit: OMIT, employer_benefit: OMIT, company: OMIT, employee_payroll_run: OMIT, employee: OMIT, employment: OMIT, location: OMIT, payroll_run: OMIT, team: OMIT, time_off: OMIT, time_off_balance: OMIT, bank_info: OMIT, pay_group: OMIT, group: OMIT, dependent: OMIT, timesheet_entry: OMIT, additional_properties: nil) ⇒ Merge::Hris::RemoteFieldApiResponse

Parameters:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 68

def initialize(benefit: OMIT, employer_benefit: OMIT, company: OMIT, employee_payroll_run: OMIT, employee: OMIT,
               employment: OMIT, location: OMIT, payroll_run: OMIT, team: OMIT, time_off: OMIT, time_off_balance: OMIT, bank_info: OMIT, pay_group: OMIT, group: OMIT, dependent: OMIT, timesheet_entry: OMIT, additional_properties: nil)
  @benefit = benefit if benefit != OMIT
  @employer_benefit = employer_benefit if employer_benefit != OMIT
  @company = company if company != OMIT
  @employee_payroll_run = employee_payroll_run if employee_payroll_run != OMIT
  @employee = employee if employee != OMIT
  @employment = employment if employment != OMIT
  @location = location if location != OMIT
  @payroll_run = payroll_run if payroll_run != OMIT
  @team = team if team != OMIT
  @time_off = time_off if time_off != OMIT
  @time_off_balance = time_off_balance if time_off_balance != OMIT
  @bank_info = bank_info if bank_info != OMIT
  @pay_group = pay_group if pay_group != OMIT
  @group = group if group != OMIT
  @dependent = dependent if dependent != OMIT
  @timesheet_entry = timesheet_entry if timesheet_entry != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "Benefit": benefit,
    "EmployerBenefit": employer_benefit,
    "Company": company,
    "EmployeePayrollRun": employee_payroll_run,
    "Employee": employee,
    "Employment": employment,
    "Location": location,
    "PayrollRun": payroll_run,
    "Team": team,
    "TimeOff": time_off,
    "TimeOffBalance": time_off_balance,
    "BankInfo": bank_info,
    "PayGroup": pay_group,
    "Group": group,
    "Dependent": dependent,
    "TimesheetEntry": timesheet_entry
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



43
44
45
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 43

def additional_properties
  @additional_properties
end

#bank_infoArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



33
34
35
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 33

def bank_info
  @bank_info
end

#benefitArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



11
12
13
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 11

def benefit
  @benefit
end

#companyArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



15
16
17
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 15

def company
  @company
end

#dependentArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



39
40
41
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 39

def dependent
  @dependent
end

#employeeArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



19
20
21
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 19

def employee
  @employee
end

#employee_payroll_runArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



17
18
19
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 17

def employee_payroll_run
  @employee_payroll_run
end

#employer_benefitArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



13
14
15
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 13

def employer_benefit
  @employer_benefit
end

#employmentArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



21
22
23
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 21

def employment
  @employment
end

#groupArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



37
38
39
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 37

def group
  @group
end

#locationArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



23
24
25
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 23

def location
  @location
end

#pay_groupArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



35
36
37
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 35

def pay_group
  @pay_group
end

#payroll_runArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



25
26
27
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 25

def payroll_run
  @payroll_run
end

#teamArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



27
28
29
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 27

def team
  @team
end

#time_offArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



29
30
31
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 29

def time_off
  @time_off
end

#time_off_balanceArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



31
32
33
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 31

def time_off_balance
  @time_off_balance
end

#timesheet_entryArray<Merge::Hris::RemoteFieldApi> (readonly)

Returns:



41
42
43
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 41

def timesheet_entry
  @timesheet_entry
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Hris::RemoteFieldApiResponse

Deserialize a JSON object to an instance of RemoteFieldApiResponse

Parameters:

  • json_object (String)

Returns:



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 113

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  benefit = parsed_json["Benefit"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  employer_benefit = parsed_json["EmployerBenefit"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  company = parsed_json["Company"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  employee_payroll_run = parsed_json["EmployeePayrollRun"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  employee = parsed_json["Employee"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  employment = parsed_json["Employment"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  location = parsed_json["Location"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  payroll_run = parsed_json["PayrollRun"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  team = parsed_json["Team"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  time_off = parsed_json["TimeOff"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  time_off_balance = parsed_json["TimeOffBalance"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  bank_info = parsed_json["BankInfo"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  pay_group = parsed_json["PayGroup"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  group = parsed_json["Group"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  dependent = parsed_json["Dependent"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  timesheet_entry = parsed_json["TimesheetEntry"]&.map do |item|
    item = item.to_json
    Merge::Hris::RemoteFieldApi.from_json(json_object: item)
  end
  new(
    benefit: benefit,
    employer_benefit: employer_benefit,
    company: company,
    employee_payroll_run: employee_payroll_run,
    employee: employee,
    employment: employment,
    location: location,
    payroll_run: payroll_run,
    team: team,
    time_off: time_off,
    time_off_balance: time_off_balance,
    bank_info: bank_info,
    pay_group: pay_group,
    group: group,
    dependent: dependent,
    timesheet_entry: timesheet_entry,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 214

def self.validate_raw(obj:)
  obj.benefit&.is_a?(Array) != false || raise("Passed value for field obj.benefit is not the expected type, validation failed.")
  obj.employer_benefit&.is_a?(Array) != false || raise("Passed value for field obj.employer_benefit is not the expected type, validation failed.")
  obj.company&.is_a?(Array) != false || raise("Passed value for field obj.company is not the expected type, validation failed.")
  obj.employee_payroll_run&.is_a?(Array) != false || raise("Passed value for field obj.employee_payroll_run is not the expected type, validation failed.")
  obj.employee&.is_a?(Array) != false || raise("Passed value for field obj.employee is not the expected type, validation failed.")
  obj.employment&.is_a?(Array) != false || raise("Passed value for field obj.employment is not the expected type, validation failed.")
  obj.location&.is_a?(Array) != false || raise("Passed value for field obj.location is not the expected type, validation failed.")
  obj.payroll_run&.is_a?(Array) != false || raise("Passed value for field obj.payroll_run is not the expected type, validation failed.")
  obj.team&.is_a?(Array) != false || raise("Passed value for field obj.team is not the expected type, validation failed.")
  obj.time_off&.is_a?(Array) != false || raise("Passed value for field obj.time_off is not the expected type, validation failed.")
  obj.time_off_balance&.is_a?(Array) != false || raise("Passed value for field obj.time_off_balance is not the expected type, validation failed.")
  obj.bank_info&.is_a?(Array) != false || raise("Passed value for field obj.bank_info is not the expected type, validation failed.")
  obj.pay_group&.is_a?(Array) != false || raise("Passed value for field obj.pay_group is not the expected type, validation failed.")
  obj.group&.is_a?(Array) != false || raise("Passed value for field obj.group is not the expected type, validation failed.")
  obj.dependent&.is_a?(Array) != false || raise("Passed value for field obj.dependent is not the expected type, validation failed.")
  obj.timesheet_entry&.is_a?(Array) != false || raise("Passed value for field obj.timesheet_entry is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RemoteFieldApiResponse to a JSON object

Returns:

  • (String)


204
205
206
# File 'lib/merge_ruby_client/hris/types/remote_field_api_response.rb', line 204

def to_json(*_args)
  @_field_set&.to_json
end