xero-ruby 3.9.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/xero-ruby/api/accounting_api.rb +1136 -46
  4. data/lib/xero-ruby/api/app_store_api.rb +244 -0
  5. data/lib/xero-ruby/api/asset_api.rb +16 -6
  6. data/lib/xero-ruby/api/files_api.rb +156 -20
  7. data/lib/xero-ruby/api/payroll_au_api.rb +326 -30
  8. data/lib/xero-ruby/api/payroll_nz_api.rb +87 -0
  9. data/lib/xero-ruby/api/payroll_uk_api.rb +81 -0
  10. data/lib/xero-ruby/api/project_api.rb +286 -2
  11. data/lib/xero-ruby/api_client.rb +9 -3
  12. data/lib/xero-ruby/models/accounting/account.rb +1 -1
  13. data/lib/xero-ruby/models/accounting/account_type.rb +0 -4
  14. data/lib/xero-ruby/models/accounting/allocation.rb +21 -1
  15. data/lib/xero-ruby/models/accounting/batch_payment.rb +2 -2
  16. data/lib/xero-ruby/models/accounting/batch_payment_delete.rb +244 -0
  17. data/lib/xero-ruby/models/accounting/batch_payment_delete_by_url_param.rb +229 -0
  18. data/lib/xero-ruby/models/accounting/contact.rb +1 -11
  19. data/lib/xero-ruby/models/accounting/currency_code.rb +10 -8
  20. data/lib/xero-ruby/models/accounting/journal_line.rb +1 -1
  21. data/lib/xero-ruby/models/accounting/line_item.rb +2 -2
  22. data/lib/xero-ruby/models/accounting/organisation.rb +6 -2
  23. data/lib/xero-ruby/models/accounting/payment.rb +26 -4
  24. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +53 -5
  25. data/lib/xero-ruby/models/accounting/tax_rate.rb +23 -5
  26. data/lib/xero-ruby/models/accounting/tax_type.rb +60 -3
  27. data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +75 -4
  28. data/lib/xero-ruby/models/accounting/time_zone.rb +123 -91
  29. data/lib/xero-ruby/models/app_store/create_usage_record.rb +243 -0
  30. data/lib/xero-ruby/models/app_store/update_usage_record.rb +228 -0
  31. data/lib/xero-ruby/models/app_store/usage_record.rb +332 -0
  32. data/lib/xero-ruby/models/app_store/usage_records_list.rb +230 -0
  33. data/lib/xero-ruby/models/files/association.rb +31 -1
  34. data/lib/xero-ruby/models/finance/problem_type.rb +1 -0
  35. data/lib/xero-ruby/models/finance/statement_line_response.rb +11 -1
  36. data/lib/xero-ruby/models/finance/statement_response.rb +24 -4
  37. data/lib/xero-ruby/models/payroll_au/allowance_type.rb +0 -1
  38. data/lib/xero-ruby/models/payroll_au/country_of_residence.rb +284 -0
  39. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +21 -1
  40. data/lib/xero-ruby/models/payroll_au/earnings_type.rb +2 -0
  41. data/lib/xero-ruby/models/payroll_au/employee.rb +42 -2
  42. data/lib/xero-ruby/models/payroll_au/employment_basis.rb +1 -0
  43. data/lib/xero-ruby/models/payroll_au/employment_type.rb +36 -0
  44. data/lib/xero-ruby/models/payroll_au/income_type.rb +39 -0
  45. data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -1
  46. data/lib/xero-ruby/models/payroll_au/leave_category_code.rb +46 -0
  47. data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +14 -4
  48. data/lib/xero-ruby/models/payroll_au/leave_line_calculation_type.rb +0 -1
  49. data/lib/xero-ruby/models/payroll_au/leave_period_status.rb +2 -0
  50. data/lib/xero-ruby/models/payroll_au/leave_type.rb +24 -4
  51. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +16 -4
  52. data/lib/xero-ruby/models/payroll_au/paid_leave_earnings_line.rb +272 -0
  53. data/lib/xero-ruby/models/payroll_au/pay_out_type.rb +36 -0
  54. data/lib/xero-ruby/models/payroll_au/senior_marital_status.rb +37 -0
  55. data/lib/xero-ruby/models/payroll_au/settings.rb +14 -4
  56. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +51 -1
  57. data/lib/xero-ruby/models/payroll_au/tax_scale_type.rb +40 -0
  58. data/lib/xero-ruby/models/payroll_au/work_condition.rb +37 -0
  59. data/lib/xero-ruby/models/payroll_nz/employee.rb +14 -4
  60. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +3 -3
  61. data/lib/xero-ruby/models/projects/currency_code.rb +0 -1
  62. data/lib/xero-ruby/models/projects/task.rb +6 -6
  63. data/lib/xero-ruby/models/projects/task_create_or_update.rb +1 -1
  64. data/lib/xero-ruby/version.rb +2 -2
  65. data/lib/xero-ruby/where.rb +2 -0
  66. data/lib/xero-ruby.rb +15 -0
  67. metadata +30 -15
@@ -20,6 +20,7 @@ module XeroRuby
20
20
  # @param xero_tenant_id [String] Xero identifier for Tenant
21
21
  # @param project_create_or_update [ProjectCreateOrUpdate] Create a new project with ProjectCreateOrUpdate object
22
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.
23
24
  # @return [Project]
24
25
  def create_project(xero_tenant_id, project_create_or_update, opts = {})
25
26
  data, _status_code, _headers = create_project_with_http_info(xero_tenant_id, project_create_or_update, opts)
@@ -30,6 +31,7 @@ module XeroRuby
30
31
  # @param xero_tenant_id [String] Xero identifier for Tenant
31
32
  # @param project_create_or_update [ProjectCreateOrUpdate] Create a new project with ProjectCreateOrUpdate object
32
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.
33
35
  # @return [Array<(Project, Integer, Hash)>] Project data, response status code and response headers
34
36
  def create_project_with_http_info(xero_tenant_id, project_create_or_update, options = {})
35
37
  opts = options.dup
@@ -64,6 +66,7 @@ module XeroRuby
64
66
  # HTTP header 'Content-Type'
65
67
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
66
68
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
69
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
67
70
 
68
71
  # form parameters
69
72
  form_params = opts[:form_params] || {}
@@ -93,12 +96,101 @@ module XeroRuby
93
96
  return data, status_code, headers
94
97
  end
95
98
 
99
+ # Allows you to create a task
100
+ # Allows you to create a specific task
101
+ # @param xero_tenant_id [String] Xero identifier for Tenant
102
+ # @param project_id [String] You can create a task on a specified projectId
103
+ # @param task_create_or_update [TaskCreateOrUpdate] The task object you are creating
104
+ # @param [Hash] opts the optional parameters
105
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
106
+ # @return [Task]
107
+ def create_task(xero_tenant_id, project_id, task_create_or_update, opts = {})
108
+ data, _status_code, _headers = create_task_with_http_info(xero_tenant_id, project_id, task_create_or_update, opts)
109
+ data
110
+ end
111
+
112
+ # Allows you to create a task
113
+ # Allows you to create a specific task
114
+ # @param xero_tenant_id [String] Xero identifier for Tenant
115
+ # @param project_id [String] You can create a task on a specified projectId
116
+ # @param task_create_or_update [TaskCreateOrUpdate] The task object you are creating
117
+ # @param [Hash] opts the optional parameters
118
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
119
+ # @return [Array<(Task, Integer, Hash)>] Task data, response status code and response headers
120
+ def create_task_with_http_info(xero_tenant_id, project_id, task_create_or_update, options = {})
121
+ opts = options.dup
122
+ if @api_client.config.debugging
123
+ @api_client.config.logger.debug 'Calling API: ProjectApi.create_task ...'
124
+ end
125
+ # verify the required parameter 'xero_tenant_id' is set
126
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
127
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling ProjectApi.create_task"
128
+ end
129
+ # verify the required parameter 'project_id' is set
130
+ if @api_client.config.client_side_validation && project_id.nil?
131
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.create_task"
132
+ end
133
+ # verify the required parameter 'task_create_or_update' is set
134
+ if @api_client.config.client_side_validation && task_create_or_update.nil?
135
+ fail ArgumentError, "Missing the required parameter 'task_create_or_update' when calling ProjectApi.create_task"
136
+ end
137
+ # resource path
138
+ local_var_path = '/Projects/{projectId}/Tasks'.sub('{' + 'projectId' + '}', project_id.to_s)
139
+
140
+ # camelize keys of incoming `where` opts
141
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
142
+
143
+ # query parameters
144
+ query_params = opts[:query_params] || {}
145
+
146
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
147
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
148
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
149
+
150
+ # header parameters
151
+ header_params = opts[:header_params] || {}
152
+ # HTTP header 'Accept' (if needed)
153
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
154
+ # HTTP header 'Content-Type'
155
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
156
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
157
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
158
+
159
+ # form parameters
160
+ form_params = opts[:form_params] || {}
161
+
162
+ # http body (model)
163
+ post_body = opts[:body] || @api_client.object_to_http_body(task_create_or_update)
164
+
165
+ # return_type
166
+ return_type = opts[:return_type] || 'Task'
167
+
168
+ # auth_names
169
+ auth_names = opts[:auth_names] || ['OAuth2']
170
+
171
+ new_options = opts.merge(
172
+ :header_params => header_params,
173
+ :query_params => query_params,
174
+ :form_params => form_params,
175
+ :body => post_body,
176
+ :auth_names => auth_names,
177
+ :return_type => return_type
178
+ )
179
+
180
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, "ProjectApi", new_options)
181
+ if @api_client.config.debugging
182
+ @api_client.config.logger.debug "API called: ProjectApi#create_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
183
+ end
184
+ return data, status_code, headers
185
+ end
186
+
96
187
  # Creates a time entry for a specific project
97
188
  # Allows you to create a specific task
98
189
  # @param xero_tenant_id [String] Xero identifier for Tenant
99
190
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
100
191
  # @param time_entry_create_or_update [TimeEntryCreateOrUpdate] The time entry object you are creating
101
192
  # @param [Hash] opts the optional parameters
193
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
102
194
  # @return [TimeEntry]
103
195
  def create_time_entry(xero_tenant_id, project_id, time_entry_create_or_update, opts = {})
104
196
  data, _status_code, _headers = create_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_create_or_update, opts)
@@ -111,6 +203,7 @@ module XeroRuby
111
203
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
112
204
  # @param time_entry_create_or_update [TimeEntryCreateOrUpdate] The time entry object you are creating
113
205
  # @param [Hash] opts the optional parameters
206
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
114
207
  # @return [Array<(TimeEntry, Integer, Hash)>] TimeEntry data, response status code and response headers
115
208
  def create_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_create_or_update, options = {})
116
209
  opts = options.dup
@@ -149,6 +242,7 @@ module XeroRuby
149
242
  # HTTP header 'Content-Type'
150
243
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
151
244
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
245
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
152
246
 
153
247
  # form parameters
154
248
  form_params = opts[:form_params] || {}
@@ -178,6 +272,89 @@ module XeroRuby
178
272
  return data, status_code, headers
179
273
  end
180
274
 
275
+ # Allows you to delete a task
276
+ # Allows you to delete a specific task
277
+ # @param xero_tenant_id [String] Xero identifier for Tenant
278
+ # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
279
+ # @param task_id [String] You can specify an individual task by appending the id to the endpoint
280
+ # @param [Hash] opts the optional parameters
281
+ # @return [nil]
282
+ def delete_task(xero_tenant_id, project_id, task_id, opts = {})
283
+ delete_task_with_http_info(xero_tenant_id, project_id, task_id, opts)
284
+ nil
285
+ end
286
+
287
+ # Allows you to delete a task
288
+ # Allows you to delete a specific task
289
+ # @param xero_tenant_id [String] Xero identifier for Tenant
290
+ # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
291
+ # @param task_id [String] You can specify an individual task by appending the id to the endpoint
292
+ # @param [Hash] opts the optional parameters
293
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
294
+ def delete_task_with_http_info(xero_tenant_id, project_id, task_id, options = {})
295
+ opts = options.dup
296
+ if @api_client.config.debugging
297
+ @api_client.config.logger.debug 'Calling API: ProjectApi.delete_task ...'
298
+ end
299
+ # verify the required parameter 'xero_tenant_id' is set
300
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
301
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling ProjectApi.delete_task"
302
+ end
303
+ # verify the required parameter 'project_id' is set
304
+ if @api_client.config.client_side_validation && project_id.nil?
305
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.delete_task"
306
+ end
307
+ # verify the required parameter 'task_id' is set
308
+ if @api_client.config.client_side_validation && task_id.nil?
309
+ fail ArgumentError, "Missing the required parameter 'task_id' when calling ProjectApi.delete_task"
310
+ end
311
+ # resource path
312
+ local_var_path = '/Projects/{projectId}/Tasks/{taskId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'taskId' + '}', task_id.to_s)
313
+
314
+ # camelize keys of incoming `where` opts
315
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
316
+
317
+ # query parameters
318
+ query_params = opts[:query_params] || {}
319
+
320
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
321
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
322
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
323
+
324
+ # header parameters
325
+ header_params = opts[:header_params] || {}
326
+ # HTTP header 'Accept' (if needed)
327
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
328
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
329
+
330
+ # form parameters
331
+ form_params = opts[:form_params] || {}
332
+
333
+ # http body (model)
334
+ post_body = opts[:body]
335
+
336
+ # return_type
337
+ return_type = opts[:return_type]
338
+
339
+ # auth_names
340
+ auth_names = opts[:auth_names] || ['OAuth2']
341
+
342
+ new_options = opts.merge(
343
+ :header_params => header_params,
344
+ :query_params => query_params,
345
+ :form_params => form_params,
346
+ :body => post_body,
347
+ :auth_names => auth_names,
348
+ :return_type => return_type
349
+ )
350
+
351
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, "ProjectApi", new_options)
352
+ if @api_client.config.debugging
353
+ @api_client.config.logger.debug "API called: ProjectApi#delete_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
354
+ end
355
+ return data, status_code, headers
356
+ end
357
+
181
358
  # Deletes a time entry for a specific project
182
359
  # Allows you to delete a specific time entry
183
360
  # @param xero_tenant_id [String] Xero identifier for Tenant
@@ -229,6 +406,8 @@ module XeroRuby
229
406
 
230
407
  # header parameters
231
408
  header_params = opts[:header_params] || {}
409
+ # HTTP header 'Accept' (if needed)
410
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
232
411
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
233
412
 
234
413
  # form parameters
@@ -605,7 +784,7 @@ module XeroRuby
605
784
  # @param [Hash] opts the optional parameters
606
785
  # @option opts [Integer] :page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
607
786
  # @option opts [Integer] :page_size Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
608
- # @option opts [String] :task_ids taskIdsSearch for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskID},{taskID}
787
+ # @option opts [String] :task_ids Search for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskID},{taskID}
609
788
  # @option opts [ChargeType] :charge_type
610
789
  # @return [Tasks]
611
790
  def get_tasks(xero_tenant_id, project_id, opts = {})
@@ -620,7 +799,7 @@ module XeroRuby
620
799
  # @param [Hash] opts the optional parameters
621
800
  # @option opts [Integer] :page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
622
801
  # @option opts [Integer] :page_size Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
623
- # @option opts [String] :task_ids taskIdsSearch for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskID},{taskID}
802
+ # @option opts [String] :task_ids Search for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskID},{taskID}
624
803
  # @option opts [ChargeType] :charge_type
625
804
  # @return [Array<(Tasks, Integer, Hash)>] Tasks data, response status code and response headers
626
805
  def get_tasks_with_http_info(xero_tenant_id, project_id, options = {})
@@ -883,6 +1062,7 @@ module XeroRuby
883
1062
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
884
1063
  # @param project_patch [ProjectPatch] Update the status of an existing Project
885
1064
  # @param [Hash] opts the optional parameters
1065
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
886
1066
  # @return [nil]
887
1067
  def patch_project(xero_tenant_id, project_id, project_patch, opts = {})
888
1068
  patch_project_with_http_info(xero_tenant_id, project_id, project_patch, opts)
@@ -895,6 +1075,7 @@ module XeroRuby
895
1075
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
896
1076
  # @param project_patch [ProjectPatch] Update the status of an existing Project
897
1077
  # @param [Hash] opts the optional parameters
1078
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
898
1079
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
899
1080
  def patch_project_with_http_info(xero_tenant_id, project_id, project_patch, options = {})
900
1081
  opts = options.dup
@@ -933,6 +1114,7 @@ module XeroRuby
933
1114
  # HTTP header 'Content-Type'
934
1115
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
935
1116
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
1117
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
936
1118
 
937
1119
  # form parameters
938
1120
  form_params = opts[:form_params] || {}
@@ -968,6 +1150,7 @@ module XeroRuby
968
1150
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
969
1151
  # @param project_create_or_update [ProjectCreateOrUpdate] Request of type ProjectCreateOrUpdate
970
1152
  # @param [Hash] opts the optional parameters
1153
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
971
1154
  # @return [nil]
972
1155
  def update_project(xero_tenant_id, project_id, project_create_or_update, opts = {})
973
1156
  update_project_with_http_info(xero_tenant_id, project_id, project_create_or_update, opts)
@@ -980,6 +1163,7 @@ module XeroRuby
980
1163
  # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
981
1164
  # @param project_create_or_update [ProjectCreateOrUpdate] Request of type ProjectCreateOrUpdate
982
1165
  # @param [Hash] opts the optional parameters
1166
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
983
1167
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
984
1168
  def update_project_with_http_info(xero_tenant_id, project_id, project_create_or_update, options = {})
985
1169
  opts = options.dup
@@ -1018,6 +1202,7 @@ module XeroRuby
1018
1202
  # HTTP header 'Content-Type'
1019
1203
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1020
1204
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
1205
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1021
1206
 
1022
1207
  # form parameters
1023
1208
  form_params = opts[:form_params] || {}
@@ -1047,6 +1232,100 @@ module XeroRuby
1047
1232
  return data, status_code, headers
1048
1233
  end
1049
1234
 
1235
+ # Allows you to update a task
1236
+ # Allows you to update a specific task
1237
+ # @param xero_tenant_id [String] Xero identifier for Tenant
1238
+ # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
1239
+ # @param task_id [String] You can specify an individual task by appending the id to the endpoint
1240
+ # @param task_create_or_update [TaskCreateOrUpdate] The task object you are updating
1241
+ # @param [Hash] opts the optional parameters
1242
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
1243
+ # @return [nil]
1244
+ def update_task(xero_tenant_id, project_id, task_id, task_create_or_update, opts = {})
1245
+ update_task_with_http_info(xero_tenant_id, project_id, task_id, task_create_or_update, opts)
1246
+ nil
1247
+ end
1248
+
1249
+ # Allows you to update a task
1250
+ # Allows you to update a specific task
1251
+ # @param xero_tenant_id [String] Xero identifier for Tenant
1252
+ # @param project_id [String] You can specify an individual project by appending the projectId to the endpoint
1253
+ # @param task_id [String] You can specify an individual task by appending the id to the endpoint
1254
+ # @param task_create_or_update [TaskCreateOrUpdate] The task object you are updating
1255
+ # @param [Hash] opts the optional parameters
1256
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
1257
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
1258
+ def update_task_with_http_info(xero_tenant_id, project_id, task_id, task_create_or_update, options = {})
1259
+ opts = options.dup
1260
+ if @api_client.config.debugging
1261
+ @api_client.config.logger.debug 'Calling API: ProjectApi.update_task ...'
1262
+ end
1263
+ # verify the required parameter 'xero_tenant_id' is set
1264
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
1265
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling ProjectApi.update_task"
1266
+ end
1267
+ # verify the required parameter 'project_id' is set
1268
+ if @api_client.config.client_side_validation && project_id.nil?
1269
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ProjectApi.update_task"
1270
+ end
1271
+ # verify the required parameter 'task_id' is set
1272
+ if @api_client.config.client_side_validation && task_id.nil?
1273
+ fail ArgumentError, "Missing the required parameter 'task_id' when calling ProjectApi.update_task"
1274
+ end
1275
+ # verify the required parameter 'task_create_or_update' is set
1276
+ if @api_client.config.client_side_validation && task_create_or_update.nil?
1277
+ fail ArgumentError, "Missing the required parameter 'task_create_or_update' when calling ProjectApi.update_task"
1278
+ end
1279
+ # resource path
1280
+ local_var_path = '/Projects/{projectId}/Tasks/{taskId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'taskId' + '}', task_id.to_s)
1281
+
1282
+ # camelize keys of incoming `where` opts
1283
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
1284
+
1285
+ # query parameters
1286
+ query_params = opts[:query_params] || {}
1287
+
1288
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
1289
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
1290
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
1291
+
1292
+ # header parameters
1293
+ header_params = opts[:header_params] || {}
1294
+ # HTTP header 'Accept' (if needed)
1295
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1296
+ # HTTP header 'Content-Type'
1297
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1298
+ header_params[:'Xero-Tenant-Id'] = xero_tenant_id
1299
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1300
+
1301
+ # form parameters
1302
+ form_params = opts[:form_params] || {}
1303
+
1304
+ # http body (model)
1305
+ post_body = opts[:body] || @api_client.object_to_http_body(task_create_or_update)
1306
+
1307
+ # return_type
1308
+ return_type = opts[:return_type]
1309
+
1310
+ # auth_names
1311
+ auth_names = opts[:auth_names] || ['OAuth2']
1312
+
1313
+ new_options = opts.merge(
1314
+ :header_params => header_params,
1315
+ :query_params => query_params,
1316
+ :form_params => form_params,
1317
+ :body => post_body,
1318
+ :auth_names => auth_names,
1319
+ :return_type => return_type
1320
+ )
1321
+
1322
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, "ProjectApi", new_options)
1323
+ if @api_client.config.debugging
1324
+ @api_client.config.logger.debug "API called: ProjectApi#update_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1325
+ end
1326
+ return data, status_code, headers
1327
+ end
1328
+
1050
1329
  # Updates a time entry for a specific project
1051
1330
  # Allows you to update time entry in a project
1052
1331
  # @param xero_tenant_id [String] Xero identifier for Tenant
@@ -1054,6 +1333,7 @@ module XeroRuby
1054
1333
  # @param time_entry_id [String] You can specify an individual time entry by appending the id to the endpoint
1055
1334
  # @param time_entry_create_or_update [TimeEntryCreateOrUpdate] The time entry object you are updating
1056
1335
  # @param [Hash] opts the optional parameters
1336
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
1057
1337
  # @return [nil]
1058
1338
  def update_time_entry(xero_tenant_id, project_id, time_entry_id, time_entry_create_or_update, opts = {})
1059
1339
  update_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, time_entry_create_or_update, opts)
@@ -1067,6 +1347,7 @@ module XeroRuby
1067
1347
  # @param time_entry_id [String] You can specify an individual time entry by appending the id to the endpoint
1068
1348
  # @param time_entry_create_or_update [TimeEntryCreateOrUpdate] The time entry object you are updating
1069
1349
  # @param [Hash] opts the optional parameters
1350
+ # @option opts [String] :idempotency_key This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
1070
1351
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
1071
1352
  def update_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, time_entry_create_or_update, options = {})
1072
1353
  opts = options.dup
@@ -1104,9 +1385,12 @@ module XeroRuby
1104
1385
 
1105
1386
  # header parameters
1106
1387
  header_params = opts[:header_params] || {}
1388
+ # HTTP header 'Accept' (if needed)
1389
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1107
1390
  # HTTP header 'Content-Type'
1108
1391
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1109
1392
  header_params[:'Xero-Tenant-Id'] = xero_tenant_id
1393
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
1110
1394
 
1111
1395
  # form parameters
1112
1396
  form_params = opts[:form_params] || {}
@@ -196,7 +196,12 @@ module XeroRuby
196
196
 
197
197
  def decode_jwt(tkn, verify=true)
198
198
  if verify == true
199
- jwks_data = JSON.parse(Faraday.get('https://identity.xero.com/.well-known/openid-configuration/jwks').body)
199
+
200
+ response = Faraday.get('https://identity.xero.com/.well-known/openid-configuration/jwks') do |req|
201
+ req.headers['User-Agent'] = @user_agent
202
+ end
203
+
204
+ jwks_data = JSON.parse(response.body)
200
205
  jwk_set = JSON::JWK::Set.new(jwks_data)
201
206
  JSON::JWT.decode(tkn, jwk_set)
202
207
  else
@@ -230,6 +235,7 @@ module XeroRuby
230
235
  response = Faraday.post("#{@config.token_url}#{path}") do |req|
231
236
  req.headers['Authorization'] = "Basic " + Base64.strict_encode64("#{@client_id}:#{@client_secret}")
232
237
  req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
238
+ req.headers['User-Agent'] = @user_agent
233
239
  req.body = URI.encode_www_form(data)
234
240
  end
235
241
  return_error(response) unless response.success?
@@ -251,7 +257,7 @@ module XeroRuby
251
257
  end
252
258
 
253
259
  def last_connection
254
- connections.sort { |a,b| DateTime.parse(a['updatedDateUtc']) <=> DateTime.parse(b['updatedDateUtc'])}.first
260
+ connections.sort { |a,b| DateTime.parse(a['updatedDateUtc']) <=> DateTime.parse(b['updatedDateUtc'])}.last
255
261
  end
256
262
 
257
263
  def disconnect(connection_id)
@@ -298,7 +304,7 @@ module XeroRuby
298
304
  end
299
305
 
300
306
  connection = Faraday.new(:url => method_base_url, :ssl => ssl_options) do |conn|
301
- conn.request(:basic_auth, config.username, config.password)
307
+ conn.request(:authorization, :basic, config.username, config.password)
302
308
  if opts[:header_params]["Content-Type"] == "multipart/form-data"
303
309
  conn.request :multipart
304
310
  conn.request :url_encoded
@@ -51,7 +51,7 @@ module XeroRuby::Accounting
51
51
 
52
52
  attr_accessor :currency_code
53
53
 
54
- # The tax type from TaxRates
54
+ # The tax type from taxRates
55
55
  attr_accessor :tax_type
56
56
 
57
57
  # Boolean – describes whether account can have payments applied to it
@@ -31,11 +31,7 @@ module XeroRuby::Accounting
31
31
  REVENUE ||= "REVENUE".freeze
32
32
  SALES ||= "SALES".freeze
33
33
  TERMLIAB ||= "TERMLIAB".freeze
34
- PAYGLIABILITY ||= "PAYGLIABILITY".freeze
35
34
  PAYG ||= "PAYG".freeze
36
- SUPERANNUATIONEXPENSE ||= "SUPERANNUATIONEXPENSE".freeze
37
- SUPERANNUATIONLIABILITY ||= "SUPERANNUATIONLIABILITY".freeze
38
- WAGESEXPENSE ||= "WAGESEXPENSE".freeze
39
35
 
40
36
  # Builds the enum from string
41
37
  # @param [String] The enum value in the form of the string
@@ -16,6 +16,9 @@ module XeroRuby::Accounting
16
16
  require 'bigdecimal'
17
17
 
18
18
  class Allocation
19
+ # Xero generated unique identifier
20
+ attr_accessor :allocation_id
21
+
19
22
 
20
23
  attr_accessor :invoice
21
24
 
@@ -34,6 +37,9 @@ module XeroRuby::Accounting
34
37
  # the date the allocation is applied YYYY-MM-DD.
35
38
  attr_accessor :date
36
39
 
40
+ # A flag that returns true when the allocation is succesfully deleted
41
+ attr_accessor :is_deleted
42
+
37
43
  # A string to indicate if a invoice status
38
44
  attr_accessor :status_attribute_string
39
45
 
@@ -43,12 +49,14 @@ module XeroRuby::Accounting
43
49
  # Attribute mapping from ruby-style variable name to JSON key.
44
50
  def self.attribute_map
45
51
  {
52
+ :'allocation_id' => :'AllocationID',
46
53
  :'invoice' => :'Invoice',
47
54
  :'overpayment' => :'Overpayment',
48
55
  :'prepayment' => :'Prepayment',
49
56
  :'credit_note' => :'CreditNote',
50
57
  :'amount' => :'Amount',
51
58
  :'date' => :'Date',
59
+ :'is_deleted' => :'IsDeleted',
52
60
  :'status_attribute_string' => :'StatusAttributeString',
53
61
  :'validation_errors' => :'ValidationErrors'
54
62
  }
@@ -57,12 +65,14 @@ module XeroRuby::Accounting
57
65
  # Attribute type mapping.
58
66
  def self.openapi_types
59
67
  {
68
+ :'allocation_id' => :'String',
60
69
  :'invoice' => :'Invoice',
61
70
  :'overpayment' => :'Overpayment',
62
71
  :'prepayment' => :'Prepayment',
63
72
  :'credit_note' => :'CreditNote',
64
73
  :'amount' => :'BigDecimal',
65
74
  :'date' => :'Date',
75
+ :'is_deleted' => :'Boolean',
66
76
  :'status_attribute_string' => :'String',
67
77
  :'validation_errors' => :'Array<ValidationError>'
68
78
  }
@@ -83,6 +93,10 @@ module XeroRuby::Accounting
83
93
  h[k.to_sym] = v
84
94
  }
85
95
 
96
+ if attributes.key?(:'allocation_id')
97
+ self.allocation_id = attributes[:'allocation_id']
98
+ end
99
+
86
100
  if attributes.key?(:'invoice')
87
101
  self.invoice = attributes[:'invoice']
88
102
  end
@@ -107,6 +121,10 @@ module XeroRuby::Accounting
107
121
  self.date = attributes[:'date']
108
122
  end
109
123
 
124
+ if attributes.key?(:'is_deleted')
125
+ self.is_deleted = attributes[:'is_deleted']
126
+ end
127
+
110
128
  if attributes.key?(:'status_attribute_string')
111
129
  self.status_attribute_string = attributes[:'status_attribute_string']
112
130
  end
@@ -151,12 +169,14 @@ module XeroRuby::Accounting
151
169
  def ==(o)
152
170
  return true if self.equal?(o)
153
171
  self.class == o.class &&
172
+ allocation_id == o.allocation_id &&
154
173
  invoice == o.invoice &&
155
174
  overpayment == o.overpayment &&
156
175
  prepayment == o.prepayment &&
157
176
  credit_note == o.credit_note &&
158
177
  amount == o.amount &&
159
178
  date == o.date &&
179
+ is_deleted == o.is_deleted &&
160
180
  status_attribute_string == o.status_attribute_string &&
161
181
  validation_errors == o.validation_errors
162
182
  end
@@ -170,7 +190,7 @@ module XeroRuby::Accounting
170
190
  # Calculates hash code according to all attributes.
171
191
  # @return [Integer] Hash code
172
192
  def hash
173
- [invoice, overpayment, prepayment, credit_note, amount, date, status_attribute_string, validation_errors].hash
193
+ [allocation_id, invoice, overpayment, prepayment, credit_note, amount, date, is_deleted, status_attribute_string, validation_errors].hash
174
194
  end
175
195
 
176
196
  # Builds the object from hash
@@ -132,9 +132,9 @@ module XeroRuby::Accounting
132
132
  :'payments' => :'Array<Payment>',
133
133
  :'type' => :'String',
134
134
  :'status' => :'String',
135
- :'total_amount' => :'String',
135
+ :'total_amount' => :'BigDecimal',
136
136
  :'updated_date_utc' => :'DateTime',
137
- :'is_reconciled' => :'String',
137
+ :'is_reconciled' => :'Boolean',
138
138
  :'validation_errors' => :'Array<ValidationError>'
139
139
  }
140
140
  end