xero-ruby 12.4.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/accounting_api.rb +3 -0
  3. data/lib/xero-ruby/api/finance_api.rb +0 -299
  4. data/lib/xero-ruby/api/payroll_au_v2_api.rb +751 -0
  5. data/lib/xero-ruby/models/accounting/prepayment.rb +11 -1
  6. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +11 -1
  7. data/lib/xero-ruby/models/payroll_au/employee.rb +1 -13
  8. data/lib/xero-ruby/models/payroll_au/leave_line.rb +11 -1
  9. data/lib/xero-ruby/models/payroll_au/leave_type.rb +14 -4
  10. data/lib/xero-ruby/models/payroll_au/opening_balance_leave_line.rb +232 -0
  11. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +1 -1
  12. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +14 -4
  13. data/lib/xero-ruby/models/payroll_au_v2/invalid_field.rb +232 -0
  14. data/lib/xero-ruby/models/payroll_au_v2/pagination.rb +252 -0
  15. data/lib/xero-ruby/models/payroll_au_v2/problem.rb +275 -0
  16. data/lib/xero-ruby/models/payroll_au_v2/timesheet.rb +361 -0
  17. data/lib/xero-ruby/models/payroll_au_v2/timesheet_line.rb +277 -0
  18. data/lib/xero-ruby/models/payroll_au_v2/timesheet_line_object.rb +242 -0
  19. data/lib/xero-ruby/models/payroll_au_v2/timesheet_object.rb +242 -0
  20. data/lib/xero-ruby/models/payroll_au_v2/timesheets.rb +244 -0
  21. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +3 -2
  22. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +3 -2
  23. data/lib/xero-ruby/version.rb +2 -2
  24. data/lib/xero-ruby.rb +10 -10
  25. data/spec/finance/api/finance_api_spec.rb +0 -53
  26. metadata +386 -396
  27. data/spec/finance/models/account_usage_response_spec.rb +0 -58
  28. data/spec/finance/models/account_usage_spec.rb +0 -112
  29. data/spec/finance/models/history_record_response_spec.rb +0 -64
  30. data/spec/finance/models/lock_history_model_spec.rb +0 -52
  31. data/spec/finance/models/lock_history_response_spec.rb +0 -52
  32. data/spec/finance/models/practice_response_spec.rb +0 -64
  33. data/spec/finance/models/report_history_model_spec.rb +0 -52
  34. data/spec/finance/models/report_history_response_spec.rb +0 -52
  35. data/spec/finance/models/user_activities_response_spec.rb +0 -52
  36. data/spec/finance/models/user_response_spec.rb +0 -106
@@ -0,0 +1,751 @@
1
+ =begin
2
+ #Xero Payroll AU API 2.0
3
+
4
+ #This is the Xero Payroll API 2.0 for orgs in Australia region.
5
+
6
+ Contact: api@xero.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 4.3.1
9
+
10
+ =end
11
+
12
+ module XeroRuby
13
+ class PayrollAuV2Api
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.new)
17
+ @api_client = api_client
18
+ end
19
+ # Approves a specific timesheet
20
+ # @param xero_tenant_id [String] Xero identifier for Tenant
21
+ # @param timesheet_id [String] Identifier for the timesheet
22
+ # @param [Hash] opts the optional parameters
23
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
24
+ # @return [TimesheetObject]
25
+ def approve_timesheet(xero_tenant_id, timesheet_id, opts = {})
26
+ data, _status_code, _headers = approve_timesheet_with_http_info(xero_tenant_id, timesheet_id, opts)
27
+ data
28
+ end
29
+
30
+ # Approves a specific timesheet
31
+ # @param xero_tenant_id [String] Xero identifier for Tenant
32
+ # @param timesheet_id [String] Identifier for the timesheet
33
+ # @param [Hash] opts the optional parameters
34
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
35
+ # @return [Array<(TimesheetObject, Integer, Hash)>] TimesheetObject data, response status code and response headers
36
+ def approve_timesheet_with_http_info(xero_tenant_id, timesheet_id, options = {})
37
+ opts = options.dup
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.approve_timesheet ...'
40
+ end
41
+ # verify the required parameter 'xero_tenant_id' is set
42
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.approve_timesheet"
44
+ end
45
+ # verify the required parameter 'timesheet_id' is set
46
+ if @api_client.config.client_side_validation && timesheet_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.approve_timesheet"
48
+ end
49
+ # resource path
50
+ local_var_path = '/Timesheets/{TimesheetID}/Approve'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)
51
+
52
+ # camelize keys of incoming `where` opts
53
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
54
+
55
+ # query parameters
56
+ query_params = opts[:query_params] || {}
57
+
58
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
59
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
60
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
61
+
62
+ # header parameters
63
+ header_params = opts[:header_params] || {}
64
+ # HTTP header 'Accept' (if needed)
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
66
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
67
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
68
+
69
+ # form parameters
70
+ form_params = opts[:form_params] || {}
71
+
72
+ # http body (model)
73
+ post_body = opts[:body]
74
+
75
+ # return_type
76
+ return_type = opts[:return_type] || 'TimesheetObject'
77
+
78
+ # auth_names
79
+ auth_names = opts[:auth_names] || ['OAuth2']
80
+
81
+ new_options = opts.merge(
82
+ :header_params => header_params,
83
+ :query_params => query_params,
84
+ :form_params => form_params,
85
+ :body => post_body,
86
+ :auth_names => auth_names,
87
+ :return_type => return_type
88
+ )
89
+
90
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollAuV2Api", new_options)
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#approve_timesheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
96
+
97
+ # Creates a new timesheet
98
+ # @param xero_tenant_id [String] Xero identifier for Tenant
99
+ # @param timesheet [Timesheet]
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
102
+ # @return [TimesheetObject]
103
+ def create_timesheet(xero_tenant_id, timesheet, opts = {})
104
+ data, _status_code, _headers = create_timesheet_with_http_info(xero_tenant_id, timesheet, opts)
105
+ data
106
+ end
107
+
108
+ # Creates a new timesheet
109
+ # @param xero_tenant_id [String] Xero identifier for Tenant
110
+ # @param timesheet [Timesheet]
111
+ # @param [Hash] opts the optional parameters
112
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
113
+ # @return [Array<(TimesheetObject, Integer, Hash)>] TimesheetObject data, response status code and response headers
114
+ def create_timesheet_with_http_info(xero_tenant_id, timesheet, options = {})
115
+ opts = options.dup
116
+ if @api_client.config.debugging
117
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.create_timesheet ...'
118
+ end
119
+ # verify the required parameter 'xero_tenant_id' is set
120
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
121
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.create_timesheet"
122
+ end
123
+ # verify the required parameter 'timesheet' is set
124
+ if @api_client.config.client_side_validation && timesheet.nil?
125
+ fail ArgumentError, "Missing the required parameter 'timesheet' when calling PayrollAuV2Api.create_timesheet"
126
+ end
127
+ # resource path
128
+ local_var_path = '/Timesheets'
129
+
130
+ # camelize keys of incoming `where` opts
131
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
132
+
133
+ # query parameters
134
+ query_params = opts[:query_params] || {}
135
+
136
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
137
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
138
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
139
+
140
+ # header parameters
141
+ header_params = opts[:header_params] || {}
142
+ # HTTP header 'Accept' (if needed)
143
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
144
+ # HTTP header 'Content-Type'
145
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
146
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
147
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
148
+
149
+ # form parameters
150
+ form_params = opts[:form_params] || {}
151
+
152
+ # http body (model)
153
+ post_body = opts[:body] || @api_client.object_to_http_body(timesheet)
154
+
155
+ # return_type
156
+ return_type = opts[:return_type] || 'TimesheetObject'
157
+
158
+ # auth_names
159
+ auth_names = opts[:auth_names] || ['OAuth2']
160
+
161
+ new_options = opts.merge(
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => return_type
168
+ )
169
+
170
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollAuV2Api", new_options)
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#create_timesheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+
177
+ # Creates a new timesheet line for a specific timesheet using a unique timesheet ID
178
+ # @param xero_tenant_id [String] Xero identifier for Tenant
179
+ # @param timesheet_id [String] Identifier for the timesheet
180
+ # @param timesheet_line [TimesheetLine]
181
+ # @param [Hash] opts the optional parameters
182
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
183
+ # @return [TimesheetLineObject]
184
+ def create_timesheet_line(xero_tenant_id, timesheet_id, timesheet_line, opts = {})
185
+ data, _status_code, _headers = create_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line, opts)
186
+ data
187
+ end
188
+
189
+ # Creates a new timesheet line for a specific timesheet using a unique timesheet ID
190
+ # @param xero_tenant_id [String] Xero identifier for Tenant
191
+ # @param timesheet_id [String] Identifier for the timesheet
192
+ # @param timesheet_line [TimesheetLine]
193
+ # @param [Hash] opts the optional parameters
194
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
195
+ # @return [Array<(TimesheetLineObject, Integer, Hash)>] TimesheetLineObject data, response status code and response headers
196
+ def create_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line, options = {})
197
+ opts = options.dup
198
+ if @api_client.config.debugging
199
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.create_timesheet_line ...'
200
+ end
201
+ # verify the required parameter 'xero_tenant_id' is set
202
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
203
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.create_timesheet_line"
204
+ end
205
+ # verify the required parameter 'timesheet_id' is set
206
+ if @api_client.config.client_side_validation && timesheet_id.nil?
207
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.create_timesheet_line"
208
+ end
209
+ # verify the required parameter 'timesheet_line' is set
210
+ if @api_client.config.client_side_validation && timesheet_line.nil?
211
+ fail ArgumentError, "Missing the required parameter 'timesheet_line' when calling PayrollAuV2Api.create_timesheet_line"
212
+ end
213
+ # resource path
214
+ local_var_path = '/Timesheets/{TimesheetID}/Lines'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)
215
+
216
+ # camelize keys of incoming `where` opts
217
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
218
+
219
+ # query parameters
220
+ query_params = opts[:query_params] || {}
221
+
222
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
223
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
224
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
225
+
226
+ # header parameters
227
+ header_params = opts[:header_params] || {}
228
+ # HTTP header 'Accept' (if needed)
229
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
230
+ # HTTP header 'Content-Type'
231
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
232
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
233
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
234
+
235
+ # form parameters
236
+ form_params = opts[:form_params] || {}
237
+
238
+ # http body (model)
239
+ post_body = opts[:body] || @api_client.object_to_http_body(timesheet_line)
240
+
241
+ # return_type
242
+ return_type = opts[:return_type] || 'TimesheetLineObject'
243
+
244
+ # auth_names
245
+ auth_names = opts[:auth_names] || ['OAuth2']
246
+
247
+ new_options = opts.merge(
248
+ :header_params => header_params,
249
+ :query_params => query_params,
250
+ :form_params => form_params,
251
+ :body => post_body,
252
+ :auth_names => auth_names,
253
+ :return_type => return_type
254
+ )
255
+
256
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollAuV2Api", new_options)
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#create_timesheet_line\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ return data, status_code, headers
261
+ end
262
+
263
+ # Deletes a specific timesheet
264
+ # @param xero_tenant_id [String] Xero identifier for Tenant
265
+ # @param timesheet_id [String] Identifier for the timesheet
266
+ # @param [Hash] opts the optional parameters
267
+ # @return [TimesheetLine]
268
+ def delete_timesheet(xero_tenant_id, timesheet_id, opts = {})
269
+ data, _status_code, _headers = delete_timesheet_with_http_info(xero_tenant_id, timesheet_id, opts)
270
+ data
271
+ end
272
+
273
+ # Deletes a specific timesheet
274
+ # @param xero_tenant_id [String] Xero identifier for Tenant
275
+ # @param timesheet_id [String] Identifier for the timesheet
276
+ # @param [Hash] opts the optional parameters
277
+ # @return [Array<(TimesheetLine, Integer, Hash)>] TimesheetLine data, response status code and response headers
278
+ def delete_timesheet_with_http_info(xero_tenant_id, timesheet_id, options = {})
279
+ opts = options.dup
280
+ if @api_client.config.debugging
281
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.delete_timesheet ...'
282
+ end
283
+ # verify the required parameter 'xero_tenant_id' is set
284
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
285
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.delete_timesheet"
286
+ end
287
+ # verify the required parameter 'timesheet_id' is set
288
+ if @api_client.config.client_side_validation && timesheet_id.nil?
289
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.delete_timesheet"
290
+ end
291
+ # resource path
292
+ local_var_path = '/Timesheets/{TimesheetID}'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)
293
+
294
+ # camelize keys of incoming `where` opts
295
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
296
+
297
+ # query parameters
298
+ query_params = opts[:query_params] || {}
299
+
300
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
301
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
302
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
303
+
304
+ # header parameters
305
+ header_params = opts[:header_params] || {}
306
+ # HTTP header 'Accept' (if needed)
307
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
308
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
309
+
310
+ # form parameters
311
+ form_params = opts[:form_params] || {}
312
+
313
+ # http body (model)
314
+ post_body = opts[:body]
315
+
316
+ # return_type
317
+ return_type = opts[:return_type] || 'TimesheetLine'
318
+
319
+ # auth_names
320
+ auth_names = opts[:auth_names] || ['OAuth2']
321
+
322
+ new_options = opts.merge(
323
+ :header_params => header_params,
324
+ :query_params => query_params,
325
+ :form_params => form_params,
326
+ :body => post_body,
327
+ :auth_names => auth_names,
328
+ :return_type => return_type
329
+ )
330
+
331
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, "PayrollAuV2Api", new_options)
332
+ if @api_client.config.debugging
333
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#delete_timesheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
334
+ end
335
+ return data, status_code, headers
336
+ end
337
+
338
+ # Deletes a specific timesheet line
339
+ # @param xero_tenant_id [String] Xero identifier for Tenant
340
+ # @param timesheet_id [String] Identifier for the timesheet
341
+ # @param timesheet_line_id [String] Identifier for the timesheet line
342
+ # @param [Hash] opts the optional parameters
343
+ # @return [TimesheetLine]
344
+ def delete_timesheet_line(xero_tenant_id, timesheet_id, timesheet_line_id, opts = {})
345
+ data, _status_code, _headers = delete_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line_id, opts)
346
+ data
347
+ end
348
+
349
+ # Deletes a specific timesheet line
350
+ # @param xero_tenant_id [String] Xero identifier for Tenant
351
+ # @param timesheet_id [String] Identifier for the timesheet
352
+ # @param timesheet_line_id [String] Identifier for the timesheet line
353
+ # @param [Hash] opts the optional parameters
354
+ # @return [Array<(TimesheetLine, Integer, Hash)>] TimesheetLine data, response status code and response headers
355
+ def delete_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line_id, options = {})
356
+ opts = options.dup
357
+ if @api_client.config.debugging
358
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.delete_timesheet_line ...'
359
+ end
360
+ # verify the required parameter 'xero_tenant_id' is set
361
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
362
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.delete_timesheet_line"
363
+ end
364
+ # verify the required parameter 'timesheet_id' is set
365
+ if @api_client.config.client_side_validation && timesheet_id.nil?
366
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.delete_timesheet_line"
367
+ end
368
+ # verify the required parameter 'timesheet_line_id' is set
369
+ if @api_client.config.client_side_validation && timesheet_line_id.nil?
370
+ fail ArgumentError, "Missing the required parameter 'timesheet_line_id' when calling PayrollAuV2Api.delete_timesheet_line"
371
+ end
372
+ # resource path
373
+ local_var_path = '/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s).sub('{' + 'TimesheetLineID' + '}', timesheet_line_id.to_s)
374
+
375
+ # camelize keys of incoming `where` opts
376
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
377
+
378
+ # query parameters
379
+ query_params = opts[:query_params] || {}
380
+
381
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
382
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
383
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
384
+
385
+ # header parameters
386
+ header_params = opts[:header_params] || {}
387
+ # HTTP header 'Accept' (if needed)
388
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
389
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
390
+
391
+ # form parameters
392
+ form_params = opts[:form_params] || {}
393
+
394
+ # http body (model)
395
+ post_body = opts[:body]
396
+
397
+ # return_type
398
+ return_type = opts[:return_type] || 'TimesheetLine'
399
+
400
+ # auth_names
401
+ auth_names = opts[:auth_names] || ['OAuth2']
402
+
403
+ new_options = opts.merge(
404
+ :header_params => header_params,
405
+ :query_params => query_params,
406
+ :form_params => form_params,
407
+ :body => post_body,
408
+ :auth_names => auth_names,
409
+ :return_type => return_type
410
+ )
411
+
412
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, "PayrollAuV2Api", new_options)
413
+ if @api_client.config.debugging
414
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#delete_timesheet_line\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
415
+ end
416
+ return data, status_code, headers
417
+ end
418
+
419
+ # Retrieve a specific timesheet by using a unique timesheet ID
420
+ # @param xero_tenant_id [String] Xero identifier for Tenant
421
+ # @param timesheet_id [String] Identifier for the timesheet
422
+ # @param [Hash] opts the optional parameters
423
+ # @return [TimesheetObject]
424
+ def get_timesheet(xero_tenant_id, timesheet_id, opts = {})
425
+ data, _status_code, _headers = get_timesheet_with_http_info(xero_tenant_id, timesheet_id, opts)
426
+ data
427
+ end
428
+
429
+ # Retrieve a specific timesheet by using a unique timesheet ID
430
+ # @param xero_tenant_id [String] Xero identifier for Tenant
431
+ # @param timesheet_id [String] Identifier for the timesheet
432
+ # @param [Hash] opts the optional parameters
433
+ # @return [Array<(TimesheetObject, Integer, Hash)>] TimesheetObject data, response status code and response headers
434
+ def get_timesheet_with_http_info(xero_tenant_id, timesheet_id, options = {})
435
+ opts = options.dup
436
+ if @api_client.config.debugging
437
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.get_timesheet ...'
438
+ end
439
+ # verify the required parameter 'xero_tenant_id' is set
440
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
441
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.get_timesheet"
442
+ end
443
+ # verify the required parameter 'timesheet_id' is set
444
+ if @api_client.config.client_side_validation && timesheet_id.nil?
445
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.get_timesheet"
446
+ end
447
+ # resource path
448
+ local_var_path = '/Timesheets/{TimesheetID}'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)
449
+
450
+ # camelize keys of incoming `where` opts
451
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
452
+
453
+ # query parameters
454
+ query_params = opts[:query_params] || {}
455
+
456
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
457
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
458
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
459
+
460
+ # header parameters
461
+ header_params = opts[:header_params] || {}
462
+ # HTTP header 'Accept' (if needed)
463
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
464
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
465
+
466
+ # form parameters
467
+ form_params = opts[:form_params] || {}
468
+
469
+ # http body (model)
470
+ post_body = opts[:body]
471
+
472
+ # return_type
473
+ return_type = opts[:return_type] || 'TimesheetObject'
474
+
475
+ # auth_names
476
+ auth_names = opts[:auth_names] || ['OAuth2']
477
+
478
+ new_options = opts.merge(
479
+ :header_params => header_params,
480
+ :query_params => query_params,
481
+ :form_params => form_params,
482
+ :body => post_body,
483
+ :auth_names => auth_names,
484
+ :return_type => return_type
485
+ )
486
+
487
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollAuV2Api", new_options)
488
+ if @api_client.config.debugging
489
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#get_timesheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
490
+ end
491
+ return data, status_code, headers
492
+ end
493
+
494
+ # Retrieves timesheets
495
+ # @param xero_tenant_id [String] Xero identifier for Tenant
496
+ # @param [Hash] opts the optional parameters
497
+ # @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
498
+ # @option opts [String] :filter Filter by employeeId and/or payrollCalendarId
499
+ # @option opts [String] :status filter results by any timesheets with a matching timesheet status
500
+ # @option opts [String] :start_date filter results by any timesheets with a startDate on or after the provided date
501
+ # @option opts [String] :end_date filter results by any timesheets with a endDate on or before the provided date
502
+ # @option opts [String] :sort sort the order of timesheets returned. The default is based on the timesheets createdDate, sorted oldest to newest. Currently, the only other option is to reverse the order based on the timesheets startDate, sorted newest to oldest.
503
+ # @return [Timesheets]
504
+ def get_timesheets(xero_tenant_id, opts = {})
505
+ data, _status_code, _headers = get_timesheets_with_http_info(xero_tenant_id, opts)
506
+ data
507
+ end
508
+
509
+ # Retrieves timesheets
510
+ # @param xero_tenant_id [String] Xero identifier for Tenant
511
+ # @param [Hash] opts the optional parameters
512
+ # @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
513
+ # @option opts [String] :filter Filter by employeeId and/or payrollCalendarId
514
+ # @option opts [String] :status filter results by any timesheets with a matching timesheet status
515
+ # @option opts [String] :start_date filter results by any timesheets with a startDate on or after the provided date
516
+ # @option opts [String] :end_date filter results by any timesheets with a endDate on or before the provided date
517
+ # @option opts [String] :sort sort the order of timesheets returned. The default is based on the timesheets createdDate, sorted oldest to newest. Currently, the only other option is to reverse the order based on the timesheets startDate, sorted newest to oldest.
518
+ # @return [Array<(Timesheets, Integer, Hash)>] Timesheets data, response status code and response headers
519
+ def get_timesheets_with_http_info(xero_tenant_id, options = {})
520
+ opts = options.dup
521
+ if @api_client.config.debugging
522
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.get_timesheets ...'
523
+ end
524
+ # verify the required parameter 'xero_tenant_id' is set
525
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
526
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.get_timesheets"
527
+ end
528
+ # resource path
529
+ local_var_path = '/Timesheets'
530
+
531
+ # camelize keys of incoming `where` opts
532
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
533
+
534
+ # query parameters
535
+ query_params = opts[:query_params] || {}
536
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
537
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
538
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
539
+ query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
540
+ query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
541
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
542
+
543
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
544
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
545
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
546
+
547
+ # header parameters
548
+ header_params = opts[:header_params] || {}
549
+ # HTTP header 'Accept' (if needed)
550
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
551
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
552
+
553
+ # form parameters
554
+ form_params = opts[:form_params] || {}
555
+
556
+ # http body (model)
557
+ post_body = opts[:body]
558
+
559
+ # return_type
560
+ return_type = opts[:return_type] || 'Timesheets'
561
+
562
+ # auth_names
563
+ auth_names = opts[:auth_names] || ['OAuth2']
564
+
565
+ new_options = opts.merge(
566
+ :header_params => header_params,
567
+ :query_params => query_params,
568
+ :form_params => form_params,
569
+ :body => post_body,
570
+ :auth_names => auth_names,
571
+ :return_type => return_type
572
+ )
573
+
574
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "PayrollAuV2Api", new_options)
575
+ if @api_client.config.debugging
576
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#get_timesheets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
577
+ end
578
+ return data, status_code, headers
579
+ end
580
+
581
+ # Reverts a specific timesheet to draft
582
+ # @param xero_tenant_id [String] Xero identifier for Tenant
583
+ # @param timesheet_id [String] Identifier for the timesheet
584
+ # @param [Hash] opts the optional parameters
585
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
586
+ # @return [TimesheetObject]
587
+ def revert_timesheet(xero_tenant_id, timesheet_id, opts = {})
588
+ data, _status_code, _headers = revert_timesheet_with_http_info(xero_tenant_id, timesheet_id, opts)
589
+ data
590
+ end
591
+
592
+ # Reverts a specific timesheet to draft
593
+ # @param xero_tenant_id [String] Xero identifier for Tenant
594
+ # @param timesheet_id [String] Identifier for the timesheet
595
+ # @param [Hash] opts the optional parameters
596
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
597
+ # @return [Array<(TimesheetObject, Integer, Hash)>] TimesheetObject data, response status code and response headers
598
+ def revert_timesheet_with_http_info(xero_tenant_id, timesheet_id, options = {})
599
+ opts = options.dup
600
+ if @api_client.config.debugging
601
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.revert_timesheet ...'
602
+ end
603
+ # verify the required parameter 'xero_tenant_id' is set
604
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
605
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.revert_timesheet"
606
+ end
607
+ # verify the required parameter 'timesheet_id' is set
608
+ if @api_client.config.client_side_validation && timesheet_id.nil?
609
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.revert_timesheet"
610
+ end
611
+ # resource path
612
+ local_var_path = '/Timesheets/{TimesheetID}/RevertToDraft'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s)
613
+
614
+ # camelize keys of incoming `where` opts
615
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
616
+
617
+ # query parameters
618
+ query_params = opts[:query_params] || {}
619
+
620
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
621
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
622
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
623
+
624
+ # header parameters
625
+ header_params = opts[:header_params] || {}
626
+ # HTTP header 'Accept' (if needed)
627
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
628
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
629
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
630
+
631
+ # form parameters
632
+ form_params = opts[:form_params] || {}
633
+
634
+ # http body (model)
635
+ post_body = opts[:body]
636
+
637
+ # return_type
638
+ return_type = opts[:return_type] || 'TimesheetObject'
639
+
640
+ # auth_names
641
+ auth_names = opts[:auth_names] || ['OAuth2']
642
+
643
+ new_options = opts.merge(
644
+ :header_params => header_params,
645
+ :query_params => query_params,
646
+ :form_params => form_params,
647
+ :body => post_body,
648
+ :auth_names => auth_names,
649
+ :return_type => return_type
650
+ )
651
+
652
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "PayrollAuV2Api", new_options)
653
+ if @api_client.config.debugging
654
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#revert_timesheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
655
+ end
656
+ return data, status_code, headers
657
+ end
658
+
659
+ # Updates a specific timesheet line for a specific timesheet
660
+ # @param xero_tenant_id [String] Xero identifier for Tenant
661
+ # @param timesheet_id [String] Identifier for the timesheet
662
+ # @param timesheet_line_id [String] Identifier for the timesheet line
663
+ # @param timesheet_line [TimesheetLine]
664
+ # @param [Hash] opts the optional parameters
665
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
666
+ # @return [TimesheetLineObject]
667
+ def update_timesheet_line(xero_tenant_id, timesheet_id, timesheet_line_id, timesheet_line, opts = {})
668
+ data, _status_code, _headers = update_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line_id, timesheet_line, opts)
669
+ data
670
+ end
671
+
672
+ # Updates a specific timesheet line for a specific timesheet
673
+ # @param xero_tenant_id [String] Xero identifier for Tenant
674
+ # @param timesheet_id [String] Identifier for the timesheet
675
+ # @param timesheet_line_id [String] Identifier for the timesheet line
676
+ # @param timesheet_line [TimesheetLine]
677
+ # @param [Hash] opts the optional parameters
678
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
679
+ # @return [Array<(TimesheetLineObject, Integer, Hash)>] TimesheetLineObject data, response status code and response headers
680
+ def update_timesheet_line_with_http_info(xero_tenant_id, timesheet_id, timesheet_line_id, timesheet_line, options = {})
681
+ opts = options.dup
682
+ if @api_client.config.debugging
683
+ @api_client.config.logger.debug 'Calling API: PayrollAuV2Api.update_timesheet_line ...'
684
+ end
685
+ # verify the required parameter 'xero_tenant_id' is set
686
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
687
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling PayrollAuV2Api.update_timesheet_line"
688
+ end
689
+ # verify the required parameter 'timesheet_id' is set
690
+ if @api_client.config.client_side_validation && timesheet_id.nil?
691
+ fail ArgumentError, "Missing the required parameter 'timesheet_id' when calling PayrollAuV2Api.update_timesheet_line"
692
+ end
693
+ # verify the required parameter 'timesheet_line_id' is set
694
+ if @api_client.config.client_side_validation && timesheet_line_id.nil?
695
+ fail ArgumentError, "Missing the required parameter 'timesheet_line_id' when calling PayrollAuV2Api.update_timesheet_line"
696
+ end
697
+ # verify the required parameter 'timesheet_line' is set
698
+ if @api_client.config.client_side_validation && timesheet_line.nil?
699
+ fail ArgumentError, "Missing the required parameter 'timesheet_line' when calling PayrollAuV2Api.update_timesheet_line"
700
+ end
701
+ # resource path
702
+ local_var_path = '/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}'.sub('{' + 'TimesheetID' + '}', timesheet_id.to_s).sub('{' + 'TimesheetLineID' + '}', timesheet_line_id.to_s)
703
+
704
+ # camelize keys of incoming `where` opts
705
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
706
+
707
+ # query parameters
708
+ query_params = opts[:query_params] || {}
709
+
710
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
711
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
712
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
713
+
714
+ # header parameters
715
+ header_params = opts[:header_params] || {}
716
+ # HTTP header 'Accept' (if needed)
717
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
718
+ # HTTP header 'Content-Type'
719
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
720
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
721
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
722
+
723
+ # form parameters
724
+ form_params = opts[:form_params] || {}
725
+
726
+ # http body (model)
727
+ post_body = opts[:body] || @api_client.object_to_http_body(timesheet_line)
728
+
729
+ # return_type
730
+ return_type = opts[:return_type] || 'TimesheetLineObject'
731
+
732
+ # auth_names
733
+ auth_names = opts[:auth_names] || ['OAuth2']
734
+
735
+ new_options = opts.merge(
736
+ :header_params => header_params,
737
+ :query_params => query_params,
738
+ :form_params => form_params,
739
+ :body => post_body,
740
+ :auth_names => auth_names,
741
+ :return_type => return_type
742
+ )
743
+
744
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, "PayrollAuV2Api", new_options)
745
+ if @api_client.config.debugging
746
+ @api_client.config.logger.debug "API called: PayrollAuV2Api#update_timesheet_line\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
747
+ end
748
+ return data, status_code, headers
749
+ end
750
+ end
751
+ end