xero-ruby 1.2.0 → 2.1.1

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 (204) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +181 -72
  3. data/build_notes.md +52 -0
  4. data/docs/accounting/Account.md +1 -1
  5. data/docs/accounting/AccountingApi.md +23 -11
  6. data/docs/accounting/AccountsPayable.md +2 -2
  7. data/docs/accounting/AccountsReceivable.md +2 -2
  8. data/docs/accounting/Allocation.md +1 -1
  9. data/docs/accounting/Attachment.md +1 -1
  10. data/docs/accounting/BankTransaction.md +6 -6
  11. data/docs/accounting/BankTransfer.md +3 -3
  12. data/docs/accounting/BatchPayment.md +2 -2
  13. data/docs/accounting/BrandingTheme.md +1 -1
  14. data/docs/accounting/Contact.md +2 -2
  15. data/docs/accounting/CreditNote.md +6 -6
  16. data/docs/accounting/Employee.md +1 -1
  17. data/docs/accounting/ExpenseClaim.md +4 -4
  18. data/docs/accounting/HistoryRecord.md +1 -1
  19. data/docs/accounting/Invoice.md +10 -10
  20. data/docs/accounting/Item.md +3 -3
  21. data/docs/accounting/Journal.md +1 -1
  22. data/docs/accounting/JournalLine.md +3 -3
  23. data/docs/accounting/LineItem.md +6 -6
  24. data/docs/accounting/LinkedTransaction.md +1 -1
  25. data/docs/accounting/ManualJournal.md +1 -1
  26. data/docs/accounting/ManualJournalLine.md +4 -2
  27. data/docs/accounting/Organisation.md +2 -2
  28. data/docs/accounting/Overpayment.md +6 -6
  29. data/docs/accounting/Payment.md +3 -3
  30. data/docs/accounting/Prepayment.md +6 -6
  31. data/docs/accounting/Purchase.md +1 -1
  32. data/docs/accounting/PurchaseOrder.md +6 -6
  33. data/docs/accounting/Quote.md +5 -5
  34. data/docs/accounting/Receipt.md +4 -4
  35. data/docs/accounting/RepeatingInvoice.md +3 -3
  36. data/docs/accounting/Report.md +2 -2
  37. data/docs/accounting/ReportWithRow.md +1 -1
  38. data/docs/accounting/TaxComponent.md +1 -1
  39. data/docs/accounting/TaxRate.md +2 -2
  40. data/docs/accounting/{TenNinteyNineContact.md → TenNinetyNineContact.md} +15 -15
  41. data/docs/accounting/User.md +1 -1
  42. data/docs/assets/Asset.md +3 -3
  43. data/docs/assets/BookDepreciationDetail.md +6 -6
  44. data/docs/assets/BookDepreciationSetting.md +1 -1
  45. data/docs/projects/Amount.md +1 -1
  46. data/docs/projects/ProjectCreateOrUpdate.md +1 -1
  47. data/lib/xero-ruby.rb +2 -2
  48. data/lib/xero-ruby/api/accounting_api.rb +1311 -7
  49. data/lib/xero-ruby/api/asset_api.rb +37 -1
  50. data/lib/xero-ruby/api/project_api.rb +79 -1
  51. data/lib/xero-ruby/api_client.rb +72 -32
  52. data/lib/xero-ruby/api_error.rb +1 -1
  53. data/lib/xero-ruby/configuration.rb +2 -5
  54. data/lib/xero-ruby/models/accounting/account.rb +7 -2
  55. data/lib/xero-ruby/models/accounting/account_type.rb +1 -1
  56. data/lib/xero-ruby/models/accounting/accounts.rb +5 -1
  57. data/lib/xero-ruby/models/accounting/accounts_payable.rb +7 -3
  58. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +7 -3
  59. data/lib/xero-ruby/models/accounting/address.rb +5 -1
  60. data/lib/xero-ruby/models/accounting/allocation.rb +6 -2
  61. data/lib/xero-ruby/models/accounting/allocations.rb +5 -1
  62. data/lib/xero-ruby/models/accounting/attachment.rb +6 -2
  63. data/lib/xero-ruby/models/accounting/attachments.rb +5 -1
  64. data/lib/xero-ruby/models/accounting/balances.rb +5 -1
  65. data/lib/xero-ruby/models/accounting/bank_transaction.rb +9 -10
  66. data/lib/xero-ruby/models/accounting/bank_transactions.rb +5 -1
  67. data/lib/xero-ruby/models/accounting/bank_transfer.rb +7 -3
  68. data/lib/xero-ruby/models/accounting/bank_transfers.rb +5 -1
  69. data/lib/xero-ruby/models/accounting/batch_payment.rb +6 -2
  70. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +5 -1
  71. data/lib/xero-ruby/models/accounting/batch_payments.rb +5 -1
  72. data/lib/xero-ruby/models/accounting/bill.rb +5 -1
  73. data/lib/xero-ruby/models/accounting/branding_theme.rb +5 -1
  74. data/lib/xero-ruby/models/accounting/branding_themes.rb +5 -1
  75. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +5 -1
  76. data/lib/xero-ruby/models/accounting/cis_setting.rb +5 -1
  77. data/lib/xero-ruby/models/accounting/cis_settings.rb +5 -1
  78. data/lib/xero-ruby/models/accounting/contact.rb +6 -2
  79. data/lib/xero-ruby/models/accounting/contact_group.rb +5 -1
  80. data/lib/xero-ruby/models/accounting/contact_groups.rb +5 -1
  81. data/lib/xero-ruby/models/accounting/contact_person.rb +5 -1
  82. data/lib/xero-ruby/models/accounting/contacts.rb +5 -1
  83. data/lib/xero-ruby/models/accounting/country_code.rb +1 -1
  84. data/lib/xero-ruby/models/accounting/credit_note.rb +10 -6
  85. data/lib/xero-ruby/models/accounting/credit_notes.rb +5 -1
  86. data/lib/xero-ruby/models/accounting/currencies.rb +5 -1
  87. data/lib/xero-ruby/models/accounting/currency.rb +5 -1
  88. data/lib/xero-ruby/models/accounting/currency_code.rb +1 -1
  89. data/lib/xero-ruby/models/accounting/element.rb +5 -1
  90. data/lib/xero-ruby/models/accounting/employee.rb +8 -3
  91. data/lib/xero-ruby/models/accounting/employees.rb +5 -1
  92. data/lib/xero-ruby/models/accounting/error.rb +5 -1
  93. data/lib/xero-ruby/models/accounting/expense_claim.rb +8 -4
  94. data/lib/xero-ruby/models/accounting/expense_claims.rb +5 -1
  95. data/lib/xero-ruby/models/accounting/external_link.rb +5 -1
  96. data/lib/xero-ruby/models/accounting/history_record.rb +5 -1
  97. data/lib/xero-ruby/models/accounting/history_records.rb +5 -1
  98. data/lib/xero-ruby/models/accounting/invoice.rb +14 -10
  99. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +5 -1
  100. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +5 -1
  101. data/lib/xero-ruby/models/accounting/invoices.rb +5 -1
  102. data/lib/xero-ruby/models/accounting/item.rb +7 -3
  103. data/lib/xero-ruby/models/accounting/items.rb +5 -1
  104. data/lib/xero-ruby/models/accounting/journal.rb +5 -1
  105. data/lib/xero-ruby/models/accounting/journal_line.rb +8 -4
  106. data/lib/xero-ruby/models/accounting/journals.rb +5 -1
  107. data/lib/xero-ruby/models/accounting/line_amount_types.rb +1 -1
  108. data/lib/xero-ruby/models/accounting/line_item.rb +11 -7
  109. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +5 -1
  110. data/lib/xero-ruby/models/accounting/linked_transaction.rb +5 -1
  111. data/lib/xero-ruby/models/accounting/linked_transactions.rb +5 -1
  112. data/lib/xero-ruby/models/accounting/manual_journal.rb +5 -1
  113. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +18 -4
  114. data/lib/xero-ruby/models/accounting/manual_journals.rb +5 -1
  115. data/lib/xero-ruby/models/accounting/online_invoice.rb +5 -1
  116. data/lib/xero-ruby/models/accounting/online_invoices.rb +5 -1
  117. data/lib/xero-ruby/models/accounting/organisation.rb +33 -3
  118. data/lib/xero-ruby/models/accounting/organisations.rb +5 -1
  119. data/lib/xero-ruby/models/accounting/overpayment.rb +10 -6
  120. data/lib/xero-ruby/models/accounting/overpayments.rb +5 -1
  121. data/lib/xero-ruby/models/accounting/payment.rb +7 -3
  122. data/lib/xero-ruby/models/accounting/payment_delete.rb +5 -1
  123. data/lib/xero-ruby/models/accounting/payment_service.rb +5 -1
  124. data/lib/xero-ruby/models/accounting/payment_services.rb +5 -1
  125. data/lib/xero-ruby/models/accounting/payment_term.rb +5 -1
  126. data/lib/xero-ruby/models/accounting/payment_term_type.rb +1 -1
  127. data/lib/xero-ruby/models/accounting/payments.rb +5 -1
  128. data/lib/xero-ruby/models/accounting/phone.rb +5 -1
  129. data/lib/xero-ruby/models/accounting/prepayment.rb +10 -6
  130. data/lib/xero-ruby/models/accounting/prepayments.rb +5 -1
  131. data/lib/xero-ruby/models/accounting/purchase.rb +6 -2
  132. data/lib/xero-ruby/models/accounting/purchase_order.rb +10 -6
  133. data/lib/xero-ruby/models/accounting/purchase_orders.rb +5 -1
  134. data/lib/xero-ruby/models/accounting/quote.rb +9 -5
  135. data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +1 -1
  136. data/lib/xero-ruby/models/accounting/quote_status_codes.rb +2 -1
  137. data/lib/xero-ruby/models/accounting/quotes.rb +5 -1
  138. data/lib/xero-ruby/models/accounting/receipt.rb +8 -4
  139. data/lib/xero-ruby/models/accounting/receipts.rb +5 -1
  140. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +8 -4
  141. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +5 -1
  142. data/lib/xero-ruby/models/accounting/report.rb +6 -2
  143. data/lib/xero-ruby/models/accounting/report_attribute.rb +5 -1
  144. data/lib/xero-ruby/models/accounting/report_cell.rb +5 -1
  145. data/lib/xero-ruby/models/accounting/report_fields.rb +5 -1
  146. data/lib/xero-ruby/models/accounting/report_row.rb +5 -1
  147. data/lib/xero-ruby/models/accounting/report_rows.rb +5 -1
  148. data/lib/xero-ruby/models/accounting/report_with_row.rb +5 -1
  149. data/lib/xero-ruby/models/accounting/report_with_rows.rb +5 -1
  150. data/lib/xero-ruby/models/accounting/reports.rb +5 -1
  151. data/lib/xero-ruby/models/accounting/request_empty.rb +5 -1
  152. data/lib/xero-ruby/models/accounting/row_type.rb +1 -1
  153. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +5 -1
  154. data/lib/xero-ruby/models/accounting/schedule.rb +5 -1
  155. data/lib/xero-ruby/models/accounting/tax_component.rb +6 -2
  156. data/lib/xero-ruby/models/accounting/tax_rate.rb +7 -3
  157. data/lib/xero-ruby/models/accounting/tax_rates.rb +5 -1
  158. data/lib/xero-ruby/models/accounting/tax_type.rb +1 -1
  159. data/lib/xero-ruby/models/accounting/{ten_nintey_nine_contact.rb → ten_ninety_nine_contact.rb} +21 -17
  160. data/lib/xero-ruby/models/accounting/time_zone.rb +1 -1
  161. data/lib/xero-ruby/models/accounting/tracking_categories.rb +5 -1
  162. data/lib/xero-ruby/models/accounting/tracking_category.rb +5 -1
  163. data/lib/xero-ruby/models/accounting/tracking_option.rb +5 -1
  164. data/lib/xero-ruby/models/accounting/tracking_options.rb +5 -1
  165. data/lib/xero-ruby/models/accounting/user.rb +5 -1
  166. data/lib/xero-ruby/models/accounting/users.rb +5 -1
  167. data/lib/xero-ruby/models/accounting/validation_error.rb +5 -1
  168. data/lib/xero-ruby/models/assets/asset.rb +8 -4
  169. data/lib/xero-ruby/models/assets/asset_status.rb +1 -1
  170. data/lib/xero-ruby/models/assets/asset_status_query_param.rb +1 -1
  171. data/lib/xero-ruby/models/assets/asset_type.rb +5 -1
  172. data/lib/xero-ruby/models/assets/assets.rb +5 -1
  173. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +11 -7
  174. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +6 -2
  175. data/lib/xero-ruby/models/assets/error.rb +5 -1
  176. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +5 -1
  177. data/lib/xero-ruby/models/assets/pagination.rb +5 -1
  178. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +5 -1
  179. data/lib/xero-ruby/models/assets/setting.rb +5 -1
  180. data/lib/xero-ruby/models/projects/amount.rb +6 -2
  181. data/lib/xero-ruby/models/projects/charge_type.rb +1 -1
  182. data/lib/xero-ruby/models/projects/currency_code.rb +1 -1
  183. data/lib/xero-ruby/models/projects/error.rb +5 -1
  184. data/lib/xero-ruby/models/projects/pagination.rb +5 -1
  185. data/lib/xero-ruby/models/projects/project.rb +5 -1
  186. data/lib/xero-ruby/models/projects/project_create_or_update.rb +6 -2
  187. data/lib/xero-ruby/models/projects/project_patch.rb +5 -1
  188. data/lib/xero-ruby/models/projects/project_status.rb +1 -1
  189. data/lib/xero-ruby/models/projects/project_user.rb +5 -1
  190. data/lib/xero-ruby/models/projects/project_users.rb +5 -1
  191. data/lib/xero-ruby/models/projects/projects.rb +5 -1
  192. data/lib/xero-ruby/models/projects/task.rb +5 -1
  193. data/lib/xero-ruby/models/projects/task_create_or_update.rb +5 -1
  194. data/lib/xero-ruby/models/projects/tasks.rb +5 -1
  195. data/lib/xero-ruby/models/projects/time_entries.rb +5 -1
  196. data/lib/xero-ruby/models/projects/time_entry.rb +5 -1
  197. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +5 -1
  198. data/lib/xero-ruby/version.rb +2 -2
  199. data/spec/accounting/models/ten_nintey_nine_contact_spec.rb +6 -6
  200. data/spec/api_client_spec.rb +103 -16
  201. data/xero-ruby.gemspec +1 -2
  202. metadata +5 -6
  203. data/Gemfile.lock +0 -68
  204. data/xero-ruby.gem +0 -0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #This is the Xero Assets API
5
5
 
6
- The version of the OpenAPI document: 2.2.6
6
+ The version of the OpenAPI document: 2.2.14
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -51,8 +51,14 @@ module XeroRuby
51
51
  # resource path
52
52
  local_var_path = '/Assets'
53
53
 
54
+ # camelize keys of incoming `where` opts
55
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
54
56
  # query parameters
55
57
  query_params = opts[:query_params] || {}
58
+
59
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
60
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
61
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
56
62
 
57
63
  # header parameters
58
64
  header_params = opts[:header_params] || {}
@@ -118,8 +124,14 @@ module XeroRuby
118
124
  # resource path
119
125
  local_var_path = '/AssetTypes'
120
126
 
127
+ # camelize keys of incoming `where` opts
128
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
121
129
  # query parameters
122
130
  query_params = opts[:query_params] || {}
131
+
132
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
133
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
134
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
123
135
 
124
136
  # header parameters
125
137
  header_params = opts[:header_params] || {}
@@ -189,8 +201,14 @@ module XeroRuby
189
201
  # resource path
190
202
  local_var_path = '/Assets/{id}'.sub('{' + 'id' + '}', id.to_s)
191
203
 
204
+ # camelize keys of incoming `where` opts
205
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
192
206
  # query parameters
193
207
  query_params = opts[:query_params] || {}
208
+
209
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
210
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
211
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
194
212
 
195
213
  # header parameters
196
214
  header_params = opts[:header_params] || {}
@@ -252,8 +270,14 @@ module XeroRuby
252
270
  # resource path
253
271
  local_var_path = '/Settings'
254
272
 
273
+ # camelize keys of incoming `where` opts
274
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
255
275
  # query parameters
256
276
  query_params = opts[:query_params] || {}
277
+
278
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
279
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
280
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
257
281
 
258
282
  # header parameters
259
283
  header_params = opts[:header_params] || {}
@@ -315,8 +339,14 @@ module XeroRuby
315
339
  # resource path
316
340
  local_var_path = '/AssetTypes'
317
341
 
342
+ # camelize keys of incoming `where` opts
343
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
318
344
  # query parameters
319
345
  query_params = opts[:query_params] || {}
346
+
347
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
348
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
349
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
320
350
 
321
351
  # header parameters
322
352
  header_params = opts[:header_params] || {}
@@ -406,6 +436,8 @@ module XeroRuby
406
436
  # resource path
407
437
  local_var_path = '/Assets'
408
438
 
439
+ # camelize keys of incoming `where` opts
440
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
409
441
  # query parameters
410
442
  query_params = opts[:query_params] || {}
411
443
  query_params[:'status'] = status
@@ -414,6 +446,10 @@ module XeroRuby
414
446
  query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?
415
447
  query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?
416
448
  query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?
449
+
450
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
451
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
452
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
417
453
 
418
454
  # header parameters
419
455
  header_params = opts[:header_params] || {}
@@ -3,7 +3,7 @@
3
3
 
4
4
  #This is the Xero Projects API
5
5
 
6
- The version of the OpenAPI document: 2.2.6
6
+ The version of the OpenAPI document: 2.2.14
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -49,8 +49,14 @@ module XeroRuby
49
49
  # resource path
50
50
  local_var_path = '/projects'
51
51
 
52
+ # camelize keys of incoming `where` opts
53
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
52
54
  # query parameters
53
55
  query_params = opts[:query_params] || {}
56
+
57
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
58
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
59
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
54
60
 
55
61
  # header parameters
56
62
  header_params = opts[:header_params] || {}
@@ -126,8 +132,14 @@ module XeroRuby
126
132
  # resource path
127
133
  local_var_path = '/projects/{projectId}/time'.sub('{' + 'projectId' + '}', project_id.to_s)
128
134
 
135
+ # camelize keys of incoming `where` opts
136
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
129
137
  # query parameters
130
138
  query_params = opts[:query_params] || {}
139
+
140
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
141
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
142
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
131
143
 
132
144
  # header parameters
133
145
  header_params = opts[:header_params] || {}
@@ -203,8 +215,14 @@ module XeroRuby
203
215
  # resource path
204
216
  local_var_path = '/projects/{projectId}/time/{timeEntryId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'timeEntryId' + '}', time_entry_id.to_s)
205
217
 
218
+ # camelize keys of incoming `where` opts
219
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
206
220
  # query parameters
207
221
  query_params = opts[:query_params] || {}
222
+
223
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
224
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
225
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
208
226
 
209
227
  # header parameters
210
228
  header_params = opts[:header_params] || {}
@@ -270,8 +288,14 @@ module XeroRuby
270
288
  # resource path
271
289
  local_var_path = '/projects/{projectId}'.sub('{' + 'projectId' + '}', project_id.to_s)
272
290
 
291
+ # camelize keys of incoming `where` opts
292
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
273
293
  # query parameters
274
294
  query_params = opts[:query_params] || {}
295
+
296
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
297
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
298
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
275
299
 
276
300
  # header parameters
277
301
  header_params = opts[:header_params] || {}
@@ -345,10 +369,16 @@ module XeroRuby
345
369
  # resource path
346
370
  local_var_path = '/projectsusers'
347
371
 
372
+ # camelize keys of incoming `where` opts
373
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
348
374
  # query parameters
349
375
  query_params = opts[:query_params] || {}
350
376
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
351
377
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
378
+
379
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
380
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
381
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
352
382
 
353
383
  # header parameters
354
384
  header_params = opts[:header_params] || {}
@@ -428,6 +458,8 @@ module XeroRuby
428
458
  # resource path
429
459
  local_var_path = '/projects'
430
460
 
461
+ # camelize keys of incoming `where` opts
462
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
431
463
  # query parameters
432
464
  query_params = opts[:query_params] || {}
433
465
  query_params[:'projectIds'] = @api_client.build_collection_param(opts[:'project_ids'], :multi) if !opts[:'project_ids'].nil?
@@ -435,6 +467,10 @@ module XeroRuby
435
467
  query_params[:'states'] = opts[:'states'] if !opts[:'states'].nil?
436
468
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
437
469
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
470
+
471
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
472
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
473
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
438
474
 
439
475
  # header parameters
440
476
  header_params = opts[:header_params] || {}
@@ -508,8 +544,14 @@ module XeroRuby
508
544
  # resource path
509
545
  local_var_path = '/projects/{projectId}/tasks/{taskId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'taskId' + '}', task_id.to_s)
510
546
 
547
+ # camelize keys of incoming `where` opts
548
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
511
549
  # query parameters
512
550
  query_params = opts[:query_params] || {}
551
+
552
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
553
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
554
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
513
555
 
514
556
  # header parameters
515
557
  header_params = opts[:header_params] || {}
@@ -583,11 +625,17 @@ module XeroRuby
583
625
  # resource path
584
626
  local_var_path = '/projects/{projectId}/tasks'.sub('{' + 'projectId' + '}', project_id.to_s)
585
627
 
628
+ # camelize keys of incoming `where` opts
629
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
586
630
  # query parameters
587
631
  query_params = opts[:query_params] || {}
588
632
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
589
633
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
590
634
  query_params[:'taskIds'] = opts[:'task_ids'] if !opts[:'task_ids'].nil?
635
+
636
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
637
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
638
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
591
639
 
592
640
  # header parameters
593
641
  header_params = opts[:header_params] || {}
@@ -675,6 +723,8 @@ module XeroRuby
675
723
  # resource path
676
724
  local_var_path = '/projects/{projectId}/time'.sub('{' + 'projectId' + '}', project_id.to_s)
677
725
 
726
+ # camelize keys of incoming `where` opts
727
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
678
728
  # query parameters
679
729
  query_params = opts[:query_params] || {}
680
730
  query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?
@@ -687,6 +737,10 @@ module XeroRuby
687
737
  query_params[:'isChargeable'] = opts[:'is_chargeable'] if !opts[:'is_chargeable'].nil?
688
738
  query_params[:'dateAfterUtc'] = opts[:'date_after_utc'] if !opts[:'date_after_utc'].nil?
689
739
  query_params[:'dateBeforeUtc'] = opts[:'date_before_utc'] if !opts[:'date_before_utc'].nil?
740
+
741
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
742
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
743
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
690
744
 
691
745
  # header parameters
692
746
  header_params = opts[:header_params] || {}
@@ -760,8 +814,14 @@ module XeroRuby
760
814
  # resource path
761
815
  local_var_path = '/projects/{projectId}/time/{timeEntryId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'timeEntryId' + '}', time_entry_id.to_s)
762
816
 
817
+ # camelize keys of incoming `where` opts
818
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
763
819
  # query parameters
764
820
  query_params = opts[:query_params] || {}
821
+
822
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
823
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
824
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
765
825
 
766
826
  # header parameters
767
827
  header_params = opts[:header_params] || {}
@@ -835,8 +895,14 @@ module XeroRuby
835
895
  # resource path
836
896
  local_var_path = '/projects/{projectId}'.sub('{' + 'projectId' + '}', project_id.to_s)
837
897
 
898
+ # camelize keys of incoming `where` opts
899
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
838
900
  # query parameters
839
901
  query_params = opts[:query_params] || {}
902
+
903
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
904
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
905
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
840
906
 
841
907
  # header parameters
842
908
  header_params = opts[:header_params] || {}
@@ -912,8 +978,14 @@ module XeroRuby
912
978
  # resource path
913
979
  local_var_path = '/projects/{projectId}'.sub('{' + 'projectId' + '}', project_id.to_s)
914
980
 
981
+ # camelize keys of incoming `where` opts
982
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
915
983
  # query parameters
916
984
  query_params = opts[:query_params] || {}
985
+
986
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
987
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
988
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
917
989
 
918
990
  # header parameters
919
991
  header_params = opts[:header_params] || {}
@@ -995,8 +1067,14 @@ module XeroRuby
995
1067
  # resource path
996
1068
  local_var_path = '/projects/{projectId}/time/{timeEntryId}'.sub('{' + 'projectId' + '}', project_id.to_s).sub('{' + 'timeEntryId' + '}', time_entry_id.to_s)
997
1069
 
1070
+ # camelize keys of incoming `where` opts
1071
+ opts[:'where'] = opts[:'where'].map{|k,v| "#{@api_client.camelize_key(k)}#{v}"}.join(' AND ') if !opts[:'where'].nil?
998
1072
  # query parameters
999
1073
  query_params = opts[:query_params] || {}
1074
+
1075
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
1076
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
1077
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
1000
1078
 
1001
1079
  # header parameters
1002
1080
  header_params = opts[:header_params] || {}
@@ -3,7 +3,7 @@
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 2.2.2
6
+ The version of the OpenAPI document: 2.2.14
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 4.3.1
@@ -176,6 +176,7 @@ module XeroRuby
176
176
  end
177
177
 
178
178
  if opts[:return_type]
179
+ prepare_file(response) if opts[:return_type] == 'File'
179
180
  data = deserialize(response, opts[:return_type])
180
181
  else
181
182
  data = nil
@@ -191,7 +192,7 @@ module XeroRuby
191
192
  # @option opts [Hash] :query_params Query parameters
192
193
  # @option opts [Hash] :form_params Query parameters
193
194
  # @option opts [Object] :body HTTP body (JSON/XML)
194
- # @return [Typhoeus::Request] A Typhoeus Request
195
+ # @return A Faraday Request
195
196
  def build_request(http_method, path, request, opts = {})
196
197
  url = build_request_url(path)
197
198
  http_method = http_method.to_sym.downcase
@@ -222,7 +223,6 @@ module XeroRuby
222
223
  request.body = req_body
223
224
  request.url url
224
225
  request.params = query_params
225
- download_file(request) if opts[:return_type] == 'File'
226
226
  request
227
227
  end
228
228
 
@@ -376,33 +376,24 @@ module XeroRuby
376
376
  # process can use.
377
377
  #
378
378
  # @see Configuration#temp_folder_path
379
- def download_file(request)
380
- tempfile = nil
381
- encoding = nil
382
- request.on_headers do |response|
383
- content_disposition = response.headers['Content-Disposition']
384
- if content_disposition && content_disposition =~ /filename=/i
385
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
386
- prefix = sanitize_filename(filename)
387
- else
388
- prefix = 'download-'
389
- end
390
- prefix = prefix + '-' unless prefix.end_with?('-')
391
- encoding = response.body.encoding
392
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
393
- @tempfile = tempfile
394
- end
395
- request.on_body do |chunk|
396
- chunk.force_encoding(encoding)
397
- tempfile.write(chunk)
398
- end
399
- request.on_complete do |response|
400
- tempfile.close if tempfile
401
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
402
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
403
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
404
- "explicitly with `tempfile.delete`"
379
+ def prepare_file(response)
380
+ content_disposition = response.headers['Content-Disposition']
381
+ if content_disposition && content_disposition =~ /filename=/i
382
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
383
+ prefix = sanitize_filename(filename)
384
+ else
385
+ prefix = 'download-'
405
386
  end
387
+ prefix = prefix + '-' unless prefix.end_with?('-')
388
+ encoding = response.body.encoding
389
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
390
+ @tempfile = tempfile
391
+ tempfile.write(response.body)
392
+ tempfile.close if tempfile
393
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
394
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
395
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
396
+ "explicitly with `tempfile.delete`"
406
397
  end
407
398
 
408
399
  # Sanitize filename by removing path.
@@ -485,12 +476,61 @@ module XeroRuby
485
476
  # @return [String] JSON string representation of the object
486
477
  def object_to_hash(obj)
487
478
  if obj.respond_to?(:to_hash)
488
- obj.to_hash
479
+ to_camel_keys(obj).to_hash
480
+ else
481
+ to_camel_keys(obj)
482
+ end
483
+ end
484
+
485
+ # START - Re-serializes snake_cased params to PascalCase required by XeroAPI
486
+ def to_camel_keys(value = self)
487
+ case value
488
+ when Array
489
+ value.map { |v| to_camel_keys(v) }
490
+ when Hash
491
+ Hash[value.map { |k, v| [camelize_key(k), to_camel_keys(v)] }]
492
+ else
493
+ value
494
+ end
495
+ end
496
+
497
+ def camelize_key(key, first_upper = true)
498
+ if key.is_a? Symbol
499
+ camelize(key.to_s, first_upper).to_sym
500
+ elsif key.is_a? String
501
+ camelize(key, first_upper)
502
+ else
503
+ key # can't camelize anything except strings and symbols
504
+ end
505
+ end
506
+
507
+ def camelize(word, first_upper = true)
508
+ if first_upper
509
+ str = word.to_s
510
+ str = gsubbed(str, /(?:^|_)([^_\s]+)/)
511
+ str = gsubbed(str, %r{/([^/]*)}, "::")
512
+ str
489
513
  else
490
- obj
514
+ parts = word.split("_", 2)
515
+ parts[0] << camelize(parts[1]) if parts.size > 1
516
+ parts[0] || ""
491
517
  end
492
518
  end
493
519
 
520
+ def gsubbed(str, pattern, extra = "")
521
+ key_map_scronyms = {}
522
+ str = str.gsub(pattern) do
523
+ extra + (key_map_scronyms[Regexp.last_match(1)] || capitalize_first(Regexp.last_match(1)))
524
+ end
525
+ str
526
+ end
527
+
528
+ def capitalize_first(word)
529
+ split = word.split('')
530
+ "#{split[0].capitalize}#{split[1..-1].join}"
531
+ end
532
+ # END - Re-serializes snake_cased params to PascalCase required by XeroAPI
533
+
494
534
  # Build parameter value according to the given collection format.
495
535
  # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
496
536
  def build_collection_param(param, collection_format)
@@ -504,7 +544,7 @@ module XeroRuby
504
544
  when :pipes
505
545
  param.join('|')
506
546
  when :multi
507
- # return the array directly as typhoeus will handle it as expected
547
+ # return the array directly as http client will handle it as expected
508
548
  param
509
549
  else
510
550
  fail "unknown collection format: #{collection_format.inspect}"