xero-ruby 2.9.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (399) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +133 -97
  3. data/lib/xero-ruby.rb +3 -0
  4. data/lib/xero-ruby/api/accounting_api.rb +306 -147
  5. data/lib/xero-ruby/api_client.rb +57 -8
  6. data/lib/xero-ruby/models/accounting/account.rb +11 -7
  7. data/lib/xero-ruby/models/accounting/accounts.rb +11 -7
  8. data/lib/xero-ruby/models/accounting/accounts_payable.rb +11 -7
  9. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +11 -7
  10. data/lib/xero-ruby/models/accounting/action.rb +11 -7
  11. data/lib/xero-ruby/models/accounting/actions.rb +11 -7
  12. data/lib/xero-ruby/models/accounting/address.rb +11 -7
  13. data/lib/xero-ruby/models/accounting/address_for_organisation.rb +11 -7
  14. data/lib/xero-ruby/models/accounting/allocation.rb +11 -7
  15. data/lib/xero-ruby/models/accounting/allocations.rb +11 -7
  16. data/lib/xero-ruby/models/accounting/attachment.rb +11 -7
  17. data/lib/xero-ruby/models/accounting/attachments.rb +11 -7
  18. data/lib/xero-ruby/models/accounting/balance_details.rb +11 -7
  19. data/lib/xero-ruby/models/accounting/balances.rb +11 -7
  20. data/lib/xero-ruby/models/accounting/bank_transaction.rb +11 -7
  21. data/lib/xero-ruby/models/accounting/bank_transactions.rb +11 -7
  22. data/lib/xero-ruby/models/accounting/bank_transfer.rb +11 -7
  23. data/lib/xero-ruby/models/accounting/bank_transfers.rb +11 -7
  24. data/lib/xero-ruby/models/accounting/batch_payment.rb +11 -7
  25. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +11 -7
  26. data/lib/xero-ruby/models/accounting/batch_payments.rb +11 -7
  27. data/lib/xero-ruby/models/accounting/bill.rb +11 -7
  28. data/lib/xero-ruby/models/accounting/branding_theme.rb +11 -7
  29. data/lib/xero-ruby/models/accounting/branding_themes.rb +11 -7
  30. data/lib/xero-ruby/models/accounting/budget.rb +321 -0
  31. data/lib/xero-ruby/models/accounting/budget_lines.rb +265 -0
  32. data/lib/xero-ruby/models/accounting/budgets.rb +222 -0
  33. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +11 -7
  34. data/lib/xero-ruby/models/accounting/cis_org_settings.rb +11 -7
  35. data/lib/xero-ruby/models/accounting/cis_setting.rb +11 -7
  36. data/lib/xero-ruby/models/accounting/cis_settings.rb +11 -7
  37. data/lib/xero-ruby/models/accounting/contact.rb +11 -7
  38. data/lib/xero-ruby/models/accounting/contact_group.rb +11 -7
  39. data/lib/xero-ruby/models/accounting/contact_groups.rb +11 -7
  40. data/lib/xero-ruby/models/accounting/contact_person.rb +11 -7
  41. data/lib/xero-ruby/models/accounting/contacts.rb +11 -7
  42. data/lib/xero-ruby/models/accounting/conversion_balances.rb +11 -7
  43. data/lib/xero-ruby/models/accounting/conversion_date.rb +11 -7
  44. data/lib/xero-ruby/models/accounting/credit_note.rb +11 -7
  45. data/lib/xero-ruby/models/accounting/credit_notes.rb +11 -7
  46. data/lib/xero-ruby/models/accounting/currencies.rb +11 -7
  47. data/lib/xero-ruby/models/accounting/currency.rb +11 -7
  48. data/lib/xero-ruby/models/accounting/element.rb +11 -7
  49. data/lib/xero-ruby/models/accounting/employee.rb +11 -7
  50. data/lib/xero-ruby/models/accounting/employees.rb +11 -7
  51. data/lib/xero-ruby/models/accounting/error.rb +11 -7
  52. data/lib/xero-ruby/models/accounting/expense_claim.rb +11 -7
  53. data/lib/xero-ruby/models/accounting/expense_claims.rb +11 -7
  54. data/lib/xero-ruby/models/accounting/external_link.rb +11 -7
  55. data/lib/xero-ruby/models/accounting/history_record.rb +11 -7
  56. data/lib/xero-ruby/models/accounting/history_records.rb +11 -7
  57. data/lib/xero-ruby/models/accounting/import_summary.rb +11 -7
  58. data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +11 -7
  59. data/lib/xero-ruby/models/accounting/import_summary_object.rb +11 -7
  60. data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +11 -7
  61. data/lib/xero-ruby/models/accounting/invoice.rb +11 -7
  62. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +11 -7
  63. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +11 -7
  64. data/lib/xero-ruby/models/accounting/invoices.rb +11 -7
  65. data/lib/xero-ruby/models/accounting/item.rb +11 -7
  66. data/lib/xero-ruby/models/accounting/items.rb +11 -7
  67. data/lib/xero-ruby/models/accounting/journal.rb +11 -7
  68. data/lib/xero-ruby/models/accounting/journal_line.rb +11 -7
  69. data/lib/xero-ruby/models/accounting/journals.rb +11 -7
  70. data/lib/xero-ruby/models/accounting/line_item.rb +22 -8
  71. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +11 -7
  72. data/lib/xero-ruby/models/accounting/linked_transaction.rb +11 -7
  73. data/lib/xero-ruby/models/accounting/linked_transactions.rb +11 -7
  74. data/lib/xero-ruby/models/accounting/manual_journal.rb +11 -7
  75. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +11 -7
  76. data/lib/xero-ruby/models/accounting/manual_journals.rb +11 -7
  77. data/lib/xero-ruby/models/accounting/online_invoice.rb +11 -7
  78. data/lib/xero-ruby/models/accounting/online_invoices.rb +11 -7
  79. data/lib/xero-ruby/models/accounting/organisation.rb +11 -7
  80. data/lib/xero-ruby/models/accounting/organisations.rb +11 -7
  81. data/lib/xero-ruby/models/accounting/overpayment.rb +11 -7
  82. data/lib/xero-ruby/models/accounting/overpayments.rb +11 -7
  83. data/lib/xero-ruby/models/accounting/payment.rb +11 -7
  84. data/lib/xero-ruby/models/accounting/payment_delete.rb +11 -7
  85. data/lib/xero-ruby/models/accounting/payment_service.rb +11 -7
  86. data/lib/xero-ruby/models/accounting/payment_services.rb +11 -7
  87. data/lib/xero-ruby/models/accounting/payment_term.rb +11 -7
  88. data/lib/xero-ruby/models/accounting/payments.rb +11 -7
  89. data/lib/xero-ruby/models/accounting/phone.rb +11 -7
  90. data/lib/xero-ruby/models/accounting/prepayment.rb +24 -8
  91. data/lib/xero-ruby/models/accounting/prepayments.rb +11 -7
  92. data/lib/xero-ruby/models/accounting/purchase.rb +11 -7
  93. data/lib/xero-ruby/models/accounting/purchase_order.rb +11 -7
  94. data/lib/xero-ruby/models/accounting/purchase_orders.rb +11 -7
  95. data/lib/xero-ruby/models/accounting/quote.rb +11 -7
  96. data/lib/xero-ruby/models/accounting/quotes.rb +11 -7
  97. data/lib/xero-ruby/models/accounting/receipt.rb +11 -7
  98. data/lib/xero-ruby/models/accounting/receipts.rb +11 -7
  99. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +11 -7
  100. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +11 -7
  101. data/lib/xero-ruby/models/accounting/report.rb +12 -18
  102. data/lib/xero-ruby/models/accounting/report_attribute.rb +11 -7
  103. data/lib/xero-ruby/models/accounting/report_cell.rb +11 -7
  104. data/lib/xero-ruby/models/accounting/report_fields.rb +11 -7
  105. data/lib/xero-ruby/models/accounting/report_row.rb +11 -7
  106. data/lib/xero-ruby/models/accounting/report_rows.rb +11 -7
  107. data/lib/xero-ruby/models/accounting/report_with_row.rb +12 -8
  108. data/lib/xero-ruby/models/accounting/report_with_rows.rb +11 -7
  109. data/lib/xero-ruby/models/accounting/reports.rb +11 -7
  110. data/lib/xero-ruby/models/accounting/request_empty.rb +11 -7
  111. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +11 -7
  112. data/lib/xero-ruby/models/accounting/schedule.rb +11 -7
  113. data/lib/xero-ruby/models/accounting/setup.rb +11 -7
  114. data/lib/xero-ruby/models/accounting/tax_component.rb +11 -7
  115. data/lib/xero-ruby/models/accounting/tax_rate.rb +11 -7
  116. data/lib/xero-ruby/models/accounting/tax_rates.rb +11 -7
  117. data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +11 -7
  118. data/lib/xero-ruby/models/accounting/tracking_categories.rb +11 -7
  119. data/lib/xero-ruby/models/accounting/tracking_category.rb +11 -7
  120. data/lib/xero-ruby/models/accounting/tracking_option.rb +11 -7
  121. data/lib/xero-ruby/models/accounting/tracking_options.rb +11 -7
  122. data/lib/xero-ruby/models/accounting/user.rb +11 -7
  123. data/lib/xero-ruby/models/accounting/users.rb +11 -7
  124. data/lib/xero-ruby/models/accounting/validation_error.rb +11 -7
  125. data/lib/xero-ruby/models/assets/asset.rb +11 -7
  126. data/lib/xero-ruby/models/assets/asset_type.rb +11 -7
  127. data/lib/xero-ruby/models/assets/assets.rb +11 -7
  128. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +11 -7
  129. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +11 -7
  130. data/lib/xero-ruby/models/assets/error.rb +11 -7
  131. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +11 -7
  132. data/lib/xero-ruby/models/assets/pagination.rb +11 -7
  133. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +11 -7
  134. data/lib/xero-ruby/models/assets/setting.rb +11 -7
  135. data/lib/xero-ruby/models/files/association.rb +11 -7
  136. data/lib/xero-ruby/models/files/file_object.rb +11 -7
  137. data/lib/xero-ruby/models/files/files.rb +11 -7
  138. data/lib/xero-ruby/models/files/folder.rb +11 -7
  139. data/lib/xero-ruby/models/files/folders.rb +11 -7
  140. data/lib/xero-ruby/models/files/upload_object.rb +11 -7
  141. data/lib/xero-ruby/models/files/user.rb +11 -7
  142. data/lib/xero-ruby/models/payroll_au/account.rb +11 -7
  143. data/lib/xero-ruby/models/payroll_au/api_exception.rb +11 -7
  144. data/lib/xero-ruby/models/payroll_au/bank_account.rb +11 -7
  145. data/lib/xero-ruby/models/payroll_au/deduction_line.rb +11 -7
  146. data/lib/xero-ruby/models/payroll_au/deduction_type.rb +11 -7
  147. data/lib/xero-ruby/models/payroll_au/earnings_line.rb +11 -7
  148. data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +11 -7
  149. data/lib/xero-ruby/models/payroll_au/employee.rb +11 -7
  150. data/lib/xero-ruby/models/payroll_au/employees.rb +11 -7
  151. data/lib/xero-ruby/models/payroll_au/home_address.rb +11 -7
  152. data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +11 -7
  153. data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -7
  154. data/lib/xero-ruby/models/payroll_au/leave_applications.rb +11 -7
  155. data/lib/xero-ruby/models/payroll_au/leave_balance.rb +11 -7
  156. data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +11 -7
  157. data/lib/xero-ruby/models/payroll_au/leave_line.rb +11 -7
  158. data/lib/xero-ruby/models/payroll_au/leave_lines.rb +11 -7
  159. data/lib/xero-ruby/models/payroll_au/leave_period.rb +11 -7
  160. data/lib/xero-ruby/models/payroll_au/leave_type.rb +11 -7
  161. data/lib/xero-ruby/models/payroll_au/opening_balances.rb +11 -7
  162. data/lib/xero-ruby/models/payroll_au/pay_item.rb +11 -7
  163. data/lib/xero-ruby/models/payroll_au/pay_items.rb +11 -7
  164. data/lib/xero-ruby/models/payroll_au/pay_run.rb +11 -7
  165. data/lib/xero-ruby/models/payroll_au/pay_runs.rb +11 -7
  166. data/lib/xero-ruby/models/payroll_au/pay_template.rb +11 -7
  167. data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +11 -7
  168. data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +11 -7
  169. data/lib/xero-ruby/models/payroll_au/payslip.rb +11 -7
  170. data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +11 -7
  171. data/lib/xero-ruby/models/payroll_au/payslip_object.rb +11 -7
  172. data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +11 -7
  173. data/lib/xero-ruby/models/payroll_au/payslips.rb +11 -7
  174. data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +11 -7
  175. data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +11 -7
  176. data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +11 -7
  177. data/lib/xero-ruby/models/payroll_au/settings.rb +11 -7
  178. data/lib/xero-ruby/models/payroll_au/settings_object.rb +11 -7
  179. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +11 -7
  180. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +11 -7
  181. data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +11 -7
  182. data/lib/xero-ruby/models/payroll_au/super_fund.rb +11 -7
  183. data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +11 -7
  184. data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +11 -7
  185. data/lib/xero-ruby/models/payroll_au/super_funds.rb +11 -7
  186. data/lib/xero-ruby/models/payroll_au/super_line.rb +11 -7
  187. data/lib/xero-ruby/models/payroll_au/super_membership.rb +11 -7
  188. data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +11 -7
  189. data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +11 -7
  190. data/lib/xero-ruby/models/payroll_au/tax_line.rb +11 -7
  191. data/lib/xero-ruby/models/payroll_au/timesheet.rb +11 -7
  192. data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +11 -7
  193. data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +11 -7
  194. data/lib/xero-ruby/models/payroll_au/timesheets.rb +11 -7
  195. data/lib/xero-ruby/models/payroll_au/validation_error.rb +11 -7
  196. data/lib/xero-ruby/models/payroll_nz/account.rb +11 -7
  197. data/lib/xero-ruby/models/payroll_nz/accounts.rb +11 -7
  198. data/lib/xero-ruby/models/payroll_nz/address.rb +11 -7
  199. data/lib/xero-ruby/models/payroll_nz/bank_account.rb +11 -7
  200. data/lib/xero-ruby/models/payroll_nz/benefit.rb +11 -7
  201. data/lib/xero-ruby/models/payroll_nz/deduction.rb +11 -7
  202. data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +11 -7
  203. data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +11 -7
  204. data/lib/xero-ruby/models/payroll_nz/deductions.rb +11 -7
  205. data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +11 -7
  206. data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +11 -7
  207. data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +11 -7
  208. data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +11 -7
  209. data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +11 -7
  210. data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +11 -7
  211. data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +11 -7
  212. data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +11 -7
  213. data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +11 -7
  214. data/lib/xero-ruby/models/payroll_nz/employee.rb +11 -7
  215. data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +11 -7
  216. data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +11 -7
  217. data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +11 -7
  218. data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +11 -7
  219. data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +11 -7
  220. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +11 -7
  221. data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +11 -7
  222. data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +11 -7
  223. data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +11 -7
  224. data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +11 -7
  225. data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +11 -7
  226. data/lib/xero-ruby/models/payroll_nz/employee_object.rb +11 -7
  227. data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +11 -7
  228. data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +11 -7
  229. data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +11 -7
  230. data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +11 -7
  231. data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +11 -7
  232. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +11 -7
  233. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +11 -7
  234. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +11 -7
  235. data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +11 -7
  236. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +11 -7
  237. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +11 -7
  238. data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +11 -7
  239. data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +11 -7
  240. data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +11 -7
  241. data/lib/xero-ruby/models/payroll_nz/employees.rb +11 -7
  242. data/lib/xero-ruby/models/payroll_nz/employment.rb +11 -7
  243. data/lib/xero-ruby/models/payroll_nz/employment_object.rb +11 -7
  244. data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +11 -7
  245. data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +11 -7
  246. data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +11 -7
  247. data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +11 -7
  248. data/lib/xero-ruby/models/payroll_nz/leave_period.rb +11 -7
  249. data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +11 -7
  250. data/lib/xero-ruby/models/payroll_nz/leave_type.rb +11 -7
  251. data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +11 -7
  252. data/lib/xero-ruby/models/payroll_nz/leave_types.rb +11 -7
  253. data/lib/xero-ruby/models/payroll_nz/pagination.rb +11 -7
  254. data/lib/xero-ruby/models/payroll_nz/pay_run.rb +11 -7
  255. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +11 -7
  256. data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +11 -7
  257. data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +11 -7
  258. data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +11 -7
  259. data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +11 -7
  260. data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +11 -7
  261. data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +11 -7
  262. data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +11 -7
  263. data/lib/xero-ruby/models/payroll_nz/payment_line.rb +11 -7
  264. data/lib/xero-ruby/models/payroll_nz/payment_method.rb +11 -7
  265. data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +11 -7
  266. data/lib/xero-ruby/models/payroll_nz/problem.rb +11 -7
  267. data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +11 -7
  268. data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +11 -7
  269. data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +11 -7
  270. data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +11 -7
  271. data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +11 -7
  272. data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +11 -7
  273. data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +11 -7
  274. data/lib/xero-ruby/models/payroll_nz/settings.rb +11 -7
  275. data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +11 -7
  276. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +11 -7
  277. data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +11 -7
  278. data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +11 -7
  279. data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +11 -7
  280. data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +11 -7
  281. data/lib/xero-ruby/models/payroll_nz/superannuations.rb +11 -7
  282. data/lib/xero-ruby/models/payroll_nz/tax_line.rb +11 -7
  283. data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +11 -7
  284. data/lib/xero-ruby/models/payroll_nz/timesheet.rb +11 -7
  285. data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +11 -7
  286. data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +11 -7
  287. data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +11 -7
  288. data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +11 -7
  289. data/lib/xero-ruby/models/payroll_nz/timesheets.rb +11 -7
  290. data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +11 -7
  291. data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +11 -7
  292. data/lib/xero-ruby/models/payroll_uk/account.rb +11 -7
  293. data/lib/xero-ruby/models/payroll_uk/accounts.rb +11 -7
  294. data/lib/xero-ruby/models/payroll_uk/address.rb +11 -7
  295. data/lib/xero-ruby/models/payroll_uk/bank_account.rb +11 -7
  296. data/lib/xero-ruby/models/payroll_uk/benefit.rb +11 -7
  297. data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +11 -7
  298. data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +11 -7
  299. data/lib/xero-ruby/models/payroll_uk/benefits.rb +11 -7
  300. data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +11 -7
  301. data/lib/xero-ruby/models/payroll_uk/deduction.rb +11 -7
  302. data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +11 -7
  303. data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +11 -7
  304. data/lib/xero-ruby/models/payroll_uk/deductions.rb +11 -7
  305. data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +11 -7
  306. data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +11 -7
  307. data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +11 -7
  308. data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +11 -7
  309. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +11 -7
  310. data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +11 -7
  311. data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +11 -7
  312. data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +11 -7
  313. data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +11 -7
  314. data/lib/xero-ruby/models/payroll_uk/employee.rb +11 -7
  315. data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +11 -7
  316. data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +11 -7
  317. data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +11 -7
  318. data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +11 -7
  319. data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +11 -7
  320. data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +11 -7
  321. data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +11 -7
  322. data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +11 -7
  323. data/lib/xero-ruby/models/payroll_uk/employee_object.rb +11 -7
  324. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +11 -7
  325. data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +11 -7
  326. data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +11 -7
  327. data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +11 -7
  328. data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +11 -7
  329. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +11 -7
  330. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +11 -7
  331. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +11 -7
  332. data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +11 -7
  333. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +11 -7
  334. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +11 -7
  335. data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +11 -7
  336. data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +11 -7
  337. data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +11 -7
  338. data/lib/xero-ruby/models/payroll_uk/employees.rb +11 -7
  339. data/lib/xero-ruby/models/payroll_uk/employment.rb +11 -7
  340. data/lib/xero-ruby/models/payroll_uk/employment_object.rb +11 -7
  341. data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +11 -7
  342. data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +11 -7
  343. data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +11 -7
  344. data/lib/xero-ruby/models/payroll_uk/leave_period.rb +11 -7
  345. data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +11 -7
  346. data/lib/xero-ruby/models/payroll_uk/leave_type.rb +11 -7
  347. data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +11 -7
  348. data/lib/xero-ruby/models/payroll_uk/leave_types.rb +11 -7
  349. data/lib/xero-ruby/models/payroll_uk/pagination.rb +11 -7
  350. data/lib/xero-ruby/models/payroll_uk/pay_run.rb +11 -7
  351. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +11 -7
  352. data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +11 -7
  353. data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +11 -7
  354. data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +11 -7
  355. data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +11 -7
  356. data/lib/xero-ruby/models/payroll_uk/payment_line.rb +11 -7
  357. data/lib/xero-ruby/models/payroll_uk/payment_method.rb +11 -7
  358. data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +11 -7
  359. data/lib/xero-ruby/models/payroll_uk/payslip.rb +11 -7
  360. data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +11 -7
  361. data/lib/xero-ruby/models/payroll_uk/payslips.rb +11 -7
  362. data/lib/xero-ruby/models/payroll_uk/problem.rb +11 -7
  363. data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +11 -7
  364. data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +11 -7
  365. data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +11 -7
  366. data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +11 -7
  367. data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +11 -7
  368. data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +11 -7
  369. data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +11 -7
  370. data/lib/xero-ruby/models/payroll_uk/settings.rb +11 -7
  371. data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +11 -7
  372. data/lib/xero-ruby/models/payroll_uk/tax_line.rb +11 -7
  373. data/lib/xero-ruby/models/payroll_uk/timesheet.rb +11 -7
  374. data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +11 -7
  375. data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +11 -7
  376. data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +11 -7
  377. data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +11 -7
  378. data/lib/xero-ruby/models/payroll_uk/timesheets.rb +11 -7
  379. data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +11 -7
  380. data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +11 -7
  381. data/lib/xero-ruby/models/projects/amount.rb +11 -7
  382. data/lib/xero-ruby/models/projects/error.rb +11 -7
  383. data/lib/xero-ruby/models/projects/pagination.rb +11 -7
  384. data/lib/xero-ruby/models/projects/project.rb +11 -7
  385. data/lib/xero-ruby/models/projects/project_create_or_update.rb +11 -7
  386. data/lib/xero-ruby/models/projects/project_patch.rb +11 -7
  387. data/lib/xero-ruby/models/projects/project_user.rb +11 -7
  388. data/lib/xero-ruby/models/projects/project_users.rb +11 -7
  389. data/lib/xero-ruby/models/projects/projects.rb +11 -7
  390. data/lib/xero-ruby/models/projects/task.rb +11 -7
  391. data/lib/xero-ruby/models/projects/task_create_or_update.rb +11 -7
  392. data/lib/xero-ruby/models/projects/tasks.rb +11 -7
  393. data/lib/xero-ruby/models/projects/time_entries.rb +11 -7
  394. data/lib/xero-ruby/models/projects/time_entry.rb +14 -9
  395. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +11 -7
  396. data/lib/xero-ruby/version.rb +2 -2
  397. data/spec/api_client_spec.rb +84 -9
  398. data/spec/helper_methods_spec.rb +28 -0
  399. metadata +29 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb43e668c4cbd29f1190365df174d64a56385710319bdf3061ebe048b6dddcee
4
- data.tar.gz: 0c4bacf725b0130b1675bc300bff98840fe537958fb8eef4627c709afd69ee5c
3
+ metadata.gz: ffd60e2ce8ccc28aec721bb3fa1e1eb7d33ef427799a591827844643f461a920
4
+ data.tar.gz: 76450e0771d835e052b18e1b766cc29e4e961f5aa5310b59e636eaef910a7220
5
5
  SHA512:
6
- metadata.gz: 0eb80a0480dbf63d28ff6295f43e5288e90c0299616bfd48a60401b8f214424baff1d990e6964bafbb76b0d569dd172ccbb151dc9c9c96a7c3697e10f4361897
7
- data.tar.gz: 780bd04d6cde627f8c6b4ac56a69c018ac9e5fef49169ccdf6a89201b6e826b253a1942e5459429256c351a459e3c0a45f105f99554aec32dadfa9b36e7fa63a
6
+ metadata.gz: 7df939becf48e628528870a3cef4264df6d37c059796ef52a80d20c1450497c324e5042adea2c3db8644000c443436a5e0517add5fd27e53c672fba45cb57366
7
+ data.tar.gz: 6e151873e866dec1db63ffa24a857438dccc29e65aa126fa43e9d6978a4cb2e563f2e0feca202d88c6431d99403e06377530626d5f00815c001a31ce02072d3a
data/README.md CHANGED
@@ -5,45 +5,36 @@ Xero Ruby SDK for OAuth 2.0 generated from [Xero API OpenAPI Spec](https://githu
5
5
 
6
6
  # Documentation
7
7
  Xero Ruby SDK supports Xero's OAuth2.0 authentication and the following Xero API sets.
8
-
9
- ## SDK Documentation
8
+ ### API Client Documentation
10
9
  * [API client methods](https://xeroapi.github.io/xero-ruby/accounting/index.html)
11
- ---
12
- ## API Model Docs
13
- * [Accounting Models](/docs/accounting)
14
- * [Asset Api Docs](/docs/assets/)
15
- * [Project Api Docs](docs/projects/)
16
- * [Files Api Docs](docs/files/)
17
- * [Payroll Docs (AU)](docs/payroll_au/)
18
- * [Payroll Docs (NZ)](docs/payroll_nz/)
19
- * [Payroll Docs (UK)](docs/payroll_uk/)
20
-
10
+ > This describes to ~200+ accounting API endpoints and their expected params. There are also method reference docs for the Assets, Files, Projects, and Payroll endpoints sets, though we are still working on accurately generating usable parameter examples for all! (feedback welcome)
11
+ ### Model Docs
12
+ * [Models](/docs/)
13
+ > Directory of markdown files, describing the object models for the Accounting, Asset, Projects, Files, Payroll (AU, UK, NZ) Xero API sets.
21
14
  ## Sample Apps
22
- We have two apps showing SDK usage.
23
- * https://github.com/XeroAPI/xero-ruby-oauth2-starter (**Sinatra** - session based / getting started)
24
- * https://github.com/XeroAPI/xero-ruby-oauth2-app (**Rails** - token management / full examples)
15
+ We have two sample apps showing SDK usage:
16
+ * https://github.com/XeroAPI/xero-ruby-oauth2-starter (**Sinatra** - bare minimum to hello world and simple session based storage)
17
+ * https://github.com/XeroAPI/xero-ruby-oauth2-app (**Rails** - token management with robust usage examples)
25
18
 
26
19
  ![sample-app](https://i.imgur.com/OOEn55G.png)
27
20
 
28
- ---
21
+ ## Xero Pre-Requisites
22
+ * Create a [free Xero user account](https://www.xero.com/us/signup/api/)
23
+ * Login to your Xero developer [/myapps](https://developer.xero.com/myapps) dashboard & create an API application
24
+ * Copy the credentials from your API app and store/access them using a secure ENV variable strategy
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"`"
29
26
  ## Installation
30
- To install this gem to your current gemset.
27
+ To install this gem to your project:
31
28
  ```
32
29
  gem install 'xero-ruby'
33
30
  ```
34
- Or add to your gemfile and run `bundle install`.
31
+ Or more commonly in Ruby on Rails usage add to your gemfile and run `bundle install`:
35
32
  ```
36
33
  gem 'xero-ruby'
37
34
  ```
38
35
 
39
- ## Getting Started
40
- * Create a [free Xero user account](https://www.xero.com/us/signup/api/)
41
- * Login to your Xero developer [/myapps](https://developer.xero.com/myapps) dashboard & create an API application and note your API app's credentials.
42
-
43
- ### Creating a client
44
- * Get the credential values from an API application at https://developer.xero.com/myapps/.
45
- * Include [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) as a space-seperated list
46
- * example => "`openid profile email accounting.transactions accounting.settings`"
36
+ ---
37
+ ## Usage
47
38
  ```
48
39
  require 'xero-ruby'
49
40
  ```
@@ -58,56 +49,77 @@ creds = {
58
49
  xero_client ||= XeroRuby::ApiClient.new(credentials: creds)
59
50
  ```
60
51
 
61
- If you want additional logging or timeout, you can add/override any configuration option by passing the optional named parameter object `config`.
52
+ For additional logging or timeout, add or override any [config](/lib/xero-ruby/configuration.rb) option by passing an optional named parameter `config: {..}`.
62
53
  ```ruby
63
54
  config = { timeout: 30, debugging: true }
64
55
  @xero_client ||= XeroRuby::ApiClient.new(credentials: creds, config: config)
65
56
  ```
66
57
 
67
- ## User Authorization & Callback
68
- All API requests require a valid access token to be set on the client.
58
+ ## OAuth2.0 Authorization & Callback
59
+ All API requests require a valid access token to be set on the xero_client.
69
60
 
70
- To generate a valid `token_set` send a user to the `authorization_url`:
61
+ ### Step 1
62
+ Send the user to the `authorization_url` after you have configured your xero_client
71
63
  ```ruby
72
64
  @authorization_url = xero_client.authorization_url
73
65
 
74
66
  redirect_to @authorization_url
75
67
  ```
76
68
 
77
- Xero will then redirect back to the URI defined in your `redirect_uri` config.
78
-
79
- *This must match **exactly** with the variable in your /myapps dashboard.*
80
-
81
- In your callback, calling `get_token_set_from_callback` will exchange the temporary code Xero return, with a valid `token_set` that you can use to make API calls.
69
+ ### Step 2
70
+ On successful authorization, Xero identity will redirect to the URI defined in your `redirect_uri` config which must match **exactly** with the variable in your /myapps dashboard.
71
+ ```
72
+ => /oauth/redirect_uri
73
+ ```
74
+ ### Step 3
75
+ In your server defined callback route, exchange the temporary code for a valid `token_set` that will get set on your client.
82
76
  ```ruby
83
- # => http://localhost:3000/oauth/callback
84
-
85
77
  token_set = xero_client.get_token_set_from_callback(params)
78
+ ```
79
+ At this point you should save the token_set as JSON in a datastore in relation to the authenticating user or entity.
86
80
 
87
- # save token_set JSON in a datastore in relation to the user authentication
88
-
89
- puts params['state']
90
- => "this-can-be-a-custom-state-parameter"
81
+ The sample [Rails app](https://github.com/XeroAPI/xero-ruby-oauth2-app/blob/master/app/controllers/application_controller.rb#L11) shows a solid pattern you can tweak to fit your needs:
82
+ ```ruby
83
+ # /oauth/redirect_uri -> 'application#callback'
84
+ def callback
85
+ @token_set = @xero_client.get_token_set_from_callback(params)
86
+
87
+ current_user.token_set = @token_set
88
+ current_user.token_set['connections'] = @xero_client.connections
89
+ current_user.active_tenant_id = latest_connection(current_user.token_set['connections'])
90
+ current_user.save!
91
+ flash.notice = "Successfully authenticated with Xero!"
92
+ end
91
93
  ```
94
+ ---
95
+ ### What is a Token Set?
96
+ A `token_set` is what we call the XeroAPI response that contains data about your API connection:
97
+ ```json
98
+ {
99
+ "id_token": "xxx.yyy.zz", (if you requested `openid profile email` scope)
100
+ "access_token": "xxx.yyy.zzz",
101
+ "expires_in": 1800,
102
+ "token_type": "Bearer",
103
+ "refresh_token": "xxxxxx", (if you requested `offline_access` scope)
104
+ "scope": "email profile openid accounting.transactions offline_access"
105
+ }
106
+ ```
107
+
108
+ Note that an `access_token` is valid for 30 minutes but a `refresh_token` can be used once in up to a 60 day window. If a refresh_token is used to refresh access you must replace the entire token_set.
92
109
 
93
- ## Making API calls once you have a token_set
94
- Once you already have a token_set stored from this initual user interaction, you can setup a new client by passing the whole token_set to `refresh_token_set` or `set_token_set`.
110
+ Both the `id_token` & `access_token` are JWT's, and can be decoded to see additional metadata described in the Token Helpers section:
111
+ ## Making API calls with a valid token_set
112
+ After the initial user interaction you can simply setup a xero_client by passing the whole token_set to the client.
95
113
  ```ruby
96
114
  xero_client.set_token_set(user.token_set)
97
115
 
98
116
  xero_client.refresh_token_set(user.token_set)
99
- # this will set the access_token on the client, and return a refreshed `token_set` you need to save.
100
117
  ```
101
- A `token_set` contains data about your API connection most importantly :
102
- * `access_token`
103
- * `refresh_token`
104
- * `expiry`
105
-
106
- **An `access_token` is valid 30 minutes and a `refresh_token` is valid for 60 days**
107
-
108
- Example Token set:
109
- > You can decode the `id_token` & `access_token` for additional metadata by using a [decoding library](https://github.com/jwt/ruby-jwt):
110
- ```json
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.
119
+ ## Token Helpers
120
+ ```ruby
121
+ xero_client.token_set
122
+ =>
111
123
  {
112
124
  "id_token": "xxx.yyy.zz",
113
125
  "access_token": "xxx.yyy.zzz",
@@ -116,17 +128,63 @@ Example Token set:
116
128
  "refresh_token": "xxxxxx",
117
129
  "scope": "email profile openid accounting.transactions offline_access"
118
130
  }
119
- ```
120
131
 
121
- ## Token & SDK Helpers
122
- Refresh/connection helpers
132
+ xero_client.access_token
133
+ => "xxx.yyy.zzz"
134
+
135
+ xero_client.decoded_access_token
136
+ => {
137
+ "exp": 1619715843,
138
+ "xero_userid": "xero-user-uuid",
139
+ "scope": [
140
+ "email",
141
+ "profile",
142
+ "openid",
143
+ "accounting.transactions",
144
+ "offline_access"
145
+ ]
146
+ }
147
+
148
+
149
+ xero_client.id_token
150
+ => "aaa.bbb.ccc"
151
+
152
+ xero_client.decoded_id_token
153
+ => {
154
+ "iss": "https://identity.xero.com",
155
+ "email": "luca.pacioli@accounting-services.com",
156
+ "given_name": "Luca",
157
+ "family_name": "Pacioli"
158
+ }
159
+
160
+ xero_client.set_token_set(token_set)
161
+ => true
162
+
163
+ xero_client.get_token_set_from_callback(callback_url_params)
164
+ => new_xero_token_set
165
+
166
+ xero_client.refresh_token_set(token_set)
167
+ => new_xero_token_set
168
+
169
+ # These are automatically populated with `set_token_set`
170
+ # But if you need to set just an access or id token on the client
171
+ xero_client.set_access_token(access_token)
172
+ xero_client.set_id_token(id_token)
173
+
174
+ # Automatically run on initial OAuth flow - can be called its own if desired
175
+ # Read about why we have included this in the default library: https://auth0.com/docs/tokens/access-tokens/validate-access-tokens
176
+ xero_client.validate_tokens(token_set)
177
+ xero_client.decode_jwt(tkn)
178
+ ```
179
+ # Connection Helpers
123
180
  ```ruby
124
- @token_set = xero_client.refresh_token_set(user.token_set)
181
+ xero_client.authorization_url
182
+ => # https://login.xero.com/identity/connect/authorize?response_type=code&client_id=<client_id>&redirect_uri=<redirect_uri>&scope=<scopes>&state=<my-state>
125
183
 
126
- # Xero's tokens can potentially facilitate (n) org connections in a single token.
127
- # It is important to store the `tenantId` of the Organisation your user wants to read/write data.
184
+ # To completely Revoke a user's access token and all their connections
185
+ xero_client.revoke_token(token_set)
128
186
 
129
- # The `updatedDateUtc` will show you the most recently authorized Tenant (AKA Organisation)
187
+ # In case there are > 1 tenants connected the `updatedDateUtc` will show you the most recently authorized tenant (aka organisation) - it is important to store the `tenantId` of the Org your user specified in their API authorization
130
188
  connections = xero_client.connections
131
189
  [{
132
190
  "id" => "xxx-yyy-zzz",
@@ -137,38 +195,19 @@ connections = xero_client.connections
137
195
  "updatedDateUtc" => "2020-04-15T22:37:10.4943410"
138
196
  }]
139
197
 
140
- # To completely Revoke a user's access token and all their connections
141
- # pass in the users token set to the #revoke_token api_client method
142
-
143
- xero_client.revoke_token(user.token_set)
144
-
145
- # disconnect an org from a user's connections. Pass the connection ['id'] not ['tenantId'].
146
- # Useful if you want to enforce only a single org connection per token.
198
+ # To disconnect a single org from a user's active connections pass the connection ['id'] (not ['tenantId'])
199
+ # If you want to enforce only a single org connection per token do this prior to sending user through Xero authorize flow a 2nd time.
147
200
  remaining_connections = xero_client.disconnect(connections[0]['id'])
148
201
 
149
- # set a refreshed token_set
150
- token_set = xero_client.set_token_set(user.token_set)
151
-
152
- # access token_set once it is set on the client
153
- token_set = xero_client.token_set
154
- ```
155
-
156
- Example token expiry helper
157
- ```ruby
158
- require 'jwt'
159
-
160
- def token_expired?
161
- token_expiry = Time.at(decoded_access_token['exp'])
162
- token_expiry < Time.now
163
- end
202
+ xero_client.token_expired?
203
+ => true || false
164
204
 
165
- def decoded_access_token
166
- JWT.decode(token_set['access_token'], nil, false)[0]
167
- end
205
+ # This will check against the following logic
206
+ token_expiry = Time.at(decoded_access_token['exp'])
207
+ token_expiry < Time.now
168
208
  ```
169
209
 
170
- ## API Usage
171
-
210
+ # API Usage
172
211
  ### Accounting API
173
212
  > https://xeroapi.github.io/xero-ruby/accounting/index.html
174
213
  ```ruby
@@ -177,7 +216,7 @@ require 'xero-ruby'
177
216
  xero_client.refresh_token_set(user.token_set)
178
217
 
179
218
  tenant_id = user.active_tenant_id
180
- # example of how to store the `tenantId` of the specific tenant (aka organisation)
219
+ # Example 'active tenant' logic storage of the tenant the user specified, xero_client.connections[0] is not a safe assumption in case they authorized multiple orgs.
181
220
 
182
221
  # Get Accounts
183
222
  accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts
@@ -186,10 +225,13 @@ accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts
186
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 }]}
187
226
  invoice = xero_client.accounting_api.create_invoices(tenant_id, invoices).invoices.first
188
227
 
189
- # display out all the serialized data as a hash
228
+ # display out all the serialized data as a snake_case hash
190
229
  puts invoices.to_attributes
191
230
  => {type: 'ACCREC', line_items: [...]}
192
231
 
232
+ puts invoices.to_hash(downcase: false)
233
+ => {'Type': 'ACCREC', 'LineItems': [...]}
234
+
193
235
  # Create History
194
236
  payment = xero_client.accounting_api.get_payments(tenant_id).payments.first
195
237
  history_records = { history_records: [{ details: "This payment now has some History!" }]}
@@ -331,19 +373,13 @@ opts = {
331
373
  }
332
374
  xero_client.accounting_api.get_bank_transfers(tenant_id, opts).bank_transfers
333
375
  ```
334
- ### NOTE
376
+
335
377
  1) Not all `opts` parameter combinations are available for all endpoints, and there are likely some undiscovered edge cases. If you encounter a filter / sort / where clause that seems buggy open an issue and we will dig.
336
378
 
337
379
  2) Some opts string values may need PascalCasing to match casing defined in our [core API docs](https://developer.xero.com/documentation/api/api-overview).
338
380
  * `opts = { order: 'UpdatedDateUtc DESC'}`
339
381
 
340
382
  3) If you have use cases outside of these examples let us know.
341
-
342
- ## Sample App
343
- The best resource to understanding how to best leverage this SDK is the sample applications showing all the features of the gem.
344
- > https://github.com/XeroAPI/xero-ruby-oauth2-starter (Sinatra - simple getting started)
345
- > https://github.com/XeroAPI/xero-ruby-oauth2-app (Rails - full featured examples)
346
-
347
383
  ## Developing locally
348
384
  To develop this gem locally against your project you can use the following development pattern:
349
385
 
data/lib/xero-ruby.rb CHANGED
@@ -349,6 +349,9 @@ require 'xero-ruby/models/accounting/batch_payments'
349
349
  require 'xero-ruby/models/accounting/bill'
350
350
  require 'xero-ruby/models/accounting/branding_theme'
351
351
  require 'xero-ruby/models/accounting/branding_themes'
352
+ require 'xero-ruby/models/accounting/budget'
353
+ require 'xero-ruby/models/accounting/budget_lines'
354
+ require 'xero-ruby/models/accounting/budgets'
352
355
  require 'xero-ruby/models/accounting/cis_org_setting'
353
356
  require 'xero-ruby/models/accounting/cis_org_settings'
354
357
  require 'xero-ruby/models/accounting/cis_setting'
@@ -7018,6 +7018,159 @@ module XeroRuby
7018
7018
  return data, status_code, headers
7019
7019
  end
7020
7020
 
7021
+ # Retrieves a specific budgets, which includes budget lines
7022
+ # @param xero_tenant_id [String] Xero identifier for Tenant
7023
+ # @param budget_id [String] Unique identifier for Budgets
7024
+ # @param [Hash] opts the optional parameters
7025
+ # @return [Budgets]
7026
+ def get_budget(xero_tenant_id, budget_id, opts = {})
7027
+ data, _status_code, _headers = get_budget_with_http_info(xero_tenant_id, budget_id, opts)
7028
+ data
7029
+ end
7030
+
7031
+ # Retrieves a specific budgets, which includes budget lines
7032
+ # @param xero_tenant_id [String] Xero identifier for Tenant
7033
+ # @param budget_id [String] Unique identifier for Budgets
7034
+ # @param [Hash] opts the optional parameters
7035
+ # @return [Array<(Budgets, Integer, Hash)>] Budgets data, response status code and response headers
7036
+ def get_budget_with_http_info(xero_tenant_id, budget_id, options = {})
7037
+ opts = options.dup
7038
+ if @api_client.config.debugging
7039
+ @api_client.config.logger.debug 'Calling API: AccountingApi.get_budget ...'
7040
+ end
7041
+ # verify the required parameter 'xero_tenant_id' is set
7042
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
7043
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_budget"
7044
+ end
7045
+ # verify the required parameter 'budget_id' is set
7046
+ if @api_client.config.client_side_validation && budget_id.nil?
7047
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountingApi.get_budget"
7048
+ end
7049
+ # resource path
7050
+ local_var_path = '/Budgets/{BudgetID}'.sub('{' + 'BudgetID' + '}', budget_id.to_s)
7051
+
7052
+ # camelize keys of incoming `where` opts
7053
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
7054
+
7055
+ # query parameters
7056
+ query_params = opts[:query_params] || {}
7057
+
7058
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
7059
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
7060
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
7061
+
7062
+ # header parameters
7063
+ header_params = opts[:header_params] || {}
7064
+ # HTTP header 'Accept' (if needed)
7065
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
7066
+ header_params[:'xero-tenant-id'] = xero_tenant_id
7067
+
7068
+ # form parameters
7069
+ form_params = opts[:form_params] || {}
7070
+
7071
+ # http body (model)
7072
+ post_body = opts[:body]
7073
+
7074
+ # return_type
7075
+ return_type = opts[:return_type] || 'Budgets'
7076
+
7077
+ # auth_names
7078
+ auth_names = opts[:auth_names] || ['OAuth2']
7079
+
7080
+ new_options = opts.merge(
7081
+ :header_params => header_params,
7082
+ :query_params => query_params,
7083
+ :form_params => form_params,
7084
+ :body => post_body,
7085
+ :auth_names => auth_names,
7086
+ :return_type => return_type
7087
+ )
7088
+
7089
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
7090
+ if @api_client.config.debugging
7091
+ @api_client.config.logger.debug "API called: AccountingApi#get_budget\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
7092
+ end
7093
+ return data, status_code, headers
7094
+ end
7095
+
7096
+ # Retrieve a list of budgets
7097
+ # @param xero_tenant_id [String] Xero identifier for Tenant
7098
+ # @param [Hash] opts the optional parameters
7099
+ # @option opts [Array<String>] :i_ds Filter by BudgetID. Allows you to retrieve a specific individual budget.
7100
+ # @option opts [Date] :date_to Filter by start date
7101
+ # @option opts [Date] :date_from Filter by end date
7102
+ # @return [Budgets]
7103
+ def get_budgets(xero_tenant_id, opts = {})
7104
+ data, _status_code, _headers = get_budgets_with_http_info(xero_tenant_id, opts)
7105
+ data
7106
+ end
7107
+
7108
+ # Retrieve a list of budgets
7109
+ # @param xero_tenant_id [String] Xero identifier for Tenant
7110
+ # @param [Hash] opts the optional parameters
7111
+ # @option opts [Array<String>] :i_ds Filter by BudgetID. Allows you to retrieve a specific individual budget.
7112
+ # @option opts [Date] :date_to Filter by start date
7113
+ # @option opts [Date] :date_from Filter by end date
7114
+ # @return [Array<(Budgets, Integer, Hash)>] Budgets data, response status code and response headers
7115
+ def get_budgets_with_http_info(xero_tenant_id, options = {})
7116
+ opts = options.dup
7117
+ if @api_client.config.debugging
7118
+ @api_client.config.logger.debug 'Calling API: AccountingApi.get_budgets ...'
7119
+ end
7120
+ # verify the required parameter 'xero_tenant_id' is set
7121
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
7122
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_budgets"
7123
+ end
7124
+ # resource path
7125
+ local_var_path = '/Budgets'
7126
+
7127
+ # camelize keys of incoming `where` opts
7128
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
7129
+
7130
+ # query parameters
7131
+ query_params = opts[:query_params] || {}
7132
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'i_ds'], :csv) if !opts[:'i_ds'].nil?
7133
+ query_params[:'DateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil?
7134
+ query_params[:'DateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil?
7135
+
7136
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
7137
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
7138
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
7139
+
7140
+ # header parameters
7141
+ header_params = opts[:header_params] || {}
7142
+ # HTTP header 'Accept' (if needed)
7143
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
7144
+ header_params[:'xero-tenant-id'] = xero_tenant_id
7145
+
7146
+ # form parameters
7147
+ form_params = opts[:form_params] || {}
7148
+
7149
+ # http body (model)
7150
+ post_body = opts[:body]
7151
+
7152
+ # return_type
7153
+ return_type = opts[:return_type] || 'Budgets'
7154
+
7155
+ # auth_names
7156
+ auth_names = opts[:auth_names] || ['OAuth2']
7157
+
7158
+ new_options = opts.merge(
7159
+ :header_params => header_params,
7160
+ :query_params => query_params,
7161
+ :form_params => form_params,
7162
+ :body => post_body,
7163
+ :auth_names => auth_names,
7164
+ :return_type => return_type
7165
+ )
7166
+
7167
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
7168
+ if @api_client.config.debugging
7169
+ @api_client.config.logger.debug "API called: AccountingApi#get_budgets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
7170
+ end
7171
+ return data, status_code, headers
7172
+ end
7173
+
7021
7174
  # Retrieves a specific contacts in a Xero organisation using a unique contact Id
7022
7175
  # @param xero_tenant_id [String] Xero identifier for Tenant
7023
7176
  # @param contact_id [String] Unique identifier for a Contact
@@ -7728,6 +7881,7 @@ module XeroRuby
7728
7881
  # @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
7882
  # @option opts [Integer] :page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call.
7730
7883
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response
7884
+ # @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)
7731
7885
  # @return [Contacts]
7732
7886
  def get_contacts(xero_tenant_id, opts = {})
7733
7887
  data, _status_code, _headers = get_contacts_with_http_info(xero_tenant_id, opts)
@@ -7743,6 +7897,7 @@ module XeroRuby
7743
7897
  # @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.
7744
7898
  # @option opts [Integer] :page e.g. page&#x3D;1 - Up to 100 contacts will be returned in a single API call.
7745
7899
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response
7900
+ # @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.
7746
7901
  # @return [Array<(Contacts, Integer, Hash)>] Contacts data, response status code and response headers
7747
7902
  def get_contacts_with_http_info(xero_tenant_id, options = {})
7748
7903
  opts = options.dup
@@ -7766,6 +7921,7 @@ module XeroRuby
7766
7921
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'i_ds'], :csv) if !opts[:'i_ds'].nil?
7767
7922
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
7768
7923
  query_params[:'includeArchived'] = opts[:'include_archived'] if !opts[:'include_archived'].nil?
7924
+ query_params[:'summaryOnly'] = opts[:'summary_only'] if !opts[:'summary_only'].nil?
7769
7925
 
7770
7926
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
7771
7927
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
@@ -9386,6 +9542,7 @@ module XeroRuby
9386
9542
  # @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
9387
9543
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response
9388
9544
  # @option opts [Boolean] :created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app
9545
+ # @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)
9389
9546
  # @option opts [Integer] :unitdp e.g. unitdp&#x3D;4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
9390
9547
  # @return [Invoices]
9391
9548
  def get_invoices(xero_tenant_id, opts = {})
@@ -9406,6 +9563,7 @@ module XeroRuby
9406
9563
  # @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
9407
9564
  # @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Invoices with a status of ARCHIVED will be included in the response
9408
9565
  # @option opts [Boolean] :created_by_my_app When set to true you&#39;ll only retrieve Invoices created by your app
9566
+ # @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.
9409
9567
  # @option opts [Integer] :unitdp e.g. unitdp&#x3D;4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
9410
9568
  # @return [Array<(Invoices, Integer, Hash)>] Invoices data, response status code and response headers
9411
9569
  def get_invoices_with_http_info(xero_tenant_id, options = {})
@@ -9434,6 +9592,7 @@ module XeroRuby
9434
9592
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
9435
9593
  query_params[:'includeArchived'] = opts[:'include_archived'] if !opts[:'include_archived'].nil?
9436
9594
  query_params[:'createdByMyApp'] = opts[:'created_by_my_app'] if !opts[:'created_by_my_app'].nil?
9595
+ query_params[:'summaryOnly'] = opts[:'summary_only'] if !opts[:'summary_only'].nil?
9437
9596
  query_params[:'unitdp'] = opts[:'unitdp'] if !opts[:'unitdp'].nil?
9438
9597
 
9439
9598
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
@@ -13910,150 +14069,6 @@ module XeroRuby
13910
14069
  return data, status_code, headers
13911
14070
  end
13912
14071
 
13913
- # Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)
13914
- # @param xero_tenant_id [String] Xero identifier for Tenant
13915
- # @param report_id [String] Unique identifier for a Report
13916
- # @param [Hash] opts the optional parameters
13917
- # @return [ReportWithRows]
13918
- def get_report_ba_sor_gst(xero_tenant_id, report_id, opts = {})
13919
- data, _status_code, _headers = get_report_ba_sor_gst_with_http_info(xero_tenant_id, report_id, opts)
13920
- data
13921
- end
13922
-
13923
- # Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)
13924
- # @param xero_tenant_id [String] Xero identifier for Tenant
13925
- # @param report_id [String] Unique identifier for a Report
13926
- # @param [Hash] opts the optional parameters
13927
- # @return [Array<(ReportWithRows, Integer, Hash)>] ReportWithRows data, response status code and response headers
13928
- def get_report_ba_sor_gst_with_http_info(xero_tenant_id, report_id, options = {})
13929
- opts = options.dup
13930
- if @api_client.config.debugging
13931
- @api_client.config.logger.debug 'Calling API: AccountingApi.get_report_ba_sor_gst ...'
13932
- end
13933
- # verify the required parameter 'xero_tenant_id' is set
13934
- if @api_client.config.client_side_validation && xero_tenant_id.nil?
13935
- fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_report_ba_sor_gst"
13936
- end
13937
- # verify the required parameter 'report_id' is set
13938
- if @api_client.config.client_side_validation && report_id.nil?
13939
- fail ArgumentError, "Missing the required parameter 'report_id' when calling AccountingApi.get_report_ba_sor_gst"
13940
- end
13941
- # resource path
13942
- local_var_path = '/Reports/{ReportID}'.sub('{' + 'ReportID' + '}', report_id.to_s)
13943
-
13944
- # camelize keys of incoming `where` opts
13945
- opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
13946
-
13947
- # query parameters
13948
- query_params = opts[:query_params] || {}
13949
-
13950
- # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
13951
- query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
13952
- query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
13953
-
13954
- # header parameters
13955
- header_params = opts[:header_params] || {}
13956
- # HTTP header 'Accept' (if needed)
13957
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
13958
- header_params[:'xero-tenant-id'] = xero_tenant_id
13959
-
13960
- # form parameters
13961
- form_params = opts[:form_params] || {}
13962
-
13963
- # http body (model)
13964
- post_body = opts[:body]
13965
-
13966
- # return_type
13967
- return_type = opts[:return_type] || 'ReportWithRows'
13968
-
13969
- # auth_names
13970
- auth_names = opts[:auth_names] || ['OAuth2']
13971
-
13972
- new_options = opts.merge(
13973
- :header_params => header_params,
13974
- :query_params => query_params,
13975
- :form_params => form_params,
13976
- :body => post_body,
13977
- :auth_names => auth_names,
13978
- :return_type => return_type
13979
- )
13980
-
13981
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
13982
- if @api_client.config.debugging
13983
- @api_client.config.logger.debug "API called: AccountingApi#get_report_ba_sor_gst\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
13984
- end
13985
- return data, status_code, headers
13986
- end
13987
-
13988
- # Retrieves report for BAS (only valid for AU orgs)
13989
- # @param xero_tenant_id [String] Xero identifier for Tenant
13990
- # @param [Hash] opts the optional parameters
13991
- # @return [ReportWithRows]
13992
- def get_report_ba_sor_gst_list(xero_tenant_id, opts = {})
13993
- data, _status_code, _headers = get_report_ba_sor_gst_list_with_http_info(xero_tenant_id, opts)
13994
- data
13995
- end
13996
-
13997
- # Retrieves report for BAS (only valid for AU orgs)
13998
- # @param xero_tenant_id [String] Xero identifier for Tenant
13999
- # @param [Hash] opts the optional parameters
14000
- # @return [Array<(ReportWithRows, Integer, Hash)>] ReportWithRows data, response status code and response headers
14001
- def get_report_ba_sor_gst_list_with_http_info(xero_tenant_id, options = {})
14002
- opts = options.dup
14003
- if @api_client.config.debugging
14004
- @api_client.config.logger.debug 'Calling API: AccountingApi.get_report_ba_sor_gst_list ...'
14005
- end
14006
- # verify the required parameter 'xero_tenant_id' is set
14007
- if @api_client.config.client_side_validation && xero_tenant_id.nil?
14008
- fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_report_ba_sor_gst_list"
14009
- end
14010
- # resource path
14011
- local_var_path = '/Reports'
14012
-
14013
- # camelize keys of incoming `where` opts
14014
- opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
14015
-
14016
- # query parameters
14017
- query_params = opts[:query_params] || {}
14018
-
14019
- # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
14020
- query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
14021
- query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
14022
-
14023
- # header parameters
14024
- header_params = opts[:header_params] || {}
14025
- # HTTP header 'Accept' (if needed)
14026
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
14027
- header_params[:'xero-tenant-id'] = xero_tenant_id
14028
-
14029
- # form parameters
14030
- form_params = opts[:form_params] || {}
14031
-
14032
- # http body (model)
14033
- post_body = opts[:body]
14034
-
14035
- # return_type
14036
- return_type = opts[:return_type] || 'ReportWithRows'
14037
-
14038
- # auth_names
14039
- auth_names = opts[:auth_names] || ['OAuth2']
14040
-
14041
- new_options = opts.merge(
14042
- :header_params => header_params,
14043
- :query_params => query_params,
14044
- :form_params => form_params,
14045
- :body => post_body,
14046
- :auth_names => auth_names,
14047
- :return_type => return_type
14048
- )
14049
-
14050
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
14051
- if @api_client.config.debugging
14052
- @api_client.config.logger.debug "API called: AccountingApi#get_report_ba_sor_gst_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
14053
- end
14054
- return data, status_code, headers
14055
- end
14056
-
14057
14072
  # Retrieves report for balancesheet
14058
14073
  # @param xero_tenant_id [String] Xero identifier for Tenant
14059
14074
  # @param [Hash] opts the optional parameters
@@ -14227,7 +14242,7 @@ module XeroRuby
14227
14242
  # @param xero_tenant_id [String] Xero identifier for Tenant
14228
14243
  # @param [Hash] opts the optional parameters
14229
14244
  # @option opts [Date] :date The date for the Bank Summary report e.g. 2018-03-31
14230
- # @option opts [Integer] :period The number of periods to compare (integer between 1 and 12)
14245
+ # @option opts [Integer] :periods The number of periods to compare (integer between 1 and 12)
14231
14246
  # @option opts [Integer] :timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year)
14232
14247
  # @return [ReportWithRows]
14233
14248
  def get_report_budget_summary(xero_tenant_id, opts = {})
@@ -14239,7 +14254,7 @@ module XeroRuby
14239
14254
  # @param xero_tenant_id [String] Xero identifier for Tenant
14240
14255
  # @param [Hash] opts the optional parameters
14241
14256
  # @option opts [Date] :date The date for the Bank Summary report e.g. 2018-03-31
14242
- # @option opts [Integer] :period The number of periods to compare (integer between 1 and 12)
14257
+ # @option opts [Integer] :periods The number of periods to compare (integer between 1 and 12)
14243
14258
  # @option opts [Integer] :timeframe The period size to compare to (1&#x3D;month, 3&#x3D;quarter, 12&#x3D;year)
14244
14259
  # @return [Array<(ReportWithRows, Integer, Hash)>] ReportWithRows data, response status code and response headers
14245
14260
  def get_report_budget_summary_with_http_info(xero_tenant_id, options = {})
@@ -14260,7 +14275,7 @@ module XeroRuby
14260
14275
  # query parameters
14261
14276
  query_params = opts[:query_params] || {}
14262
14277
  query_params[:'date'] = opts[:'date'] if !opts[:'date'].nil?
14263
- query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?
14278
+ query_params[:'periods'] = opts[:'periods'] if !opts[:'periods'].nil?
14264
14279
  query_params[:'timeframe'] = opts[:'timeframe'] if !opts[:'timeframe'].nil?
14265
14280
 
14266
14281
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
@@ -14373,6 +14388,81 @@ module XeroRuby
14373
14388
  return data, status_code, headers
14374
14389
  end
14375
14390
 
14391
+ # Retrieves a specific report using a unique ReportID
14392
+ # @param xero_tenant_id [String] Xero identifier for Tenant
14393
+ # @param report_id [String] Unique identifier for a Report
14394
+ # @param [Hash] opts the optional parameters
14395
+ # @return [ReportWithRows]
14396
+ def get_report_from_id(xero_tenant_id, report_id, opts = {})
14397
+ data, _status_code, _headers = get_report_from_id_with_http_info(xero_tenant_id, report_id, opts)
14398
+ data
14399
+ end
14400
+
14401
+ # Retrieves a specific report using a unique ReportID
14402
+ # @param xero_tenant_id [String] Xero identifier for Tenant
14403
+ # @param report_id [String] Unique identifier for a Report
14404
+ # @param [Hash] opts the optional parameters
14405
+ # @return [Array<(ReportWithRows, Integer, Hash)>] ReportWithRows data, response status code and response headers
14406
+ def get_report_from_id_with_http_info(xero_tenant_id, report_id, options = {})
14407
+ opts = options.dup
14408
+ if @api_client.config.debugging
14409
+ @api_client.config.logger.debug 'Calling API: AccountingApi.get_report_from_id ...'
14410
+ end
14411
+ # verify the required parameter 'xero_tenant_id' is set
14412
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
14413
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_report_from_id"
14414
+ end
14415
+ # verify the required parameter 'report_id' is set
14416
+ if @api_client.config.client_side_validation && report_id.nil?
14417
+ fail ArgumentError, "Missing the required parameter 'report_id' when calling AccountingApi.get_report_from_id"
14418
+ end
14419
+ # resource path
14420
+ local_var_path = '/Reports/{ReportID}'.sub('{' + 'ReportID' + '}', report_id.to_s)
14421
+
14422
+ # camelize keys of incoming `where` opts
14423
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
14424
+
14425
+ # query parameters
14426
+ query_params = opts[:query_params] || {}
14427
+
14428
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
14429
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
14430
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
14431
+
14432
+ # header parameters
14433
+ header_params = opts[:header_params] || {}
14434
+ # HTTP header 'Accept' (if needed)
14435
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
14436
+ header_params[:'xero-tenant-id'] = xero_tenant_id
14437
+
14438
+ # form parameters
14439
+ form_params = opts[:form_params] || {}
14440
+
14441
+ # http body (model)
14442
+ post_body = opts[:body]
14443
+
14444
+ # return_type
14445
+ return_type = opts[:return_type] || 'ReportWithRows'
14446
+
14447
+ # auth_names
14448
+ auth_names = opts[:auth_names] || ['OAuth2']
14449
+
14450
+ new_options = opts.merge(
14451
+ :header_params => header_params,
14452
+ :query_params => query_params,
14453
+ :form_params => form_params,
14454
+ :body => post_body,
14455
+ :auth_names => auth_names,
14456
+ :return_type => return_type
14457
+ )
14458
+
14459
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
14460
+ if @api_client.config.debugging
14461
+ @api_client.config.logger.debug "API called: AccountingApi#get_report_from_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
14462
+ end
14463
+ return data, status_code, headers
14464
+ end
14465
+
14376
14466
  # Retrieves report for profit and loss
14377
14467
  # @param xero_tenant_id [String] Xero identifier for Tenant
14378
14468
  # @param [Hash] opts the optional parameters
@@ -14623,6 +14713,75 @@ module XeroRuby
14623
14713
  return data, status_code, headers
14624
14714
  end
14625
14715
 
14716
+ # Retrieves a list of the organistaions unique reports that require a uuid to fetch
14717
+ # @param xero_tenant_id [String] Xero identifier for Tenant
14718
+ # @param [Hash] opts the optional parameters
14719
+ # @return [ReportWithRows]
14720
+ def get_reports_list(xero_tenant_id, opts = {})
14721
+ data, _status_code, _headers = get_reports_list_with_http_info(xero_tenant_id, opts)
14722
+ data
14723
+ end
14724
+
14725
+ # Retrieves a list of the organistaions unique reports that require a uuid to fetch
14726
+ # @param xero_tenant_id [String] Xero identifier for Tenant
14727
+ # @param [Hash] opts the optional parameters
14728
+ # @return [Array<(ReportWithRows, Integer, Hash)>] ReportWithRows data, response status code and response headers
14729
+ def get_reports_list_with_http_info(xero_tenant_id, options = {})
14730
+ opts = options.dup
14731
+ if @api_client.config.debugging
14732
+ @api_client.config.logger.debug 'Calling API: AccountingApi.get_reports_list ...'
14733
+ end
14734
+ # verify the required parameter 'xero_tenant_id' is set
14735
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
14736
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_reports_list"
14737
+ end
14738
+ # resource path
14739
+ local_var_path = '/Reports'
14740
+
14741
+ # camelize keys of incoming `where` opts
14742
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
14743
+
14744
+ # query parameters
14745
+ query_params = opts[:query_params] || {}
14746
+
14747
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
14748
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
14749
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
14750
+
14751
+ # header parameters
14752
+ header_params = opts[:header_params] || {}
14753
+ # HTTP header 'Accept' (if needed)
14754
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
14755
+ header_params[:'xero-tenant-id'] = xero_tenant_id
14756
+
14757
+ # form parameters
14758
+ form_params = opts[:form_params] || {}
14759
+
14760
+ # http body (model)
14761
+ post_body = opts[:body]
14762
+
14763
+ # return_type
14764
+ return_type = opts[:return_type] || 'ReportWithRows'
14765
+
14766
+ # auth_names
14767
+ auth_names = opts[:auth_names] || ['OAuth2']
14768
+
14769
+ new_options = opts.merge(
14770
+ :header_params => header_params,
14771
+ :query_params => query_params,
14772
+ :form_params => form_params,
14773
+ :body => post_body,
14774
+ :auth_names => auth_names,
14775
+ :return_type => return_type
14776
+ )
14777
+
14778
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AccountingApi", new_options)
14779
+ if @api_client.config.debugging
14780
+ @api_client.config.logger.debug "API called: AccountingApi#get_reports_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
14781
+ end
14782
+ return data, status_code, headers
14783
+ end
14784
+
14626
14785
  # Retrieves tax rates
14627
14786
  # @param xero_tenant_id [String] Xero identifier for Tenant
14628
14787
  # @param [Hash] opts the optional parameters