xero-ruby 2.4.1 → 3.2.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 (460) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +240 -189
  3. data/lib/xero-ruby.rb +10 -4
  4. data/lib/xero-ruby/api/accounting_api.rb +1308 -920
  5. data/lib/xero-ruby/api/asset_api.rb +15 -14
  6. data/lib/xero-ruby/api/files_api.rb +204 -85
  7. data/lib/xero-ruby/api/payroll_au_api.rb +121 -93
  8. data/lib/xero-ruby/api/payroll_nz_api.rb +307 -240
  9. data/lib/xero-ruby/api/payroll_uk_api.rb +317 -254
  10. data/lib/xero-ruby/api/project_api.rb +71 -59
  11. data/lib/xero-ruby/api_client.rb +182 -128
  12. data/lib/xero-ruby/api_error.rb +4 -4
  13. data/lib/xero-ruby/configuration.rb +17 -5
  14. data/lib/xero-ruby/models/accounting/account.rb +25 -12
  15. data/lib/xero-ruby/models/accounting/account_type.rb +1 -2
  16. data/lib/xero-ruby/models/accounting/accounts.rb +25 -11
  17. data/lib/xero-ruby/models/accounting/accounts_payable.rb +25 -11
  18. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +25 -11
  19. data/lib/xero-ruby/models/accounting/action.rb +25 -11
  20. data/lib/xero-ruby/models/accounting/actions.rb +25 -11
  21. data/lib/xero-ruby/models/accounting/address.rb +27 -14
  22. data/lib/xero-ruby/models/accounting/address_for_organisation.rb +484 -0
  23. data/lib/xero-ruby/models/accounting/allocation.rb +25 -11
  24. data/lib/xero-ruby/models/accounting/allocations.rb +25 -11
  25. data/lib/xero-ruby/models/accounting/attachment.rb +25 -11
  26. data/lib/xero-ruby/models/accounting/attachments.rb +25 -11
  27. data/lib/xero-ruby/models/accounting/balance_details.rb +25 -11
  28. data/lib/xero-ruby/models/accounting/balances.rb +25 -11
  29. data/lib/xero-ruby/models/accounting/bank_transaction.rb +25 -11
  30. data/lib/xero-ruby/models/accounting/bank_transactions.rb +25 -11
  31. data/lib/xero-ruby/models/accounting/bank_transfer.rb +25 -11
  32. data/lib/xero-ruby/models/accounting/bank_transfers.rb +25 -11
  33. data/lib/xero-ruby/models/accounting/batch_payment.rb +41 -15
  34. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +25 -11
  35. data/lib/xero-ruby/models/accounting/batch_payments.rb +25 -11
  36. data/lib/xero-ruby/models/accounting/bill.rb +25 -11
  37. data/lib/xero-ruby/models/accounting/branding_theme.rb +25 -11
  38. data/lib/xero-ruby/models/accounting/branding_themes.rb +25 -11
  39. data/lib/xero-ruby/models/accounting/budget.rb +327 -0
  40. data/lib/xero-ruby/models/accounting/budget_balance.rb +267 -0
  41. data/lib/xero-ruby/models/accounting/budget_line.rb +244 -0
  42. data/lib/xero-ruby/models/{files/file_response204.rb → accounting/budgets.rb} +40 -24
  43. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +26 -12
  44. data/lib/xero-ruby/models/accounting/cis_org_settings.rb +224 -0
  45. data/lib/xero-ruby/models/accounting/cis_setting.rb +26 -12
  46. data/lib/xero-ruby/models/accounting/cis_settings.rb +25 -11
  47. data/lib/xero-ruby/models/accounting/contact.rb +25 -11
  48. data/lib/xero-ruby/models/accounting/contact_group.rb +25 -11
  49. data/lib/xero-ruby/models/accounting/contact_groups.rb +25 -11
  50. data/lib/xero-ruby/models/accounting/contact_person.rb +25 -11
  51. data/lib/xero-ruby/models/accounting/contacts.rb +25 -11
  52. data/lib/xero-ruby/models/accounting/conversion_balances.rb +25 -11
  53. data/lib/xero-ruby/models/accounting/conversion_date.rb +25 -11
  54. data/lib/xero-ruby/models/accounting/country_code.rb +1 -2
  55. data/lib/xero-ruby/models/accounting/credit_note.rb +62 -16
  56. data/lib/xero-ruby/models/accounting/credit_notes.rb +25 -11
  57. data/lib/xero-ruby/models/accounting/currencies.rb +25 -11
  58. data/lib/xero-ruby/models/accounting/currency.rb +25 -11
  59. data/lib/xero-ruby/models/accounting/currency_code.rb +1 -2
  60. data/lib/xero-ruby/models/accounting/element.rb +25 -11
  61. data/lib/xero-ruby/models/accounting/employee.rb +25 -11
  62. data/lib/xero-ruby/models/accounting/employees.rb +25 -11
  63. data/lib/xero-ruby/models/accounting/error.rb +25 -11
  64. data/lib/xero-ruby/models/accounting/expense_claim.rb +25 -11
  65. data/lib/xero-ruby/models/accounting/expense_claims.rb +25 -11
  66. data/lib/xero-ruby/models/accounting/external_link.rb +25 -11
  67. data/lib/xero-ruby/models/accounting/history_record.rb +25 -11
  68. data/lib/xero-ruby/models/accounting/history_records.rb +25 -11
  69. data/lib/xero-ruby/models/accounting/import_summary.rb +25 -11
  70. data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +33 -19
  71. data/lib/xero-ruby/models/accounting/import_summary_object.rb +25 -11
  72. data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +25 -11
  73. data/lib/xero-ruby/models/accounting/invoice.rb +37 -28
  74. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +25 -11
  75. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +25 -11
  76. data/lib/xero-ruby/models/accounting/invoices.rb +25 -11
  77. data/lib/xero-ruby/models/accounting/item.rb +25 -11
  78. data/lib/xero-ruby/models/accounting/items.rb +25 -11
  79. data/lib/xero-ruby/models/accounting/journal.rb +25 -11
  80. data/lib/xero-ruby/models/accounting/journal_line.rb +25 -11
  81. data/lib/xero-ruby/models/accounting/journals.rb +25 -11
  82. data/lib/xero-ruby/models/accounting/line_amount_types.rb +1 -2
  83. data/lib/xero-ruby/models/accounting/line_item.rb +36 -12
  84. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +25 -11
  85. data/lib/xero-ruby/models/accounting/linked_transaction.rb +25 -11
  86. data/lib/xero-ruby/models/accounting/linked_transactions.rb +25 -11
  87. data/lib/xero-ruby/models/accounting/manual_journal.rb +25 -11
  88. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +25 -11
  89. data/lib/xero-ruby/models/accounting/manual_journals.rb +25 -11
  90. data/lib/xero-ruby/models/accounting/online_invoice.rb +25 -11
  91. data/lib/xero-ruby/models/accounting/online_invoices.rb +25 -11
  92. data/lib/xero-ruby/models/accounting/organisation.rb +26 -14
  93. data/lib/xero-ruby/models/accounting/organisations.rb +25 -11
  94. data/lib/xero-ruby/models/accounting/overpayment.rb +25 -11
  95. data/lib/xero-ruby/models/accounting/overpayments.rb +25 -11
  96. data/lib/xero-ruby/models/accounting/payment.rb +36 -12
  97. data/lib/xero-ruby/models/accounting/payment_delete.rb +25 -11
  98. data/lib/xero-ruby/models/accounting/payment_service.rb +25 -11
  99. data/lib/xero-ruby/models/accounting/payment_services.rb +25 -11
  100. data/lib/xero-ruby/models/accounting/payment_term.rb +25 -11
  101. data/lib/xero-ruby/models/accounting/payment_term_type.rb +1 -2
  102. data/lib/xero-ruby/models/accounting/payments.rb +25 -11
  103. data/lib/xero-ruby/models/accounting/phone.rb +25 -11
  104. data/lib/xero-ruby/models/accounting/prepayment.rb +38 -12
  105. data/lib/xero-ruby/models/accounting/prepayments.rb +25 -11
  106. data/lib/xero-ruby/models/accounting/purchase.rb +25 -11
  107. data/lib/xero-ruby/models/accounting/purchase_order.rb +25 -11
  108. data/lib/xero-ruby/models/accounting/purchase_orders.rb +25 -11
  109. data/lib/xero-ruby/models/accounting/quote.rb +25 -11
  110. data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +1 -2
  111. data/lib/xero-ruby/models/accounting/quote_status_codes.rb +1 -2
  112. data/lib/xero-ruby/models/accounting/quotes.rb +25 -11
  113. data/lib/xero-ruby/models/accounting/receipt.rb +25 -11
  114. data/lib/xero-ruby/models/accounting/receipts.rb +25 -11
  115. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +25 -11
  116. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +25 -11
  117. data/lib/xero-ruby/models/accounting/report.rb +26 -22
  118. data/lib/xero-ruby/models/accounting/report_attribute.rb +25 -11
  119. data/lib/xero-ruby/models/accounting/report_cell.rb +25 -11
  120. data/lib/xero-ruby/models/accounting/report_fields.rb +25 -11
  121. data/lib/xero-ruby/models/accounting/report_row.rb +25 -11
  122. data/lib/xero-ruby/models/accounting/report_rows.rb +25 -11
  123. data/lib/xero-ruby/models/accounting/report_with_row.rb +26 -12
  124. data/lib/xero-ruby/models/accounting/report_with_rows.rb +25 -11
  125. data/lib/xero-ruby/models/accounting/reports.rb +25 -11
  126. data/lib/xero-ruby/models/accounting/request_empty.rb +25 -11
  127. data/lib/xero-ruby/models/accounting/row_type.rb +1 -2
  128. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +25 -11
  129. data/lib/xero-ruby/models/accounting/schedule.rb +25 -11
  130. data/lib/xero-ruby/models/accounting/setup.rb +25 -11
  131. data/lib/xero-ruby/models/accounting/tax_component.rb +25 -11
  132. data/lib/xero-ruby/models/accounting/tax_rate.rb +25 -11
  133. data/lib/xero-ruby/models/accounting/tax_rates.rb +25 -11
  134. data/lib/xero-ruby/models/accounting/tax_type.rb +1 -2
  135. data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +25 -11
  136. data/lib/xero-ruby/models/accounting/time_zone.rb +1 -2
  137. data/lib/xero-ruby/models/accounting/tracking_categories.rb +25 -11
  138. data/lib/xero-ruby/models/accounting/tracking_category.rb +25 -11
  139. data/lib/xero-ruby/models/accounting/tracking_option.rb +25 -11
  140. data/lib/xero-ruby/models/accounting/tracking_options.rb +25 -11
  141. data/lib/xero-ruby/models/accounting/user.rb +25 -11
  142. data/lib/xero-ruby/models/accounting/users.rb +25 -11
  143. data/lib/xero-ruby/models/accounting/validation_error.rb +25 -11
  144. data/lib/xero-ruby/models/assets/asset.rb +25 -11
  145. data/lib/xero-ruby/models/assets/asset_status.rb +1 -2
  146. data/lib/xero-ruby/models/assets/asset_status_query_param.rb +1 -2
  147. data/lib/xero-ruby/models/assets/asset_type.rb +25 -11
  148. data/lib/xero-ruby/models/assets/assets.rb +25 -11
  149. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +25 -11
  150. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +25 -11
  151. data/lib/xero-ruby/models/assets/error.rb +25 -11
  152. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +26 -12
  153. data/lib/xero-ruby/models/assets/pagination.rb +25 -11
  154. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +26 -12
  155. data/lib/xero-ruby/models/assets/setting.rb +25 -11
  156. data/lib/xero-ruby/models/files/association.rb +25 -11
  157. data/lib/xero-ruby/models/files/file_object.rb +25 -11
  158. data/lib/xero-ruby/models/files/files.rb +25 -11
  159. data/lib/xero-ruby/models/files/folder.rb +25 -11
  160. data/lib/xero-ruby/models/files/folders.rb +25 -11
  161. data/lib/xero-ruby/models/files/object_group.rb +1 -2
  162. data/lib/xero-ruby/models/files/object_type.rb +1 -2
  163. data/lib/xero-ruby/models/files/{inline_object.rb → upload_object.rb} +43 -14
  164. data/lib/xero-ruby/models/files/user.rb +25 -11
  165. data/lib/xero-ruby/models/payroll_au/account.rb +25 -11
  166. data/lib/xero-ruby/models/payroll_au/account_type.rb +1 -2
  167. data/lib/xero-ruby/models/payroll_au/allowance_type.rb +1 -2
  168. data/lib/xero-ruby/models/payroll_au/api_exception.rb +25 -11
  169. data/lib/xero-ruby/models/payroll_au/bank_account.rb +25 -11
  170. data/lib/xero-ruby/models/payroll_au/calendar_type.rb +1 -2
  171. data/lib/xero-ruby/models/payroll_au/deduction_line.rb +25 -16
  172. data/lib/xero-ruby/models/payroll_au/deduction_type.rb +25 -11
  173. data/lib/xero-ruby/models/payroll_au/deduction_type_calculation_type.rb +1 -2
  174. data/lib/xero-ruby/models/payroll_au/earnings_line.rb +25 -11
  175. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +25 -11
  176. data/lib/xero-ruby/models/payroll_au/earnings_rate_calculation_type.rb +1 -2
  177. data/lib/xero-ruby/models/payroll_au/earnings_type.rb +2 -2
  178. data/lib/xero-ruby/models/payroll_au/employee.rb +25 -11
  179. data/lib/xero-ruby/models/payroll_au/employee_status.rb +1 -2
  180. data/lib/xero-ruby/models/payroll_au/employees.rb +25 -11
  181. data/lib/xero-ruby/models/payroll_au/employment_basis.rb +1 -2
  182. data/lib/xero-ruby/models/payroll_au/employment_termination_payment_type.rb +1 -2
  183. data/lib/xero-ruby/models/payroll_au/entitlement_final_pay_payout_type.rb +1 -2
  184. data/lib/xero-ruby/models/payroll_au/home_address.rb +25 -11
  185. data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +25 -11
  186. data/lib/xero-ruby/models/payroll_au/leave_application.rb +25 -11
  187. data/lib/xero-ruby/models/payroll_au/leave_applications.rb +25 -11
  188. data/lib/xero-ruby/models/payroll_au/leave_balance.rb +25 -11
  189. data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +25 -11
  190. data/lib/xero-ruby/models/payroll_au/leave_line.rb +25 -11
  191. data/lib/xero-ruby/models/payroll_au/leave_line_calculation_type.rb +1 -2
  192. data/lib/xero-ruby/models/payroll_au/leave_lines.rb +25 -11
  193. data/lib/xero-ruby/models/payroll_au/leave_period.rb +25 -11
  194. data/lib/xero-ruby/models/payroll_au/leave_period_status.rb +1 -2
  195. data/lib/xero-ruby/models/payroll_au/leave_type.rb +25 -11
  196. data/lib/xero-ruby/models/payroll_au/leave_type_contribution_type.rb +1 -2
  197. data/lib/xero-ruby/models/payroll_au/manual_tax_type.rb +1 -2
  198. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +25 -11
  199. data/lib/xero-ruby/models/payroll_au/pay_item.rb +25 -11
  200. data/lib/xero-ruby/models/payroll_au/pay_items.rb +25 -11
  201. data/lib/xero-ruby/models/payroll_au/pay_run.rb +25 -11
  202. data/lib/xero-ruby/models/payroll_au/pay_run_status.rb +1 -2
  203. data/lib/xero-ruby/models/payroll_au/pay_runs.rb +25 -11
  204. data/lib/xero-ruby/models/payroll_au/pay_template.rb +25 -11
  205. data/lib/xero-ruby/models/payroll_au/payment_frequency_type.rb +1 -2
  206. data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +25 -11
  207. data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +25 -11
  208. data/lib/xero-ruby/models/payroll_au/payslip.rb +25 -11
  209. data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +25 -11
  210. data/lib/xero-ruby/models/payroll_au/payslip_object.rb +25 -11
  211. data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +25 -11
  212. data/lib/xero-ruby/models/payroll_au/payslips.rb +25 -11
  213. data/lib/xero-ruby/models/payroll_au/rate_type.rb +1 -2
  214. data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +25 -11
  215. data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +25 -11
  216. data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +25 -11
  217. data/lib/xero-ruby/models/payroll_au/residency_status.rb +1 -2
  218. data/lib/xero-ruby/models/payroll_au/settings.rb +25 -11
  219. data/lib/xero-ruby/models/payroll_au/settings_object.rb +25 -11
  220. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +25 -11
  221. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +25 -11
  222. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +25 -11
  223. data/lib/xero-ruby/models/payroll_au/state.rb +1 -2
  224. data/lib/xero-ruby/models/payroll_au/super_fund.rb +25 -11
  225. data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +25 -11
  226. data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +25 -11
  227. data/lib/xero-ruby/models/payroll_au/super_fund_type.rb +1 -2
  228. data/lib/xero-ruby/models/payroll_au/super_funds.rb +25 -11
  229. data/lib/xero-ruby/models/payroll_au/super_line.rb +26 -12
  230. data/lib/xero-ruby/models/payroll_au/super_membership.rb +26 -12
  231. data/lib/xero-ruby/models/payroll_au/superannuation_calculation_type.rb +1 -2
  232. data/lib/xero-ruby/models/payroll_au/superannuation_contribution_type.rb +1 -2
  233. data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +25 -11
  234. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +25 -11
  235. data/lib/xero-ruby/models/payroll_au/tax_line.rb +25 -11
  236. data/lib/xero-ruby/models/payroll_au/tfn_exemption_type.rb +1 -2
  237. data/lib/xero-ruby/models/payroll_au/timesheet.rb +25 -11
  238. data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +25 -11
  239. data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +25 -11
  240. data/lib/xero-ruby/models/payroll_au/timesheet_status.rb +1 -2
  241. data/lib/xero-ruby/models/payroll_au/timesheets.rb +25 -11
  242. data/lib/xero-ruby/models/payroll_au/validation_error.rb +25 -11
  243. data/lib/xero-ruby/models/payroll_nz/account.rb +24 -10
  244. data/lib/xero-ruby/models/payroll_nz/accounts.rb +24 -10
  245. data/lib/xero-ruby/models/payroll_nz/address.rb +24 -10
  246. data/lib/xero-ruby/models/payroll_nz/bank_account.rb +24 -10
  247. data/lib/xero-ruby/models/payroll_nz/benefit.rb +24 -10
  248. data/lib/xero-ruby/models/payroll_nz/calendar_type.rb +0 -1
  249. data/lib/xero-ruby/models/payroll_nz/deduction.rb +24 -10
  250. data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +24 -10
  251. data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +24 -10
  252. data/lib/xero-ruby/models/payroll_nz/deductions.rb +24 -10
  253. data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +25 -11
  254. data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +24 -10
  255. data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +24 -10
  256. data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +24 -10
  257. data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +24 -10
  258. data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +24 -10
  259. data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +24 -10
  260. data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +24 -10
  261. data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +24 -10
  262. data/lib/xero-ruby/models/payroll_nz/employee.rb +24 -10
  263. data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +24 -10
  264. data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +24 -10
  265. data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +24 -10
  266. data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +24 -10
  267. data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +24 -10
  268. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +24 -10
  269. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +24 -10
  270. data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +24 -10
  271. data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +24 -10
  272. data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +24 -10
  273. data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +24 -10
  274. data/lib/xero-ruby/models/payroll_nz/employee_object.rb +24 -10
  275. data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +24 -10
  276. data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +24 -10
  277. data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +24 -10
  278. data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +24 -10
  279. data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +24 -10
  280. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +24 -10
  281. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +24 -10
  282. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +24 -10
  283. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +24 -10
  284. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +25 -11
  285. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +24 -10
  286. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +24 -10
  287. data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +24 -10
  288. data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +24 -10
  289. data/lib/xero-ruby/models/payroll_nz/employees.rb +24 -10
  290. data/lib/xero-ruby/models/payroll_nz/employment.rb +24 -10
  291. data/lib/xero-ruby/models/payroll_nz/employment_object.rb +24 -10
  292. data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +24 -10
  293. data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +24 -10
  294. data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +24 -10
  295. data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +25 -11
  296. data/lib/xero-ruby/models/payroll_nz/leave_period.rb +24 -10
  297. data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +24 -10
  298. data/lib/xero-ruby/models/payroll_nz/leave_type.rb +24 -10
  299. data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +24 -10
  300. data/lib/xero-ruby/models/payroll_nz/leave_types.rb +24 -10
  301. data/lib/xero-ruby/models/payroll_nz/pagination.rb +24 -10
  302. data/lib/xero-ruby/models/payroll_nz/pay_run.rb +24 -10
  303. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +24 -10
  304. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +24 -10
  305. data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +24 -10
  306. data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +24 -10
  307. data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +24 -10
  308. data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +24 -10
  309. data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +24 -10
  310. data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +24 -10
  311. data/lib/xero-ruby/models/payroll_nz/payment_line.rb +24 -10
  312. data/lib/xero-ruby/models/payroll_nz/payment_method.rb +24 -10
  313. data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +24 -10
  314. data/lib/xero-ruby/models/payroll_nz/problem.rb +24 -10
  315. data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +24 -10
  316. data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +24 -10
  317. data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +24 -10
  318. data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +24 -10
  319. data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +28 -13
  320. data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +24 -10
  321. data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +24 -10
  322. data/lib/xero-ruby/models/payroll_nz/settings.rb +24 -10
  323. data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +24 -10
  324. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_category.rb +0 -1
  325. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +24 -10
  326. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +24 -10
  327. data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +24 -10
  328. data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +25 -11
  329. data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +24 -10
  330. data/lib/xero-ruby/models/payroll_nz/superannuations.rb +24 -10
  331. data/lib/xero-ruby/models/payroll_nz/tax_code.rb +0 -1
  332. data/lib/xero-ruby/models/payroll_nz/tax_line.rb +24 -10
  333. data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +24 -10
  334. data/lib/xero-ruby/models/payroll_nz/timesheet.rb +28 -13
  335. data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +25 -11
  336. data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +24 -10
  337. data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +24 -10
  338. data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +24 -10
  339. data/lib/xero-ruby/models/payroll_nz/timesheets.rb +24 -10
  340. data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +24 -10
  341. data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +24 -10
  342. data/lib/xero-ruby/models/payroll_uk/account.rb +24 -10
  343. data/lib/xero-ruby/models/payroll_uk/accounts.rb +24 -10
  344. data/lib/xero-ruby/models/payroll_uk/address.rb +24 -10
  345. data/lib/xero-ruby/models/payroll_uk/bank_account.rb +24 -10
  346. data/lib/xero-ruby/models/payroll_uk/benefit.rb +24 -10
  347. data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +24 -10
  348. data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +24 -10
  349. data/lib/xero-ruby/models/payroll_uk/benefits.rb +24 -10
  350. data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +24 -10
  351. data/lib/xero-ruby/models/payroll_uk/deduction.rb +24 -10
  352. data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +24 -10
  353. data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +24 -10
  354. data/lib/xero-ruby/models/payroll_uk/deductions.rb +24 -10
  355. data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +24 -10
  356. data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +24 -10
  357. data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +24 -10
  358. data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +24 -10
  359. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +34 -12
  360. data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +24 -10
  361. data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +24 -10
  362. data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +24 -10
  363. data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +24 -10
  364. data/lib/xero-ruby/models/payroll_uk/employee.rb +24 -10
  365. data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +24 -10
  366. data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +24 -10
  367. data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +24 -10
  368. data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +24 -10
  369. data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +24 -10
  370. data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +24 -10
  371. data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +24 -10
  372. data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +24 -10
  373. data/lib/xero-ruby/models/payroll_uk/employee_object.rb +24 -10
  374. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +24 -10
  375. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +24 -10
  376. data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +24 -10
  377. data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +24 -10
  378. data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +24 -10
  379. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +24 -10
  380. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +24 -10
  381. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +24 -10
  382. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +24 -10
  383. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +25 -11
  384. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +24 -10
  385. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +24 -10
  386. data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +24 -10
  387. data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +24 -10
  388. data/lib/xero-ruby/models/payroll_uk/employees.rb +24 -10
  389. data/lib/xero-ruby/models/payroll_uk/employment.rb +24 -10
  390. data/lib/xero-ruby/models/payroll_uk/employment_object.rb +24 -10
  391. data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +24 -10
  392. data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +24 -10
  393. data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +24 -10
  394. data/lib/xero-ruby/models/payroll_uk/leave_period.rb +24 -10
  395. data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +24 -10
  396. data/lib/xero-ruby/models/payroll_uk/leave_type.rb +24 -10
  397. data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +24 -10
  398. data/lib/xero-ruby/models/payroll_uk/leave_types.rb +24 -10
  399. data/lib/xero-ruby/models/payroll_uk/pagination.rb +24 -10
  400. data/lib/xero-ruby/models/payroll_uk/pay_run.rb +24 -10
  401. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +24 -10
  402. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +24 -10
  403. data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +24 -10
  404. data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +24 -10
  405. data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +24 -10
  406. data/lib/xero-ruby/models/payroll_uk/payment_line.rb +24 -10
  407. data/lib/xero-ruby/models/payroll_uk/payment_method.rb +24 -10
  408. data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +24 -10
  409. data/lib/xero-ruby/models/payroll_uk/payslip.rb +24 -10
  410. data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +24 -10
  411. data/lib/xero-ruby/models/payroll_uk/payslips.rb +24 -10
  412. data/lib/xero-ruby/models/payroll_uk/problem.rb +24 -10
  413. data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +24 -10
  414. data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +24 -10
  415. data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +24 -10
  416. data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +24 -10
  417. data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +27 -12
  418. data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +24 -10
  419. data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +24 -10
  420. data/lib/xero-ruby/models/payroll_uk/settings.rb +24 -10
  421. data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +24 -10
  422. data/lib/xero-ruby/models/payroll_uk/statutory_deduction_category.rb +0 -1
  423. data/lib/xero-ruby/models/payroll_uk/tax_line.rb +24 -10
  424. data/lib/xero-ruby/models/payroll_uk/timesheet.rb +25 -11
  425. data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +24 -10
  426. data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +24 -10
  427. data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +24 -10
  428. data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +24 -10
  429. data/lib/xero-ruby/models/payroll_uk/timesheets.rb +24 -10
  430. data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +24 -10
  431. data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +24 -10
  432. data/lib/xero-ruby/models/projects/amount.rb +24 -10
  433. data/lib/xero-ruby/models/projects/charge_type.rb +0 -1
  434. data/lib/xero-ruby/models/projects/currency_code.rb +0 -1
  435. data/lib/xero-ruby/models/projects/error.rb +24 -10
  436. data/lib/xero-ruby/models/projects/pagination.rb +24 -10
  437. data/lib/xero-ruby/models/projects/project.rb +24 -10
  438. data/lib/xero-ruby/models/projects/project_create_or_update.rb +24 -10
  439. data/lib/xero-ruby/models/projects/project_patch.rb +24 -10
  440. data/lib/xero-ruby/models/projects/project_status.rb +0 -1
  441. data/lib/xero-ruby/models/projects/project_user.rb +24 -10
  442. data/lib/xero-ruby/models/projects/project_users.rb +24 -10
  443. data/lib/xero-ruby/models/projects/projects.rb +24 -10
  444. data/lib/xero-ruby/models/projects/task.rb +24 -10
  445. data/lib/xero-ruby/models/projects/task_create_or_update.rb +24 -10
  446. data/lib/xero-ruby/models/projects/tasks.rb +24 -10
  447. data/lib/xero-ruby/models/projects/time_entries.rb +24 -10
  448. data/lib/xero-ruby/models/projects/time_entry.rb +27 -12
  449. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +24 -10
  450. data/lib/xero-ruby/string_serialization.rb +52 -0
  451. data/lib/xero-ruby/version.rb +3 -3
  452. data/lib/xero-ruby/where.rb +65 -0
  453. data/spec/api_client_spec.rb +292 -14
  454. data/spec/api_error_spec.rb +45 -0
  455. data/spec/configuration_spec.rb +26 -16
  456. data/spec/files/models/inline_object_spec.rb +3 -3
  457. data/spec/helper_methods_spec.rb +110 -0
  458. data/spec/where_spec.rb +82 -0
  459. metadata +43 -12
  460. data/spec/files/models/file_response204_spec.rb +0 -41
@@ -1,9 +1,8 @@
1
1
  =begin
2
- #Accounting API
2
+ #Xero Accounting API
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.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -171,38 +170,53 @@ module XeroRuby::Accounting
171
170
 
172
171
  # Returns the object in the form of hash
173
172
  # @return [Hash] Returns the object in the form of hash
174
- def to_hash
173
+ def to_hash(downcase: false)
175
174
  hash = {}
176
175
  self.class.attribute_map.each_pair do |attr, param|
177
176
  value = self.send(attr)
178
177
  next if value.nil?
179
- hash[param] = _to_hash(value)
178
+ key = downcase ? attr : param
179
+ hash[key] = _to_hash(value, downcase: downcase)
180
180
  end
181
181
  hash
182
182
  end
183
183
 
184
+ # Returns the object in the form of hash with snake_case
185
+ def to_attributes
186
+ to_hash(downcase: true)
187
+ end
188
+
184
189
  # Outputs non-array value in the form of hash
185
190
  # For object, use to_hash. Otherwise, just return the value
186
191
  # @param [Object] value Any valid value
187
192
  # @return [Hash] Returns the value in the form of hash
188
- def _to_hash(value)
193
+ def _to_hash(value, downcase: false)
189
194
  if value.is_a?(Array)
190
- value.compact.map { |v| _to_hash(v) }
195
+ value.map do |v|
196
+ v.to_hash(downcase: downcase)
197
+ end
191
198
  elsif value.is_a?(Hash)
192
199
  {}.tap do |hash|
193
- value.each { |k, v| hash[k] = _to_hash(v) }
200
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
194
201
  end
195
202
  elsif value.respond_to? :to_hash
196
- value.to_hash
203
+ value.to_hash(downcase: downcase)
197
204
  else
198
205
  value
199
206
  end
200
207
  end
201
208
 
202
- # customized data_parser
203
209
  def parse_date(datestring)
204
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
205
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
210
+ if datestring.include?('Date')
211
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
212
+ original, date, timezone = *date_pattern.match(datestring)
213
+ date = (date.to_i / 1000)
214
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
215
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
216
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
217
+ else # handle date 'types' for small subset of payroll API's
218
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
219
+ end
206
220
  end
207
221
  end
208
222
  end
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -326,38 +325,53 @@ module XeroRuby::Assets
326
325
 
327
326
  # Returns the object in the form of hash
328
327
  # @return [Hash] Returns the object in the form of hash
329
- def to_hash
328
+ def to_hash(downcase: false)
330
329
  hash = {}
331
330
  self.class.attribute_map.each_pair do |attr, param|
332
331
  value = self.send(attr)
333
332
  next if value.nil?
334
- hash[param] = _to_hash(value)
333
+ key = downcase ? attr : param
334
+ hash[key] = _to_hash(value, downcase: downcase)
335
335
  end
336
336
  hash
337
337
  end
338
338
 
339
+ # Returns the object in the form of hash with snake_case
340
+ def to_attributes
341
+ to_hash(downcase: true)
342
+ end
343
+
339
344
  # Outputs non-array value in the form of hash
340
345
  # For object, use to_hash. Otherwise, just return the value
341
346
  # @param [Object] value Any valid value
342
347
  # @return [Hash] Returns the value in the form of hash
343
- def _to_hash(value)
348
+ def _to_hash(value, downcase: false)
344
349
  if value.is_a?(Array)
345
- value.compact.map { |v| _to_hash(v) }
350
+ value.map do |v|
351
+ v.to_hash(downcase: downcase)
352
+ end
346
353
  elsif value.is_a?(Hash)
347
354
  {}.tap do |hash|
348
- value.each { |k, v| hash[k] = _to_hash(v) }
355
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
349
356
  end
350
357
  elsif value.respond_to? :to_hash
351
- value.to_hash
358
+ value.to_hash(downcase: downcase)
352
359
  else
353
360
  value
354
361
  end
355
362
  end
356
363
 
357
- # customized data_parser
358
364
  def parse_date(datestring)
359
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
360
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
365
+ if datestring.include?('Date')
366
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
367
+ original, date, timezone = *date_pattern.match(datestring)
368
+ date = (date.to_i / 1000)
369
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
370
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
371
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
372
+ else # handle date 'types' for small subset of payroll API's
373
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
374
+ end
361
375
  end
362
376
  end
363
377
  end
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -241,38 +240,53 @@ module XeroRuby::Assets
241
240
 
242
241
  # Returns the object in the form of hash
243
242
  # @return [Hash] Returns the object in the form of hash
244
- def to_hash
243
+ def to_hash(downcase: false)
245
244
  hash = {}
246
245
  self.class.attribute_map.each_pair do |attr, param|
247
246
  value = self.send(attr)
248
247
  next if value.nil?
249
- hash[param] = _to_hash(value)
248
+ key = downcase ? attr : param
249
+ hash[key] = _to_hash(value, downcase: downcase)
250
250
  end
251
251
  hash
252
252
  end
253
253
 
254
+ # Returns the object in the form of hash with snake_case
255
+ def to_attributes
256
+ to_hash(downcase: true)
257
+ end
258
+
254
259
  # Outputs non-array value in the form of hash
255
260
  # For object, use to_hash. Otherwise, just return the value
256
261
  # @param [Object] value Any valid value
257
262
  # @return [Hash] Returns the value in the form of hash
258
- def _to_hash(value)
263
+ def _to_hash(value, downcase: false)
259
264
  if value.is_a?(Array)
260
- value.compact.map { |v| _to_hash(v) }
265
+ value.map do |v|
266
+ v.to_hash(downcase: downcase)
267
+ end
261
268
  elsif value.is_a?(Hash)
262
269
  {}.tap do |hash|
263
- value.each { |k, v| hash[k] = _to_hash(v) }
270
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
264
271
  end
265
272
  elsif value.respond_to? :to_hash
266
- value.to_hash
273
+ value.to_hash(downcase: downcase)
267
274
  else
268
275
  value
269
276
  end
270
277
  end
271
278
 
272
- # customized data_parser
273
279
  def parse_date(datestring)
274
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
275
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
280
+ if datestring.include?('Date')
281
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
282
+ original, date, timezone = *date_pattern.match(datestring)
283
+ date = (date.to_i / 1000)
284
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
285
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
286
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
287
+ else # handle date 'types' for small subset of payroll API's
288
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
289
+ end
276
290
  end
277
291
  end
278
292
  end
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -183,38 +182,53 @@ module XeroRuby::Assets
183
182
 
184
183
  # Returns the object in the form of hash
185
184
  # @return [Hash] Returns the object in the form of hash
186
- def to_hash
185
+ def to_hash(downcase: false)
187
186
  hash = {}
188
187
  self.class.attribute_map.each_pair do |attr, param|
189
188
  value = self.send(attr)
190
189
  next if value.nil?
191
- hash[param] = _to_hash(value)
190
+ key = downcase ? attr : param
191
+ hash[key] = _to_hash(value, downcase: downcase)
192
192
  end
193
193
  hash
194
194
  end
195
195
 
196
+ # Returns the object in the form of hash with snake_case
197
+ def to_attributes
198
+ to_hash(downcase: true)
199
+ end
200
+
196
201
  # Outputs non-array value in the form of hash
197
202
  # For object, use to_hash. Otherwise, just return the value
198
203
  # @param [Object] value Any valid value
199
204
  # @return [Hash] Returns the value in the form of hash
200
- def _to_hash(value)
205
+ def _to_hash(value, downcase: false)
201
206
  if value.is_a?(Array)
202
- value.compact.map { |v| _to_hash(v) }
207
+ value.map do |v|
208
+ v.to_hash(downcase: downcase)
209
+ end
203
210
  elsif value.is_a?(Hash)
204
211
  {}.tap do |hash|
205
- value.each { |k, v| hash[k] = _to_hash(v) }
212
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
206
213
  end
207
214
  elsif value.respond_to? :to_hash
208
- value.to_hash
215
+ value.to_hash(downcase: downcase)
209
216
  else
210
217
  value
211
218
  end
212
219
  end
213
220
 
214
- # customized data_parser
215
221
  def parse_date(datestring)
216
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
217
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
222
+ if datestring.include?('Date')
223
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
224
+ original, date, timezone = *date_pattern.match(datestring)
225
+ date = (date.to_i / 1000)
226
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
227
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
228
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
229
+ else # handle date 'types' for small subset of payroll API's
230
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
231
+ end
218
232
  end
219
233
  end
220
234
  end
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -231,38 +230,53 @@ module XeroRuby::Assets
231
230
 
232
231
  # Returns the object in the form of hash
233
232
  # @return [Hash] Returns the object in the form of hash
234
- def to_hash
233
+ def to_hash(downcase: false)
235
234
  hash = {}
236
235
  self.class.attribute_map.each_pair do |attr, param|
237
236
  value = self.send(attr)
238
237
  next if value.nil?
239
- hash[param] = _to_hash(value)
238
+ key = downcase ? attr : param
239
+ hash[key] = _to_hash(value, downcase: downcase)
240
240
  end
241
241
  hash
242
242
  end
243
243
 
244
+ # Returns the object in the form of hash with snake_case
245
+ def to_attributes
246
+ to_hash(downcase: true)
247
+ end
248
+
244
249
  # Outputs non-array value in the form of hash
245
250
  # For object, use to_hash. Otherwise, just return the value
246
251
  # @param [Object] value Any valid value
247
252
  # @return [Hash] Returns the value in the form of hash
248
- def _to_hash(value)
253
+ def _to_hash(value, downcase: false)
249
254
  if value.is_a?(Array)
250
- value.compact.map { |v| _to_hash(v) }
255
+ value.map do |v|
256
+ v.to_hash(downcase: downcase)
257
+ end
251
258
  elsif value.is_a?(Hash)
252
259
  {}.tap do |hash|
253
- value.each { |k, v| hash[k] = _to_hash(v) }
260
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
254
261
  end
255
262
  elsif value.respond_to? :to_hash
256
- value.to_hash
263
+ value.to_hash(downcase: downcase)
257
264
  else
258
265
  value
259
266
  end
260
267
  end
261
268
 
262
- # customized data_parser
263
269
  def parse_date(datestring)
264
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
265
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
270
+ if datestring.include?('Date')
271
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
272
+ original, date, timezone = *date_pattern.match(datestring)
273
+ date = (date.to_i / 1000)
274
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
275
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
276
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
277
+ else # handle date 'types' for small subset of payroll API's
278
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
279
+ end
266
280
  end
267
281
  end
268
282
  end
@@ -1,9 +1,8 @@
1
1
  =begin
2
2
  #Xero Assets API
3
3
 
4
- #This is the Xero Assets API
4
+ #The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
5
5
 
6
- The version of the OpenAPI document: 2.6.0
7
6
  Contact: api@xero.com
8
7
  Generated by: https://openapi-generator.tech
9
8
  OpenAPI Generator version: 4.3.1
@@ -310,38 +309,53 @@ module XeroRuby::Assets
310
309
 
311
310
  # Returns the object in the form of hash
312
311
  # @return [Hash] Returns the object in the form of hash
313
- def to_hash
312
+ def to_hash(downcase: false)
314
313
  hash = {}
315
314
  self.class.attribute_map.each_pair do |attr, param|
316
315
  value = self.send(attr)
317
316
  next if value.nil?
318
- hash[param] = _to_hash(value)
317
+ key = downcase ? attr : param
318
+ hash[key] = _to_hash(value, downcase: downcase)
319
319
  end
320
320
  hash
321
321
  end
322
322
 
323
+ # Returns the object in the form of hash with snake_case
324
+ def to_attributes
325
+ to_hash(downcase: true)
326
+ end
327
+
323
328
  # Outputs non-array value in the form of hash
324
329
  # For object, use to_hash. Otherwise, just return the value
325
330
  # @param [Object] value Any valid value
326
331
  # @return [Hash] Returns the value in the form of hash
327
- def _to_hash(value)
332
+ def _to_hash(value, downcase: false)
328
333
  if value.is_a?(Array)
329
- value.compact.map { |v| _to_hash(v) }
334
+ value.map do |v|
335
+ v.to_hash(downcase: downcase)
336
+ end
330
337
  elsif value.is_a?(Hash)
331
338
  {}.tap do |hash|
332
- value.each { |k, v| hash[k] = _to_hash(v) }
339
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
333
340
  end
334
341
  elsif value.respond_to? :to_hash
335
- value.to_hash
342
+ value.to_hash(downcase: downcase)
336
343
  else
337
344
  value
338
345
  end
339
346
  end
340
347
 
341
- # customized data_parser
342
348
  def parse_date(datestring)
343
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
344
- return Time.at(seconds_since_epoch).strftime('%Y-%m-%dT%l:%M:%S%z').to_s
349
+ if datestring.include?('Date')
350
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
351
+ original, date, timezone = *date_pattern.match(datestring)
352
+ date = (date.to_i / 1000)
353
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
354
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
355
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
356
+ else # handle date 'types' for small subset of payroll API's
357
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
358
+ end
345
359
  end
346
360
  end
347
361
  end