xero-ruby 2.10.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -6
  3. data/lib/xero-ruby/api/accounting_api.rb +5 -2
  4. data/lib/xero-ruby/models/accounting/account.rb +11 -7
  5. data/lib/xero-ruby/models/accounting/accounts.rb +11 -7
  6. data/lib/xero-ruby/models/accounting/accounts_payable.rb +11 -7
  7. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +11 -7
  8. data/lib/xero-ruby/models/accounting/action.rb +11 -7
  9. data/lib/xero-ruby/models/accounting/actions.rb +11 -7
  10. data/lib/xero-ruby/models/accounting/address.rb +11 -7
  11. data/lib/xero-ruby/models/accounting/address_for_organisation.rb +11 -7
  12. data/lib/xero-ruby/models/accounting/allocation.rb +11 -7
  13. data/lib/xero-ruby/models/accounting/allocations.rb +11 -7
  14. data/lib/xero-ruby/models/accounting/attachment.rb +11 -7
  15. data/lib/xero-ruby/models/accounting/attachments.rb +11 -7
  16. data/lib/xero-ruby/models/accounting/balance_details.rb +11 -7
  17. data/lib/xero-ruby/models/accounting/balances.rb +11 -7
  18. data/lib/xero-ruby/models/accounting/bank_transaction.rb +11 -7
  19. data/lib/xero-ruby/models/accounting/bank_transactions.rb +11 -7
  20. data/lib/xero-ruby/models/accounting/bank_transfer.rb +11 -7
  21. data/lib/xero-ruby/models/accounting/bank_transfers.rb +11 -7
  22. data/lib/xero-ruby/models/accounting/batch_payment.rb +11 -7
  23. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +11 -7
  24. data/lib/xero-ruby/models/accounting/batch_payments.rb +11 -7
  25. data/lib/xero-ruby/models/accounting/bill.rb +11 -7
  26. data/lib/xero-ruby/models/accounting/branding_theme.rb +11 -7
  27. data/lib/xero-ruby/models/accounting/branding_themes.rb +11 -7
  28. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +11 -7
  29. data/lib/xero-ruby/models/accounting/cis_org_settings.rb +11 -7
  30. data/lib/xero-ruby/models/accounting/cis_setting.rb +11 -7
  31. data/lib/xero-ruby/models/accounting/cis_settings.rb +11 -7
  32. data/lib/xero-ruby/models/accounting/contact.rb +11 -7
  33. data/lib/xero-ruby/models/accounting/contact_group.rb +11 -7
  34. data/lib/xero-ruby/models/accounting/contact_groups.rb +11 -7
  35. data/lib/xero-ruby/models/accounting/contact_person.rb +11 -7
  36. data/lib/xero-ruby/models/accounting/contacts.rb +11 -7
  37. data/lib/xero-ruby/models/accounting/conversion_balances.rb +11 -7
  38. data/lib/xero-ruby/models/accounting/conversion_date.rb +11 -7
  39. data/lib/xero-ruby/models/accounting/credit_note.rb +11 -7
  40. data/lib/xero-ruby/models/accounting/credit_notes.rb +11 -7
  41. data/lib/xero-ruby/models/accounting/currencies.rb +11 -7
  42. data/lib/xero-ruby/models/accounting/currency.rb +11 -7
  43. data/lib/xero-ruby/models/accounting/element.rb +11 -7
  44. data/lib/xero-ruby/models/accounting/employee.rb +11 -7
  45. data/lib/xero-ruby/models/accounting/employees.rb +11 -7
  46. data/lib/xero-ruby/models/accounting/error.rb +11 -7
  47. data/lib/xero-ruby/models/accounting/expense_claim.rb +11 -7
  48. data/lib/xero-ruby/models/accounting/expense_claims.rb +11 -7
  49. data/lib/xero-ruby/models/accounting/external_link.rb +11 -7
  50. data/lib/xero-ruby/models/accounting/history_record.rb +11 -7
  51. data/lib/xero-ruby/models/accounting/history_records.rb +11 -7
  52. data/lib/xero-ruby/models/accounting/import_summary.rb +11 -7
  53. data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +11 -7
  54. data/lib/xero-ruby/models/accounting/import_summary_object.rb +11 -7
  55. data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +11 -7
  56. data/lib/xero-ruby/models/accounting/invoice.rb +11 -7
  57. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +11 -7
  58. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +11 -7
  59. data/lib/xero-ruby/models/accounting/invoices.rb +11 -7
  60. data/lib/xero-ruby/models/accounting/item.rb +11 -7
  61. data/lib/xero-ruby/models/accounting/items.rb +11 -7
  62. data/lib/xero-ruby/models/accounting/journal.rb +11 -7
  63. data/lib/xero-ruby/models/accounting/journal_line.rb +11 -7
  64. data/lib/xero-ruby/models/accounting/journals.rb +11 -7
  65. data/lib/xero-ruby/models/accounting/line_item.rb +11 -7
  66. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +11 -7
  67. data/lib/xero-ruby/models/accounting/linked_transaction.rb +11 -7
  68. data/lib/xero-ruby/models/accounting/linked_transactions.rb +11 -7
  69. data/lib/xero-ruby/models/accounting/manual_journal.rb +11 -7
  70. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +11 -7
  71. data/lib/xero-ruby/models/accounting/manual_journals.rb +11 -7
  72. data/lib/xero-ruby/models/accounting/online_invoice.rb +11 -7
  73. data/lib/xero-ruby/models/accounting/online_invoices.rb +11 -7
  74. data/lib/xero-ruby/models/accounting/organisation.rb +11 -7
  75. data/lib/xero-ruby/models/accounting/organisations.rb +11 -7
  76. data/lib/xero-ruby/models/accounting/overpayment.rb +11 -7
  77. data/lib/xero-ruby/models/accounting/overpayments.rb +11 -7
  78. data/lib/xero-ruby/models/accounting/payment.rb +11 -7
  79. data/lib/xero-ruby/models/accounting/payment_delete.rb +11 -7
  80. data/lib/xero-ruby/models/accounting/payment_service.rb +11 -7
  81. data/lib/xero-ruby/models/accounting/payment_services.rb +11 -7
  82. data/lib/xero-ruby/models/accounting/payment_term.rb +11 -7
  83. data/lib/xero-ruby/models/accounting/payments.rb +11 -7
  84. data/lib/xero-ruby/models/accounting/phone.rb +11 -7
  85. data/lib/xero-ruby/models/accounting/prepayment.rb +24 -8
  86. data/lib/xero-ruby/models/accounting/prepayments.rb +11 -7
  87. data/lib/xero-ruby/models/accounting/purchase.rb +11 -7
  88. data/lib/xero-ruby/models/accounting/purchase_order.rb +11 -7
  89. data/lib/xero-ruby/models/accounting/purchase_orders.rb +11 -7
  90. data/lib/xero-ruby/models/accounting/quote.rb +11 -7
  91. data/lib/xero-ruby/models/accounting/quotes.rb +11 -7
  92. data/lib/xero-ruby/models/accounting/receipt.rb +11 -7
  93. data/lib/xero-ruby/models/accounting/receipts.rb +11 -7
  94. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +11 -7
  95. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +11 -7
  96. data/lib/xero-ruby/models/accounting/report.rb +11 -7
  97. data/lib/xero-ruby/models/accounting/report_attribute.rb +11 -7
  98. data/lib/xero-ruby/models/accounting/report_cell.rb +11 -7
  99. data/lib/xero-ruby/models/accounting/report_fields.rb +11 -7
  100. data/lib/xero-ruby/models/accounting/report_row.rb +11 -7
  101. data/lib/xero-ruby/models/accounting/report_rows.rb +11 -7
  102. data/lib/xero-ruby/models/accounting/report_with_row.rb +11 -7
  103. data/lib/xero-ruby/models/accounting/report_with_rows.rb +11 -7
  104. data/lib/xero-ruby/models/accounting/reports.rb +11 -7
  105. data/lib/xero-ruby/models/accounting/request_empty.rb +11 -7
  106. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +11 -7
  107. data/lib/xero-ruby/models/accounting/schedule.rb +11 -7
  108. data/lib/xero-ruby/models/accounting/setup.rb +11 -7
  109. data/lib/xero-ruby/models/accounting/tax_component.rb +11 -7
  110. data/lib/xero-ruby/models/accounting/tax_rate.rb +11 -7
  111. data/lib/xero-ruby/models/accounting/tax_rates.rb +11 -7
  112. data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +11 -7
  113. data/lib/xero-ruby/models/accounting/tracking_categories.rb +11 -7
  114. data/lib/xero-ruby/models/accounting/tracking_category.rb +11 -7
  115. data/lib/xero-ruby/models/accounting/tracking_option.rb +11 -7
  116. data/lib/xero-ruby/models/accounting/tracking_options.rb +11 -7
  117. data/lib/xero-ruby/models/accounting/user.rb +11 -7
  118. data/lib/xero-ruby/models/accounting/users.rb +11 -7
  119. data/lib/xero-ruby/models/accounting/validation_error.rb +11 -7
  120. data/lib/xero-ruby/models/assets/asset.rb +11 -7
  121. data/lib/xero-ruby/models/assets/asset_type.rb +11 -7
  122. data/lib/xero-ruby/models/assets/assets.rb +11 -7
  123. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +11 -7
  124. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +11 -7
  125. data/lib/xero-ruby/models/assets/error.rb +11 -7
  126. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +11 -7
  127. data/lib/xero-ruby/models/assets/pagination.rb +11 -7
  128. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +11 -7
  129. data/lib/xero-ruby/models/assets/setting.rb +11 -7
  130. data/lib/xero-ruby/models/files/association.rb +11 -7
  131. data/lib/xero-ruby/models/files/file_object.rb +11 -7
  132. data/lib/xero-ruby/models/files/files.rb +11 -7
  133. data/lib/xero-ruby/models/files/folder.rb +11 -7
  134. data/lib/xero-ruby/models/files/folders.rb +11 -7
  135. data/lib/xero-ruby/models/files/upload_object.rb +11 -7
  136. data/lib/xero-ruby/models/files/user.rb +11 -7
  137. data/lib/xero-ruby/models/payroll_au/account.rb +11 -7
  138. data/lib/xero-ruby/models/payroll_au/api_exception.rb +11 -7
  139. data/lib/xero-ruby/models/payroll_au/bank_account.rb +11 -7
  140. data/lib/xero-ruby/models/payroll_au/deduction_line.rb +11 -7
  141. data/lib/xero-ruby/models/payroll_au/deduction_type.rb +11 -7
  142. data/lib/xero-ruby/models/payroll_au/earnings_line.rb +11 -7
  143. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +11 -7
  144. data/lib/xero-ruby/models/payroll_au/employee.rb +11 -7
  145. data/lib/xero-ruby/models/payroll_au/employees.rb +11 -7
  146. data/lib/xero-ruby/models/payroll_au/home_address.rb +11 -7
  147. data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +11 -7
  148. data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -7
  149. data/lib/xero-ruby/models/payroll_au/leave_applications.rb +11 -7
  150. data/lib/xero-ruby/models/payroll_au/leave_balance.rb +11 -7
  151. data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +11 -7
  152. data/lib/xero-ruby/models/payroll_au/leave_line.rb +11 -7
  153. data/lib/xero-ruby/models/payroll_au/leave_lines.rb +11 -7
  154. data/lib/xero-ruby/models/payroll_au/leave_period.rb +11 -7
  155. data/lib/xero-ruby/models/payroll_au/leave_type.rb +11 -7
  156. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +11 -7
  157. data/lib/xero-ruby/models/payroll_au/pay_item.rb +11 -7
  158. data/lib/xero-ruby/models/payroll_au/pay_items.rb +11 -7
  159. data/lib/xero-ruby/models/payroll_au/pay_run.rb +11 -7
  160. data/lib/xero-ruby/models/payroll_au/pay_runs.rb +11 -7
  161. data/lib/xero-ruby/models/payroll_au/pay_template.rb +11 -7
  162. data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +11 -7
  163. data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +11 -7
  164. data/lib/xero-ruby/models/payroll_au/payslip.rb +11 -7
  165. data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +11 -7
  166. data/lib/xero-ruby/models/payroll_au/payslip_object.rb +11 -7
  167. data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +11 -7
  168. data/lib/xero-ruby/models/payroll_au/payslips.rb +11 -7
  169. data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +11 -7
  170. data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +11 -7
  171. data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +11 -7
  172. data/lib/xero-ruby/models/payroll_au/settings.rb +11 -7
  173. data/lib/xero-ruby/models/payroll_au/settings_object.rb +11 -7
  174. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +11 -7
  175. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +11 -7
  176. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +11 -7
  177. data/lib/xero-ruby/models/payroll_au/super_fund.rb +11 -7
  178. data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +11 -7
  179. data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +11 -7
  180. data/lib/xero-ruby/models/payroll_au/super_funds.rb +11 -7
  181. data/lib/xero-ruby/models/payroll_au/super_line.rb +11 -7
  182. data/lib/xero-ruby/models/payroll_au/super_membership.rb +11 -7
  183. data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +11 -7
  184. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +11 -7
  185. data/lib/xero-ruby/models/payroll_au/tax_line.rb +11 -7
  186. data/lib/xero-ruby/models/payroll_au/timesheet.rb +11 -7
  187. data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +11 -7
  188. data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +11 -7
  189. data/lib/xero-ruby/models/payroll_au/timesheets.rb +11 -7
  190. data/lib/xero-ruby/models/payroll_au/validation_error.rb +11 -7
  191. data/lib/xero-ruby/models/payroll_nz/account.rb +11 -7
  192. data/lib/xero-ruby/models/payroll_nz/accounts.rb +11 -7
  193. data/lib/xero-ruby/models/payroll_nz/address.rb +11 -7
  194. data/lib/xero-ruby/models/payroll_nz/bank_account.rb +11 -7
  195. data/lib/xero-ruby/models/payroll_nz/benefit.rb +11 -7
  196. data/lib/xero-ruby/models/payroll_nz/deduction.rb +11 -7
  197. data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +11 -7
  198. data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +11 -7
  199. data/lib/xero-ruby/models/payroll_nz/deductions.rb +11 -7
  200. data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +11 -7
  201. data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +11 -7
  202. data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +11 -7
  203. data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +11 -7
  204. data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +11 -7
  205. data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +11 -7
  206. data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +11 -7
  207. data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +11 -7
  208. data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +11 -7
  209. data/lib/xero-ruby/models/payroll_nz/employee.rb +11 -7
  210. data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +11 -7
  211. data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +11 -7
  212. data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +11 -7
  213. data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +11 -7
  214. data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +11 -7
  215. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +11 -7
  216. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +11 -7
  217. data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +11 -7
  218. data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +11 -7
  219. data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +11 -7
  220. data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +11 -7
  221. data/lib/xero-ruby/models/payroll_nz/employee_object.rb +11 -7
  222. data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +11 -7
  223. data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +11 -7
  224. data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +11 -7
  225. data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +11 -7
  226. data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +11 -7
  227. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +11 -7
  228. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +11 -7
  229. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +11 -7
  230. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +11 -7
  231. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +11 -7
  232. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +11 -7
  233. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +11 -7
  234. data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +11 -7
  235. data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +11 -7
  236. data/lib/xero-ruby/models/payroll_nz/employees.rb +11 -7
  237. data/lib/xero-ruby/models/payroll_nz/employment.rb +11 -7
  238. data/lib/xero-ruby/models/payroll_nz/employment_object.rb +11 -7
  239. data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +11 -7
  240. data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +11 -7
  241. data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +11 -7
  242. data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +11 -7
  243. data/lib/xero-ruby/models/payroll_nz/leave_period.rb +11 -7
  244. data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +11 -7
  245. data/lib/xero-ruby/models/payroll_nz/leave_type.rb +11 -7
  246. data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +11 -7
  247. data/lib/xero-ruby/models/payroll_nz/leave_types.rb +11 -7
  248. data/lib/xero-ruby/models/payroll_nz/pagination.rb +11 -7
  249. data/lib/xero-ruby/models/payroll_nz/pay_run.rb +11 -7
  250. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +11 -7
  251. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +11 -7
  252. data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +11 -7
  253. data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +11 -7
  254. data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +11 -7
  255. data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +11 -7
  256. data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +11 -7
  257. data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +11 -7
  258. data/lib/xero-ruby/models/payroll_nz/payment_line.rb +11 -7
  259. data/lib/xero-ruby/models/payroll_nz/payment_method.rb +11 -7
  260. data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +11 -7
  261. data/lib/xero-ruby/models/payroll_nz/problem.rb +11 -7
  262. data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +11 -7
  263. data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +11 -7
  264. data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +11 -7
  265. data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +11 -7
  266. data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +11 -7
  267. data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +11 -7
  268. data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +11 -7
  269. data/lib/xero-ruby/models/payroll_nz/settings.rb +11 -7
  270. data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +11 -7
  271. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +11 -7
  272. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +11 -7
  273. data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +11 -7
  274. data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +11 -7
  275. data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +11 -7
  276. data/lib/xero-ruby/models/payroll_nz/superannuations.rb +11 -7
  277. data/lib/xero-ruby/models/payroll_nz/tax_line.rb +11 -7
  278. data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +11 -7
  279. data/lib/xero-ruby/models/payroll_nz/timesheet.rb +11 -7
  280. data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +11 -7
  281. data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +11 -7
  282. data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +11 -7
  283. data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +11 -7
  284. data/lib/xero-ruby/models/payroll_nz/timesheets.rb +11 -7
  285. data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +11 -7
  286. data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +11 -7
  287. data/lib/xero-ruby/models/payroll_uk/account.rb +11 -7
  288. data/lib/xero-ruby/models/payroll_uk/accounts.rb +11 -7
  289. data/lib/xero-ruby/models/payroll_uk/address.rb +11 -7
  290. data/lib/xero-ruby/models/payroll_uk/bank_account.rb +11 -7
  291. data/lib/xero-ruby/models/payroll_uk/benefit.rb +11 -7
  292. data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +11 -7
  293. data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +11 -7
  294. data/lib/xero-ruby/models/payroll_uk/benefits.rb +11 -7
  295. data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +11 -7
  296. data/lib/xero-ruby/models/payroll_uk/deduction.rb +11 -7
  297. data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +11 -7
  298. data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +11 -7
  299. data/lib/xero-ruby/models/payroll_uk/deductions.rb +11 -7
  300. data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +11 -7
  301. data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +11 -7
  302. data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +11 -7
  303. data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +11 -7
  304. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +11 -7
  305. data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +11 -7
  306. data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +11 -7
  307. data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +11 -7
  308. data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +11 -7
  309. data/lib/xero-ruby/models/payroll_uk/employee.rb +11 -7
  310. data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +11 -7
  311. data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +11 -7
  312. data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +11 -7
  313. data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +11 -7
  314. data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +11 -7
  315. data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +11 -7
  316. data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +11 -7
  317. data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +11 -7
  318. data/lib/xero-ruby/models/payroll_uk/employee_object.rb +11 -7
  319. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +11 -7
  320. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +11 -7
  321. data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +11 -7
  322. data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +11 -7
  323. data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +11 -7
  324. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +11 -7
  325. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +11 -7
  326. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +11 -7
  327. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +11 -7
  328. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +11 -7
  329. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +11 -7
  330. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +11 -7
  331. data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +11 -7
  332. data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +11 -7
  333. data/lib/xero-ruby/models/payroll_uk/employees.rb +11 -7
  334. data/lib/xero-ruby/models/payroll_uk/employment.rb +11 -7
  335. data/lib/xero-ruby/models/payroll_uk/employment_object.rb +11 -7
  336. data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +11 -7
  337. data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +11 -7
  338. data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +11 -7
  339. data/lib/xero-ruby/models/payroll_uk/leave_period.rb +11 -7
  340. data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +11 -7
  341. data/lib/xero-ruby/models/payroll_uk/leave_type.rb +11 -7
  342. data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +11 -7
  343. data/lib/xero-ruby/models/payroll_uk/leave_types.rb +11 -7
  344. data/lib/xero-ruby/models/payroll_uk/pagination.rb +11 -7
  345. data/lib/xero-ruby/models/payroll_uk/pay_run.rb +11 -7
  346. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +11 -7
  347. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +11 -7
  348. data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +11 -7
  349. data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +11 -7
  350. data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +11 -7
  351. data/lib/xero-ruby/models/payroll_uk/payment_line.rb +11 -7
  352. data/lib/xero-ruby/models/payroll_uk/payment_method.rb +11 -7
  353. data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +11 -7
  354. data/lib/xero-ruby/models/payroll_uk/payslip.rb +11 -7
  355. data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +11 -7
  356. data/lib/xero-ruby/models/payroll_uk/payslips.rb +11 -7
  357. data/lib/xero-ruby/models/payroll_uk/problem.rb +11 -7
  358. data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +11 -7
  359. data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +11 -7
  360. data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +11 -7
  361. data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +11 -7
  362. data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +11 -7
  363. data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +11 -7
  364. data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +11 -7
  365. data/lib/xero-ruby/models/payroll_uk/settings.rb +11 -7
  366. data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +11 -7
  367. data/lib/xero-ruby/models/payroll_uk/tax_line.rb +11 -7
  368. data/lib/xero-ruby/models/payroll_uk/timesheet.rb +11 -7
  369. data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +11 -7
  370. data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +11 -7
  371. data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +11 -7
  372. data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +11 -7
  373. data/lib/xero-ruby/models/payroll_uk/timesheets.rb +11 -7
  374. data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +11 -7
  375. data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +11 -7
  376. data/lib/xero-ruby/models/projects/amount.rb +11 -7
  377. data/lib/xero-ruby/models/projects/error.rb +11 -7
  378. data/lib/xero-ruby/models/projects/pagination.rb +11 -7
  379. data/lib/xero-ruby/models/projects/project.rb +11 -7
  380. data/lib/xero-ruby/models/projects/project_create_or_update.rb +11 -7
  381. data/lib/xero-ruby/models/projects/project_patch.rb +11 -7
  382. data/lib/xero-ruby/models/projects/project_user.rb +11 -7
  383. data/lib/xero-ruby/models/projects/project_users.rb +11 -7
  384. data/lib/xero-ruby/models/projects/projects.rb +11 -7
  385. data/lib/xero-ruby/models/projects/task.rb +11 -7
  386. data/lib/xero-ruby/models/projects/task_create_or_update.rb +11 -7
  387. data/lib/xero-ruby/models/projects/tasks.rb +11 -7
  388. data/lib/xero-ruby/models/projects/time_entries.rb +11 -7
  389. data/lib/xero-ruby/models/projects/time_entry.rb +11 -7
  390. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +11 -7
  391. data/lib/xero-ruby/version.rb +2 -2
  392. data/spec/helper_methods_spec.rb +28 -0
  393. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaa8295ee798049a210f04184b5a9bd47e6c6d06b5f5e7a7197a021ca997cdf0
4
- data.tar.gz: 8048f7bc8f95742fbdf1804ed40ea6325c3f87e54d2454cea05f1c444d45558d
3
+ metadata.gz: 318fb48f176b7958600aff1846180a94028bcafd1802e7620622c5bfaa3598a9
4
+ data.tar.gz: 3d6cf058f85c0ab341932ae6ca4f838a6915a8fb2f75dcd45269cf9d5bbdeee0
5
5
  SHA512:
6
- metadata.gz: e469a609bad593d2a26dfe78a8864c7a9a067b8c2b26ae707a910a6de4c53b8a368daaff62dd3adea72159a7467cc0025d31eba39b728c00829a45329756dc3c
7
- data.tar.gz: 01d586c5e99f4ecc8bea4551d44604c09e0bb3890c8756935bc9a6905b8c5b6cf86e4aeef39c2b0d2666e44b1ff5017d6812c809629c9bdc26585fd37d944cc9
6
+ metadata.gz: 06d8ad44f3611f0d4c403916ff8f67c456225d8dca591c9ef7a25062fbcd77c638f5ffd6c408d63a0dac5307d1ecc9d5e274bdc9c22b517273363dc6859f4517
7
+ data.tar.gz: 4556718e67afd15190357406cba150b83cb901bbbfd677752a12a10053dd400167d23b7fc373a6e1dd987c2fef5be9467ddfd8b2df944e3d6180ac79a737ae12
data/README.md CHANGED
@@ -23,9 +23,6 @@ We have two sample apps showing SDK usage:
23
23
  * Login to your Xero developer [/myapps](https://developer.xero.com/myapps) dashboard & create an API application
24
24
  * Copy the credentials from your API app and store/access them using a secure ENV variable strategy
25
25
  * Resaearch and include the [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) for your app's functionality as a space-seperated list, ex. "`SCOPES="openid profile email accounting.transactions accounting.settings"`"
26
-
27
-
28
-
29
26
  ## Installation
30
27
  To install this gem to your project:
31
28
  ```
@@ -115,10 +112,10 @@ Both the `id_token` & `access_token` are JWT's, and can be decoded to see additi
115
112
  After the initial user interaction you can simply setup a xero_client by passing the whole token_set to the client.
116
113
  ```ruby
117
114
  xero_client.set_token_set(user.token_set)
118
- # or set it and refresh in same go
115
+
119
116
  xero_client.refresh_token_set(user.token_set)
120
117
  ```
121
- This sets the access_token on the client returns either the existing, or newly refreshed `token_set`. You should save in your database for the next time you need to connect to Xero's AP and repeat the process. Assuming you keep your connection live at least once per 60 days, you can persist infinite API connection assuming the user does not revoke your API access.
118
+ This sets the access_token on the client, and returns a refreshed `token_set` that you should save in your datastore for the next time you need to connect to Xero's API.
122
119
  ## Token Helpers
123
120
  ```ruby
124
121
  xero_client.token_set
@@ -228,10 +225,13 @@ accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts
228
225
  invoices = { invoices: [{ type: XeroRuby::Accounting::Invoice::ACCREC, contact: { contact_id: contacts[0].contact_id }, line_items: [{ description: "Big Agency", quantity: BigDecimal("2.0"), unit_amount: BigDecimal("50.99"), account_code: "600", tax_type: XeroRuby::Accounting::TaxType::NONE }], date: "2019-03-11", due_date: "2018-12-10", reference: "Website Design", status: XeroRuby::Accounting::Invoice::DRAFT }]}
229
226
  invoice = xero_client.accounting_api.create_invoices(tenant_id, invoices).invoices.first
230
227
 
231
- # display out all the serialized data as a hash
228
+ # display out all the serialized data as a snake_case hash
232
229
  puts invoices.to_attributes
233
230
  => {type: 'ACCREC', line_items: [...]}
234
231
 
232
+ puts invoices.to_hash(downcase: false)
233
+ => {'Type': 'ACCREC', 'LineItems': [...]}
234
+
235
235
  # Create History
236
236
  payment = xero_client.accounting_api.get_payments(tenant_id).payments.first
237
237
  history_records = { history_records: [{ details: "This payment now has some History!" }]}
@@ -7728,7 +7728,7 @@ module XeroRuby
7728
7728
  # @option opts [Array<String>] :i_ds Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
7729
7729
  # @option opts [Integer] :page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call.
7730
7730
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response
7731
- # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (default to false)
7731
+ # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (default to false)
7732
7732
  # @return [Contacts]
7733
7733
  def get_contacts(xero_tenant_id, opts = {})
7734
7734
  data, _status_code, _headers = get_contacts_with_http_info(xero_tenant_id, opts)
@@ -7744,7 +7744,7 @@ module XeroRuby
7744
7744
  # @option opts [Array<String>] :i_ds Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
7745
7745
  # @option opts [Integer] :page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call.
7746
7746
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response
7747
- # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient.
7747
+ # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient.
7748
7748
  # @return [Array<(Contacts, Integer, Hash)>] Contacts data, response status code and response headers
7749
7749
  def get_contacts_with_http_info(xero_tenant_id, options = {})
7750
7750
  opts = options.dup
@@ -9389,6 +9389,7 @@ module XeroRuby
9389
9389
  # @option opts [Integer] :page e.g. page&#x3D;1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
9390
9390
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response
9391
9391
  # @option opts [Boolean] :created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app
9392
+ # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. (default to false)
9392
9393
  # @option opts [Integer] :unitdp e.g. unitdp&#x3D;4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
9393
9394
  # @return [Invoices]
9394
9395
  def get_invoices(xero_tenant_id, opts = {})
@@ -9409,6 +9410,7 @@ module XeroRuby
9409
9410
  # @option opts [Integer] :page e.g. page&#x3D;1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
9410
9411
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response
9411
9412
  # @option opts [Boolean] :created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app
9413
+ # @option opts [Boolean] :summary_only Use summaryOnly&#x3D;true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient.
9412
9414
  # @option opts [Integer] :unitdp e.g. unitdp&#x3D;4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
9413
9415
  # @return [Array<(Invoices, Integer, Hash)>] Invoices data, response status code and response headers
9414
9416
  def get_invoices_with_http_info(xero_tenant_id, options = {})
@@ -9437,6 +9439,7 @@ module XeroRuby
9437
9439
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
9438
9440
  query_params[:'includeArchived'] = opts[:'include_archived'] if !opts[:'include_archived'].nil?
9439
9441
  query_params[:'createdByMyApp'] = opts[:'created_by_my_app'] if !opts[:'created_by_my_app'].nil?
9442
+ query_params[:'summaryOnly'] = opts[:'summary_only'] if !opts[:'summary_only'].nil?
9440
9443
  query_params[:'unitdp'] = opts[:'unitdp'] if !opts[:'unitdp'].nil?
9441
9444
 
9442
9445
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
@@ -489,7 +489,7 @@ module XeroRuby::Accounting
489
489
  value = self.send(attr)
490
490
  next if value.nil?
491
491
  key = downcase ? attr : param
492
- hash[key] = _to_hash(value)
492
+ hash[key] = _to_hash(value, downcase: downcase)
493
493
  end
494
494
  hash
495
495
  end
@@ -503,15 +503,17 @@ module XeroRuby::Accounting
503
503
  # For object, use to_hash. Otherwise, just return the value
504
504
  # @param [Object] value Any valid value
505
505
  # @return [Hash] Returns the value in the form of hash
506
- def _to_hash(value)
506
+ def _to_hash(value, downcase: false)
507
507
  if value.is_a?(Array)
508
- value.compact.map { |v| _to_hash(v) }
508
+ value.map do |v|
509
+ v.to_hash(downcase: downcase)
510
+ end
509
511
  elsif value.is_a?(Hash)
510
512
  {}.tap do |hash|
511
- value.each { |k, v| hash[k] = _to_hash(v) }
513
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
512
514
  end
513
515
  elsif value.respond_to? :to_hash
514
- value.to_hash
516
+ value.to_hash(downcase: downcase)
515
517
  else
516
518
  value
517
519
  end
@@ -519,8 +521,10 @@ module XeroRuby::Accounting
519
521
 
520
522
  def parse_date(datestring)
521
523
  if datestring.include?('Date')
522
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
523
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
524
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
525
+ original, date, timezone = *date_pattern.match(datestring)
526
+ date = (date.to_i / 1000)
527
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
524
528
  else # handle date 'types' for small subset of payroll API's
525
529
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
526
530
  end
@@ -178,7 +178,7 @@ module XeroRuby::Accounting
178
178
  value = self.send(attr)
179
179
  next if value.nil?
180
180
  key = downcase ? attr : param
181
- hash[key] = _to_hash(value)
181
+ hash[key] = _to_hash(value, downcase: downcase)
182
182
  end
183
183
  hash
184
184
  end
@@ -192,15 +192,17 @@ module XeroRuby::Accounting
192
192
  # For object, use to_hash. Otherwise, just return the value
193
193
  # @param [Object] value Any valid value
194
194
  # @return [Hash] Returns the value in the form of hash
195
- def _to_hash(value)
195
+ def _to_hash(value, downcase: false)
196
196
  if value.is_a?(Array)
197
- value.compact.map { |v| _to_hash(v) }
197
+ value.map do |v|
198
+ v.to_hash(downcase: downcase)
199
+ end
198
200
  elsif value.is_a?(Hash)
199
201
  {}.tap do |hash|
200
- value.each { |k, v| hash[k] = _to_hash(v) }
202
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
201
203
  end
202
204
  elsif value.respond_to? :to_hash
203
- value.to_hash
205
+ value.to_hash(downcase: downcase)
204
206
  else
205
207
  value
206
208
  end
@@ -208,8 +210,10 @@ module XeroRuby::Accounting
208
210
 
209
211
  def parse_date(datestring)
210
212
  if datestring.include?('Date')
211
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
212
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
213
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
214
+ original, date, timezone = *date_pattern.match(datestring)
215
+ date = (date.to_i / 1000)
216
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
213
217
  else # handle date 'types' for small subset of payroll API's
214
218
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
215
219
  end
@@ -186,7 +186,7 @@ module XeroRuby::Accounting
186
186
  value = self.send(attr)
187
187
  next if value.nil?
188
188
  key = downcase ? attr : param
189
- hash[key] = _to_hash(value)
189
+ hash[key] = _to_hash(value, downcase: downcase)
190
190
  end
191
191
  hash
192
192
  end
@@ -200,15 +200,17 @@ module XeroRuby::Accounting
200
200
  # For object, use to_hash. Otherwise, just return the value
201
201
  # @param [Object] value Any valid value
202
202
  # @return [Hash] Returns the value in the form of hash
203
- def _to_hash(value)
203
+ def _to_hash(value, downcase: false)
204
204
  if value.is_a?(Array)
205
- value.compact.map { |v| _to_hash(v) }
205
+ value.map do |v|
206
+ v.to_hash(downcase: downcase)
207
+ end
206
208
  elsif value.is_a?(Hash)
207
209
  {}.tap do |hash|
208
- value.each { |k, v| hash[k] = _to_hash(v) }
210
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
209
211
  end
210
212
  elsif value.respond_to? :to_hash
211
- value.to_hash
213
+ value.to_hash(downcase: downcase)
212
214
  else
213
215
  value
214
216
  end
@@ -216,8 +218,10 @@ module XeroRuby::Accounting
216
218
 
217
219
  def parse_date(datestring)
218
220
  if datestring.include?('Date')
219
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
220
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
221
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
222
+ original, date, timezone = *date_pattern.match(datestring)
223
+ date = (date.to_i / 1000)
224
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
221
225
  else # handle date 'types' for small subset of payroll API's
222
226
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
223
227
  end
@@ -186,7 +186,7 @@ module XeroRuby::Accounting
186
186
  value = self.send(attr)
187
187
  next if value.nil?
188
188
  key = downcase ? attr : param
189
- hash[key] = _to_hash(value)
189
+ hash[key] = _to_hash(value, downcase: downcase)
190
190
  end
191
191
  hash
192
192
  end
@@ -200,15 +200,17 @@ module XeroRuby::Accounting
200
200
  # For object, use to_hash. Otherwise, just return the value
201
201
  # @param [Object] value Any valid value
202
202
  # @return [Hash] Returns the value in the form of hash
203
- def _to_hash(value)
203
+ def _to_hash(value, downcase: false)
204
204
  if value.is_a?(Array)
205
- value.compact.map { |v| _to_hash(v) }
205
+ value.map do |v|
206
+ v.to_hash(downcase: downcase)
207
+ end
206
208
  elsif value.is_a?(Hash)
207
209
  {}.tap do |hash|
208
- value.each { |k, v| hash[k] = _to_hash(v) }
210
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
209
211
  end
210
212
  elsif value.respond_to? :to_hash
211
- value.to_hash
213
+ value.to_hash(downcase: downcase)
212
214
  else
213
215
  value
214
216
  end
@@ -216,8 +218,10 @@ module XeroRuby::Accounting
216
218
 
217
219
  def parse_date(datestring)
218
220
  if datestring.include?('Date')
219
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
220
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
221
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
222
+ original, date, timezone = *date_pattern.match(datestring)
223
+ date = (date.to_i / 1000)
224
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
221
225
  else # handle date 'types' for small subset of payroll API's
222
226
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
223
227
  end
@@ -222,7 +222,7 @@ module XeroRuby::Accounting
222
222
  value = self.send(attr)
223
223
  next if value.nil?
224
224
  key = downcase ? attr : param
225
- hash[key] = _to_hash(value)
225
+ hash[key] = _to_hash(value, downcase: downcase)
226
226
  end
227
227
  hash
228
228
  end
@@ -236,15 +236,17 @@ module XeroRuby::Accounting
236
236
  # For object, use to_hash. Otherwise, just return the value
237
237
  # @param [Object] value Any valid value
238
238
  # @return [Hash] Returns the value in the form of hash
239
- def _to_hash(value)
239
+ def _to_hash(value, downcase: false)
240
240
  if value.is_a?(Array)
241
- value.compact.map { |v| _to_hash(v) }
241
+ value.map do |v|
242
+ v.to_hash(downcase: downcase)
243
+ end
242
244
  elsif value.is_a?(Hash)
243
245
  {}.tap do |hash|
244
- value.each { |k, v| hash[k] = _to_hash(v) }
246
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
245
247
  end
246
248
  elsif value.respond_to? :to_hash
247
- value.to_hash
249
+ value.to_hash(downcase: downcase)
248
250
  else
249
251
  value
250
252
  end
@@ -252,8 +254,10 @@ module XeroRuby::Accounting
252
254
 
253
255
  def parse_date(datestring)
254
256
  if datestring.include?('Date')
255
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
256
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
257
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
258
+ original, date, timezone = *date_pattern.match(datestring)
259
+ date = (date.to_i / 1000)
260
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
257
261
  else # handle date 'types' for small subset of payroll API's
258
262
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
259
263
  end
@@ -178,7 +178,7 @@ module XeroRuby::Accounting
178
178
  value = self.send(attr)
179
179
  next if value.nil?
180
180
  key = downcase ? attr : param
181
- hash[key] = _to_hash(value)
181
+ hash[key] = _to_hash(value, downcase: downcase)
182
182
  end
183
183
  hash
184
184
  end
@@ -192,15 +192,17 @@ module XeroRuby::Accounting
192
192
  # For object, use to_hash. Otherwise, just return the value
193
193
  # @param [Object] value Any valid value
194
194
  # @return [Hash] Returns the value in the form of hash
195
- def _to_hash(value)
195
+ def _to_hash(value, downcase: false)
196
196
  if value.is_a?(Array)
197
- value.compact.map { |v| _to_hash(v) }
197
+ value.map do |v|
198
+ v.to_hash(downcase: downcase)
199
+ end
198
200
  elsif value.is_a?(Hash)
199
201
  {}.tap do |hash|
200
- value.each { |k, v| hash[k] = _to_hash(v) }
202
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
201
203
  end
202
204
  elsif value.respond_to? :to_hash
203
- value.to_hash
205
+ value.to_hash(downcase: downcase)
204
206
  else
205
207
  value
206
208
  end
@@ -208,8 +210,10 @@ module XeroRuby::Accounting
208
210
 
209
211
  def parse_date(datestring)
210
212
  if datestring.include?('Date')
211
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
212
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
213
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
214
+ original, date, timezone = *date_pattern.match(datestring)
215
+ date = (date.to_i / 1000)
216
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
213
217
  else # handle date 'types' for small subset of payroll API's
214
218
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
215
219
  end
@@ -437,7 +437,7 @@ module XeroRuby::Accounting
437
437
  value = self.send(attr)
438
438
  next if value.nil?
439
439
  key = downcase ? attr : param
440
- hash[key] = _to_hash(value)
440
+ hash[key] = _to_hash(value, downcase: downcase)
441
441
  end
442
442
  hash
443
443
  end
@@ -451,15 +451,17 @@ module XeroRuby::Accounting
451
451
  # For object, use to_hash. Otherwise, just return the value
452
452
  # @param [Object] value Any valid value
453
453
  # @return [Hash] Returns the value in the form of hash
454
- def _to_hash(value)
454
+ def _to_hash(value, downcase: false)
455
455
  if value.is_a?(Array)
456
- value.compact.map { |v| _to_hash(v) }
456
+ value.map do |v|
457
+ v.to_hash(downcase: downcase)
458
+ end
457
459
  elsif value.is_a?(Hash)
458
460
  {}.tap do |hash|
459
- value.each { |k, v| hash[k] = _to_hash(v) }
461
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
460
462
  end
461
463
  elsif value.respond_to? :to_hash
462
- value.to_hash
464
+ value.to_hash(downcase: downcase)
463
465
  else
464
466
  value
465
467
  end
@@ -467,8 +469,10 @@ module XeroRuby::Accounting
467
469
 
468
470
  def parse_date(datestring)
469
471
  if datestring.include?('Date')
470
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
471
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
472
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
473
+ original, date, timezone = *date_pattern.match(datestring)
474
+ date = (date.to_i / 1000)
475
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
472
476
  else # handle date 'types' for small subset of payroll API's
473
477
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
474
478
  end
@@ -438,7 +438,7 @@ module XeroRuby::Accounting
438
438
  value = self.send(attr)
439
439
  next if value.nil?
440
440
  key = downcase ? attr : param
441
- hash[key] = _to_hash(value)
441
+ hash[key] = _to_hash(value, downcase: downcase)
442
442
  end
443
443
  hash
444
444
  end
@@ -452,15 +452,17 @@ module XeroRuby::Accounting
452
452
  # For object, use to_hash. Otherwise, just return the value
453
453
  # @param [Object] value Any valid value
454
454
  # @return [Hash] Returns the value in the form of hash
455
- def _to_hash(value)
455
+ def _to_hash(value, downcase: false)
456
456
  if value.is_a?(Array)
457
- value.compact.map { |v| _to_hash(v) }
457
+ value.map do |v|
458
+ v.to_hash(downcase: downcase)
459
+ end
458
460
  elsif value.is_a?(Hash)
459
461
  {}.tap do |hash|
460
- value.each { |k, v| hash[k] = _to_hash(v) }
462
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
461
463
  end
462
464
  elsif value.respond_to? :to_hash
463
- value.to_hash
465
+ value.to_hash(downcase: downcase)
464
466
  else
465
467
  value
466
468
  end
@@ -468,8 +470,10 @@ module XeroRuby::Accounting
468
470
 
469
471
  def parse_date(datestring)
470
472
  if datestring.include?('Date')
471
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
472
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
473
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
474
+ original, date, timezone = *date_pattern.match(datestring)
475
+ date = (date.to_i / 1000)
476
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
473
477
  else # handle date 'types' for small subset of payroll API's
474
478
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
475
479
  end
@@ -263,7 +263,7 @@ module XeroRuby::Accounting
263
263
  value = self.send(attr)
264
264
  next if value.nil?
265
265
  key = downcase ? attr : param
266
- hash[key] = _to_hash(value)
266
+ hash[key] = _to_hash(value, downcase: downcase)
267
267
  end
268
268
  hash
269
269
  end
@@ -277,15 +277,17 @@ module XeroRuby::Accounting
277
277
  # For object, use to_hash. Otherwise, just return the value
278
278
  # @param [Object] value Any valid value
279
279
  # @return [Hash] Returns the value in the form of hash
280
- def _to_hash(value)
280
+ def _to_hash(value, downcase: false)
281
281
  if value.is_a?(Array)
282
- value.compact.map { |v| _to_hash(v) }
282
+ value.map do |v|
283
+ v.to_hash(downcase: downcase)
284
+ end
283
285
  elsif value.is_a?(Hash)
284
286
  {}.tap do |hash|
285
- value.each { |k, v| hash[k] = _to_hash(v) }
287
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
286
288
  end
287
289
  elsif value.respond_to? :to_hash
288
- value.to_hash
290
+ value.to_hash(downcase: downcase)
289
291
  else
290
292
  value
291
293
  end
@@ -293,8 +295,10 @@ module XeroRuby::Accounting
293
295
 
294
296
  def parse_date(datestring)
295
297
  if datestring.include?('Date')
296
- seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
297
- Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
298
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
299
+ original, date, timezone = *date_pattern.match(datestring)
300
+ date = (date.to_i / 1000)
301
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
298
302
  else # handle date 'types' for small subset of payroll API's
299
303
  Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
300
304
  end