xero-ruby 2.4.1 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe XeroRuby::ApiError do
4
+ context 'initialization' do
5
+ it 'returns default error message' do
6
+ api_error = XeroRuby::ApiError.new
7
+ expect(api_error.message).to eq("Error message: the server returns an error")
8
+ end
9
+
10
+ it 'returns error message from json array' do
11
+ error_body = {
12
+ "ErrorNumber": 10,
13
+ "Type": "ValidationException",
14
+ "Message": "A validation exception occurred",
15
+ "Elements": [
16
+ {
17
+ "ValidationErrors": [
18
+ {
19
+ "Message": "The TaxType code NONE does not exist or cannot be used for this type of transaction."
20
+ }
21
+ ],
22
+ "Warnings": [
23
+ {
24
+ "Message": "Account code '600' has been removed as it does not match a recognised account."
25
+ }
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ api_error = XeroRuby::ApiError.new(
31
+ :code => 400,
32
+ :response_headers => {"content-type"=>"application/json; charset=utf-8", "content-length"=>"1700", "server"=>"nginx", "xero-correlation-id"=>"31e2c94e-3ae4-402a-a374-b7a94ef9445c", "x-appminlimit-remaining"=>"9988", "x-minlimit-remaining"=>"58", "x-daylimit-remaining"=>"4998", "expires"=>"Fri, 18 Dec 2020 17:56:29 GMT", "cache-control"=>"max-age=0, no-cache, no-store", "pragma"=>"no-cache", "date"=>"Fri, 18 Dec 2020 17:56:29 GMT", "connection"=>"close", "x-client-tls-ver"=>"tls1.3"},
33
+ :response_body => error_body
34
+ )
35
+ expect(api_error.message).to include("The TaxType code NONE does not exist or cannot be used for this type of transaction")
36
+ expect(api_error.message).to include("Account code '600' has been removed as it does not match a recognised account.")
37
+ end
38
+
39
+ it 'returns error message when message is simple string' do
40
+ error_body = "Timeout error"
41
+ api_error = XeroRuby::ApiError.new(error_body)
42
+ expect(api_error.message).to include(error_body)
43
+ end
44
+ end
45
+ end
@@ -1,15 +1,3 @@
1
- =begin
2
- #Accounting API
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: 2.1.3
7
- Contact: api@xero.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
10
-
11
- =end
12
-
13
1
  require 'spec_helper'
14
2
 
15
3
  describe XeroRuby::Configuration do
@@ -17,10 +5,32 @@ describe XeroRuby::Configuration do
17
5
 
18
6
  describe 'urls' do
19
7
  it 'should have the default value' do
20
- expect(config.login_url).to eq("https://login.xero.com/identity/connect/authorize")
21
- expect(config.token_url).to eq("https://identity.xero.com/connect/token")
22
- expect(config.accounting_url).to eq("https://api.xero.com/api.xro/2.0")
23
- expect(config.asset_url).to eq("https://api.xero.com/assets.xro/1.0")
8
+ expect(config.login_url).to eq('https://login.xero.com/identity/connect/authorize')
9
+ expect(config.token_url).to eq('https://identity.xero.com/connect')
10
+ expect(config.accounting_url).to eq('https://api.xero.com/api.xro/2.0')
11
+ expect(config.asset_url).to eq('https://api.xero.com/assets.xro/1.0')
12
+ expect(config.project_url).to eq('https://api.xero.com/projects.xro/2.0/')
13
+ expect(config.files_url).to eq('https://api.xero.com/files.xro/1.0/')
14
+ expect(config.payroll_au_url).to eq('https://api.xero.com/payroll.xro/1.0/')
15
+ expect(config.payroll_nz_url).to eq('https://api.xero.com/payroll.xro/2.0/')
16
+ expect(config.payroll_uk_url).to eq('https://api.xero.com/payroll.xro/2.0/')
17
+ end
18
+ end
19
+
20
+ describe 'config' do
21
+ it 'should apply the default configuration options' do
22
+ client = XeroRuby::ApiClient.new(credentials: {})
23
+ expect(client.config.login_url).to eq('https://login.xero.com/identity/connect/authorize')
24
+ end
25
+
26
+ it 'should allow you to overwrite the default configuration options' do
27
+ client = XeroRuby::ApiClient.new(credentials: {}, config: {login_url: 'ngrok.login.xero.test'})
28
+ expect(client.config.login_url).to eq('ngrok.login.xero.test')
29
+ end
30
+
31
+ it 'should allow you to set the timeout config option' do
32
+ client = XeroRuby::ApiClient.new(credentials: {}, config: {timeout: 30})
33
+ expect(client.config.timeout).to eq(30)
24
34
  end
25
35
  end
26
36
  end
@@ -14,13 +14,13 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for XeroRuby::Files::InlineObject
17
+ # Unit tests for XeroRuby::Files::FileObject
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe 'InlineObject' do
21
21
  before do
22
22
  # run before each test
23
- @instance = XeroRuby::Files::InlineObject.new
23
+ @instance = XeroRuby::Files::FileObject.new
24
24
  end
25
25
 
26
26
  after do
@@ -29,7 +29,7 @@ describe 'InlineObject' do
29
29
 
30
30
  describe 'test an instance of InlineObject' do
31
31
  it 'should create an instance of InlineObject' do
32
- expect(@instance).to be_instance_of(XeroRuby::Files::InlineObject)
32
+ expect(@instance).to be_instance_of(XeroRuby::Files::FileObject)
33
33
  end
34
34
  end
35
35
  describe 'test attribute "body"' do
@@ -0,0 +1,110 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'shared helper methods' do
4
+
5
+ describe '#parse_date' do
6
+ let(:model_instance) {XeroRuby::Accounting::Account.new}
7
+
8
+ it 'can parse from ms date with backslash' do
9
+ datestring = "\/Date(1519851689297+0000)\/"
10
+ date = model_instance.parse_date(datestring)
11
+ expect(date).to eq('2018-02-28T21:01:29+0000')
12
+ end
13
+
14
+ it 'can parse from a MS date without extra backslashes' do
15
+ datestring = "/Date(1285721714157+0000)/"
16
+ date = model_instance.parse_date(datestring)
17
+ expect(date).to eq('2010-09-29T00:55:14+0000')
18
+ end
19
+
20
+ describe 'valid UTC strings (from some payroll apis)' do
21
+ it 'can parse from a utc string' do
22
+ datestring = "2020-05-08T17:44:30"
23
+ date = model_instance.parse_date(datestring)
24
+ expect(date).to eq('2020-05-08T17:44:30')
25
+ end
26
+
27
+ it 'can parse with a timezone to correct UTC day' do
28
+ datestring = "2020-11-05T19:14:49.4084255"
29
+ date = model_instance.parse_date(datestring)
30
+ expect(date).to eq('2020-11-05T19:14:49')
31
+ end
32
+
33
+ it 'valid utc strings drop timezone' do
34
+ datestring = "2020-06-02T18:47:26"
35
+ date = model_instance.parse_date(datestring)
36
+ expect(date).to eq(datestring)
37
+ end
38
+ end
39
+ end
40
+
41
+ describe '#to_hash' do
42
+ let(:invoice) {
43
+ XeroRuby::Accounting::Invoice.new(
44
+ type: 'ACCPAY',
45
+ total_discount: 100,
46
+ invoice_number: 'abc-123',
47
+ currency_code: 'USD'
48
+ )
49
+ }
50
+
51
+ let(:contact) {
52
+ XeroRuby::Accounting::Contact.new(
53
+ account_number: 'abc-123',
54
+ contact_status: XeroRuby::Accounting::Contact::ACTIVE,
55
+ name: 'Contact Name',
56
+ first_name: 'Contact',
57
+ last_name: 'Name',
58
+ email_address: 'email@gmail.com'
59
+ )
60
+ }
61
+
62
+ let(:contact_capitalized_with_nested_objects) {
63
+ XeroRuby::Accounting::Contact.new({
64
+ has_attachments: false,
65
+ has_validation_errors: false,
66
+ phones: [
67
+ XeroRuby::Accounting::Phone.new({
68
+ phone_type: "MOBILE",
69
+ phone_number: "555-1212",
70
+ phone_area_code: "415"
71
+ })
72
+ ]
73
+ })
74
+ }
75
+
76
+ describe '#to_hash' do
77
+ it 'can serialize invoice attributes into a PascalCase hash' do
78
+ expect(invoice.to_hash).to eq(:CurrencyCode => "USD", :HasAttachments => false, :HasErrors => false, :InvoiceNumber => "abc-123", :TotalDiscount => 100, :Type => "ACCPAY")
79
+ end
80
+
81
+ it 'can serialize contact attributes into a PascalCase hash' do
82
+ expect(contact.to_hash).to eq(:AccountNumber => "abc-123", :ContactStatus => "ACTIVE", :EmailAddress => "email@gmail.com", :FirstName => "Contact", :HasAttachments => false, :HasValidationErrors => false, :LastName => "Name", :Name => "Contact Name")
83
+ end
84
+ end
85
+
86
+ describe '#attributes' do
87
+ it 'can serialize invoice attributes into a snake_case hash' do
88
+ expect(invoice.to_attributes).to eq({currency_code: "USD", has_attachments: false, has_errors: false, invoice_number: "abc-123", total_discount: 100, type: "ACCPAY"})
89
+ end
90
+
91
+ it 'can serialize contact attributes into a snake_case hash' do
92
+ expect(contact.to_attributes).to eq({account_number: "abc-123", contact_status: "ACTIVE", email_address: "email@gmail.com", first_name: 'Contact', has_attachments: false, has_validation_errors: false, last_name: "Name", name: "Contact Name"})
93
+ end
94
+
95
+ it 'can serialize nested attributes into a snake_case hash' do
96
+ expect(contact_capitalized_with_nested_objects.to_attributes).to eq({
97
+ has_attachments: false,
98
+ has_validation_errors: false,
99
+ phones: [
100
+ {
101
+ phone_type: "MOBILE",
102
+ phone_number: "555-1212",
103
+ phone_area_code: "415"
104
+ }
105
+ ]
106
+ })
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe XeroRuby::Where do
4
+ let(:query) { described_class.new(opts) }
5
+
6
+ subject { query.to_param }
7
+
8
+ describe "arrays" do
9
+ describe "a simple equality test" do
10
+ let(:opts) { { test_field: ['=', 'test'] } }
11
+
12
+ it { is_expected.to eq %{TestField = "test"} }
13
+ end
14
+
15
+ describe "a test with a date" do
16
+ let(:opts) { { test: ['=', Date.parse('2020-02-01')] } }
17
+
18
+ it { is_expected.to eq %{Test = DateTime(2020,02,01)} }
19
+ end
20
+
21
+ describe "multiple options" do
22
+ let(:opts) { { a: ['=', 1], b: ['=', 2] } }
23
+
24
+ it { is_expected.to eq %{A = 1 AND B = 2} }
25
+ end
26
+
27
+ describe "special keys" do
28
+ let(:opts) { { contact_id: 3, contact_number: 4 } }
29
+
30
+ it { is_expected.to eq %{Contact.ContactID 3 AND Contact.ContactNumber 4} }
31
+ end
32
+
33
+ describe "string functions" do
34
+ let(:opts) { { name: ['Contains', 'ero'] } }
35
+
36
+ it { is_expected.to eq %{Name.Contains("ero")} }
37
+ end
38
+
39
+ describe "special characters in the search string" do
40
+ let(:opts) { { a: ['=', 'quote"quote'] } }
41
+
42
+ it { is_expected.to eq %{A = "quote""quote"} }
43
+ end
44
+
45
+ describe "numbers" do
46
+ let(:opts) { { a: ['=', 10], b: ['=', 20.5] } }
47
+
48
+ it { is_expected.to eq %{A = 10 AND B = 20.5} }
49
+ end
50
+
51
+ describe "booleans" do
52
+ let(:opts) { { a: ['=', false], b: ['=', true] } }
53
+
54
+ it { is_expected.to eq %{A = false AND B = true} }
55
+ end
56
+
57
+ describe "UUIDs" do
58
+ let (:opts) { { a: ['=', '62c54cf8-eb9a-450e-8ca2-bb1fa9237940'] } }
59
+
60
+ it { is_expected.to eq %{A = guid("62c54cf8-eb9a-450e-8ca2-bb1fa9237940")} }
61
+ end
62
+ end
63
+
64
+ describe "ranges" do
65
+ let(:range) { Date.parse('2020-02-01')..Date.parse('2020-02-15') }
66
+ let(:opts) { { a: range } }
67
+
68
+ it { is_expected.to eq %{A >= DateTime(2020,02,01) AND A <= DateTime(2020,02,15)} }
69
+ end
70
+
71
+ describe "operators starting with a dot" do
72
+ let(:opts) { {a: '.Test("Hello")' } }
73
+
74
+ it { is_expected.to eq %{A.Test("Hello")} }
75
+ end
76
+
77
+ describe "unmatched operators" do
78
+ let(:opts) { {a: 'something unusual'} }
79
+
80
+ it { is_expected.to eq %{A something unusual} }
81
+ end
82
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xero-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xero API Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-05 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: '1.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.0.1
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.1
29
+ version: '1.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.1
@@ -50,6 +50,26 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.1.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: json-jwt
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.5'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.5.2
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.5'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.5.2
53
73
  - !ruby/object:Gem::Dependency
54
74
  name: rspec
55
75
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +117,7 @@ files:
97
117
  - lib/xero-ruby/models/accounting/action.rb
98
118
  - lib/xero-ruby/models/accounting/actions.rb
99
119
  - lib/xero-ruby/models/accounting/address.rb
120
+ - lib/xero-ruby/models/accounting/address_for_organisation.rb
100
121
  - lib/xero-ruby/models/accounting/allocation.rb
101
122
  - lib/xero-ruby/models/accounting/allocations.rb
102
123
  - lib/xero-ruby/models/accounting/attachment.rb
@@ -113,7 +134,12 @@ files:
113
134
  - lib/xero-ruby/models/accounting/bill.rb
114
135
  - lib/xero-ruby/models/accounting/branding_theme.rb
115
136
  - lib/xero-ruby/models/accounting/branding_themes.rb
137
+ - lib/xero-ruby/models/accounting/budget.rb
138
+ - lib/xero-ruby/models/accounting/budget_balance.rb
139
+ - lib/xero-ruby/models/accounting/budget_line.rb
140
+ - lib/xero-ruby/models/accounting/budgets.rb
116
141
  - lib/xero-ruby/models/accounting/cis_org_setting.rb
142
+ - lib/xero-ruby/models/accounting/cis_org_settings.rb
117
143
  - lib/xero-ruby/models/accounting/cis_setting.rb
118
144
  - lib/xero-ruby/models/accounting/cis_settings.rb
119
145
  - lib/xero-ruby/models/accounting/contact.rb
@@ -227,13 +253,12 @@ files:
227
253
  - lib/xero-ruby/models/assets/setting.rb
228
254
  - lib/xero-ruby/models/files/association.rb
229
255
  - lib/xero-ruby/models/files/file_object.rb
230
- - lib/xero-ruby/models/files/file_response204.rb
231
256
  - lib/xero-ruby/models/files/files.rb
232
257
  - lib/xero-ruby/models/files/folder.rb
233
258
  - lib/xero-ruby/models/files/folders.rb
234
- - lib/xero-ruby/models/files/inline_object.rb
235
259
  - lib/xero-ruby/models/files/object_group.rb
236
260
  - lib/xero-ruby/models/files/object_type.rb
261
+ - lib/xero-ruby/models/files/upload_object.rb
237
262
  - lib/xero-ruby/models/files/user.rb
238
263
  - lib/xero-ruby/models/payroll_au/account.rb
239
264
  - lib/xero-ruby/models/payroll_au/account_type.rb
@@ -520,7 +545,9 @@ files:
520
545
  - lib/xero-ruby/models/projects/time_entries.rb
521
546
  - lib/xero-ruby/models/projects/time_entry.rb
522
547
  - lib/xero-ruby/models/projects/time_entry_create_or_update.rb
548
+ - lib/xero-ruby/string_serialization.rb
523
549
  - lib/xero-ruby/version.rb
550
+ - lib/xero-ruby/where.rb
524
551
  - spec/accounting/api/accounting_api_spec.rb
525
552
  - spec/accounting/models/account_spec.rb
526
553
  - spec/accounting/models/account_type_spec.rb
@@ -637,6 +664,7 @@ files:
637
664
  - spec/accounting/models/users_spec.rb
638
665
  - spec/accounting/models/validation_error_spec.rb
639
666
  - spec/api_client_spec.rb
667
+ - spec/api_error_spec.rb
640
668
  - spec/assets/api/asset_api_spec.rb
641
669
  - spec/assets/models/asset_spec.rb
642
670
  - spec/assets/models/asset_status_query_param_spec.rb
@@ -654,7 +682,6 @@ files:
654
682
  - spec/files/api/files_api_spec.rb
655
683
  - spec/files/models/association_spec.rb
656
684
  - spec/files/models/file_object_spec.rb
657
- - spec/files/models/file_response204_spec.rb
658
685
  - spec/files/models/files_spec.rb
659
686
  - spec/files/models/folder_spec.rb
660
687
  - spec/files/models/folders_spec.rb
@@ -662,6 +689,7 @@ files:
662
689
  - spec/files/models/object_group_spec.rb
663
690
  - spec/files/models/object_type_spec.rb
664
691
  - spec/files/models/user_spec.rb
692
+ - spec/helper_methods_spec.rb
665
693
  - spec/payroll_au/api/payroll_au_api_spec.rb
666
694
  - spec/payroll_au/models/account_spec.rb
667
695
  - spec/payroll_au/models/account_type_spec.rb
@@ -951,11 +979,12 @@ files:
951
979
  - spec/projects/models/time_entry_create_or_update_spec.rb
952
980
  - spec/projects/models/time_entry_spec.rb
953
981
  - spec/spec_helper.rb
982
+ - spec/where_spec.rb
954
983
  homepage: https://developer.xero.com
955
984
  licenses:
956
985
  - Unlicense
957
986
  metadata: {}
958
- post_install_message:
987
+ post_install_message:
959
988
  rdoc_options: []
960
989
  require_paths:
961
990
  - lib
@@ -971,9 +1000,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
971
1000
  version: '0'
972
1001
  requirements: []
973
1002
  rubygems_version: 3.1.2
974
- signing_key:
1003
+ signing_key:
975
1004
  specification_version: 4
976
- summary: Accounting API Ruby Gem
1005
+ summary: Xero Accounting API Ruby Gem
977
1006
  test_files:
978
1007
  - spec/accounting/models/bank_transfer_spec.rb
979
1008
  - spec/accounting/models/error_spec.rb
@@ -1091,6 +1120,7 @@ test_files:
1091
1120
  - spec/accounting/models/items_spec.rb
1092
1121
  - spec/accounting/api/accounting_api_spec.rb
1093
1122
  - spec/api_client_spec.rb
1123
+ - spec/api_error_spec.rb
1094
1124
  - spec/assets/models/book_depreciation_detail_spec.rb
1095
1125
  - spec/assets/models/error_spec.rb
1096
1126
  - spec/assets/models/field_validation_errors_element_spec.rb
@@ -1110,12 +1140,12 @@ test_files:
1110
1140
  - spec/files/models/object_group_spec.rb
1111
1141
  - spec/files/models/folder_spec.rb
1112
1142
  - spec/files/models/files_spec.rb
1113
- - spec/files/models/file_response204_spec.rb
1114
1143
  - spec/files/models/inline_object_spec.rb
1115
1144
  - spec/files/models/object_type_spec.rb
1116
1145
  - spec/files/models/association_spec.rb
1117
1146
  - spec/files/models/user_spec.rb
1118
1147
  - spec/files/api/files_api_spec.rb
1148
+ - spec/helper_methods_spec.rb
1119
1149
  - spec/payroll_au/models/settings_tracking_categories_spec.rb
1120
1150
  - spec/payroll_au/models/home_address_spec.rb
1121
1151
  - spec/payroll_au/models/settings_object_spec.rb
@@ -1405,3 +1435,4 @@ test_files:
1405
1435
  - spec/projects/models/task_create_or_update_spec.rb
1406
1436
  - spec/projects/api/project_api_spec.rb
1407
1437
  - spec/spec_helper.rb
1438
+ - spec/where_spec.rb