xero-ruby 1.0 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -3
  3. data/build_notes.md +21 -0
  4. data/docs/accounting/AccountingApi.md +1514 -722
  5. data/docs/accounting/Allocation.md +11 -1
  6. data/docs/accounting/BankTransfer.md +1 -1
  7. data/docs/accounting/BatchPayment.md +1 -1
  8. data/docs/accounting/Contact.md +2 -2
  9. data/docs/accounting/CreditNote.md +2 -2
  10. data/docs/accounting/Invoice.md +2 -2
  11. data/docs/accounting/Journal.md +1 -1
  12. data/docs/accounting/ManualJournalLine.md +2 -0
  13. data/docs/accounting/Organisation.md +3 -1
  14. data/docs/accounting/Payment.md +6 -4
  15. data/docs/accounting/Quote.md +5 -1
  16. data/docs/accounting/Report.md +1 -1
  17. data/docs/accounting/{TenNinteyNineContact.md → TenNinetyNineContact.md} +2 -2
  18. data/docs/assets/AssetApi.md +40 -16
  19. data/docs/assets/AssetType.md +1 -1
  20. data/docs/projects/Amount.md +19 -0
  21. data/docs/projects/ChargeType.md +16 -0
  22. data/docs/projects/CurrencyCode.md +16 -0
  23. data/docs/projects/Error.md +19 -0
  24. data/docs/projects/Pagination.md +23 -0
  25. data/docs/projects/Project.md +59 -0
  26. data/docs/projects/ProjectApi.md +979 -0
  27. data/docs/projects/ProjectCreateOrUpdate.md +23 -0
  28. data/docs/projects/ProjectPatch.md +17 -0
  29. data/docs/projects/ProjectStatus.md +16 -0
  30. data/docs/projects/ProjectUser.md +21 -0
  31. data/docs/projects/ProjectUsers.md +19 -0
  32. data/docs/projects/Projects.md +19 -0
  33. data/docs/projects/Task.md +45 -0
  34. data/docs/projects/TaskCreateOrUpdate.md +23 -0
  35. data/docs/projects/Tasks.md +19 -0
  36. data/docs/projects/TimeEntries.md +19 -0
  37. data/docs/projects/TimeEntry.md +33 -0
  38. data/docs/projects/TimeEntryCreateOrUpdate.md +25 -0
  39. data/lib/xero-ruby.rb +22 -3
  40. data/lib/xero-ruby/api/accounting_api.rb +85 -9
  41. data/lib/xero-ruby/api/asset_api.rb +3 -3
  42. data/lib/xero-ruby/api/project_api.rb +1035 -0
  43. data/lib/xero-ruby/api_client.rb +103 -37
  44. data/lib/xero-ruby/api_error.rb +2 -2
  45. data/lib/xero-ruby/configuration.rb +4 -5
  46. data/lib/xero-ruby/models/accounting/account.rb +61 -20
  47. data/lib/xero-ruby/models/accounting/account_type.rb +2 -2
  48. data/lib/xero-ruby/models/accounting/accounts.rb +8 -3
  49. data/lib/xero-ruby/models/accounting/accounts_payable.rb +11 -5
  50. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +11 -5
  51. data/lib/xero-ruby/models/accounting/address.rb +19 -12
  52. data/lib/xero-ruby/models/accounting/allocation.rb +66 -9
  53. data/lib/xero-ruby/models/accounting/allocations.rb +8 -3
  54. data/lib/xero-ruby/models/accounting/attachment.rb +12 -8
  55. data/lib/xero-ruby/models/accounting/attachments.rb +8 -3
  56. data/lib/xero-ruby/models/accounting/balances.rb +9 -3
  57. data/lib/xero-ruby/models/accounting/bank_transaction.rb +43 -24
  58. data/lib/xero-ruby/models/accounting/bank_transactions.rb +8 -3
  59. data/lib/xero-ruby/models/accounting/bank_transfer.rb +20 -14
  60. data/lib/xero-ruby/models/accounting/bank_transfers.rb +8 -3
  61. data/lib/xero-ruby/models/accounting/batch_payment.rb +29 -19
  62. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +11 -7
  63. data/lib/xero-ruby/models/accounting/batch_payments.rb +8 -3
  64. data/lib/xero-ruby/models/accounting/bill.rb +8 -3
  65. data/lib/xero-ruby/models/accounting/branding_theme.rb +13 -8
  66. data/lib/xero-ruby/models/accounting/branding_themes.rb +8 -3
  67. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +9 -5
  68. data/lib/xero-ruby/models/accounting/cis_setting.rb +8 -4
  69. data/lib/xero-ruby/models/accounting/cis_settings.rb +8 -3
  70. data/lib/xero-ruby/models/accounting/contact.rb +51 -37
  71. data/lib/xero-ruby/models/accounting/contact_group.rb +12 -6
  72. data/lib/xero-ruby/models/accounting/contact_groups.rb +8 -3
  73. data/lib/xero-ruby/models/accounting/contact_person.rb +10 -6
  74. data/lib/xero-ruby/models/accounting/contacts.rb +8 -3
  75. data/lib/xero-ruby/models/accounting/country_code.rb +2 -2
  76. data/lib/xero-ruby/models/accounting/credit_note.rb +47 -30
  77. data/lib/xero-ruby/models/accounting/credit_notes.rb +8 -3
  78. data/lib/xero-ruby/models/accounting/currencies.rb +8 -3
  79. data/lib/xero-ruby/models/accounting/currency.rb +9 -4
  80. data/lib/xero-ruby/models/accounting/currency_code.rb +4 -4
  81. data/lib/xero-ruby/models/accounting/element.rb +14 -4
  82. data/lib/xero-ruby/models/accounting/employee.rb +17 -8
  83. data/lib/xero-ruby/models/accounting/employees.rb +8 -3
  84. data/lib/xero-ruby/models/accounting/error.rb +10 -6
  85. data/lib/xero-ruby/models/accounting/expense_claim.rb +26 -15
  86. data/lib/xero-ruby/models/accounting/expense_claims.rb +8 -3
  87. data/lib/xero-ruby/models/accounting/external_link.rb +14 -4
  88. data/lib/xero-ruby/models/accounting/history_record.rb +10 -6
  89. data/lib/xero-ruby/models/accounting/history_records.rb +8 -3
  90. data/lib/xero-ruby/models/accounting/invoice.rb +69 -46
  91. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +7 -3
  92. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +8 -3
  93. data/lib/xero-ruby/models/accounting/invoices.rb +8 -3
  94. data/lib/xero-ruby/models/accounting/item.rb +24 -18
  95. data/lib/xero-ruby/models/accounting/items.rb +8 -3
  96. data/lib/xero-ruby/models/accounting/journal.rb +40 -11
  97. data/lib/xero-ruby/models/accounting/journal_line.rb +21 -16
  98. data/lib/xero-ruby/models/accounting/journals.rb +8 -3
  99. data/lib/xero-ruby/models/accounting/line_amount_types.rb +2 -2
  100. data/lib/xero-ruby/models/accounting/line_item.rb +25 -21
  101. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +10 -6
  102. data/lib/xero-ruby/models/accounting/linked_transaction.rb +25 -13
  103. data/lib/xero-ruby/models/accounting/linked_transactions.rb +8 -3
  104. data/lib/xero-ruby/models/accounting/manual_journal.rb +25 -15
  105. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +26 -12
  106. data/lib/xero-ruby/models/accounting/manual_journals.rb +8 -3
  107. data/lib/xero-ruby/models/accounting/online_invoice.rb +7 -3
  108. data/lib/xero-ruby/models/accounting/online_invoices.rb +8 -3
  109. data/lib/xero-ruby/models/accounting/organisation.rb +122 -32
  110. data/lib/xero-ruby/models/accounting/organisations.rb +8 -3
  111. data/lib/xero-ruby/models/accounting/overpayment.rb +36 -23
  112. data/lib/xero-ruby/models/accounting/overpayments.rb +8 -3
  113. data/lib/xero-ruby/models/accounting/payment.rb +57 -24
  114. data/lib/xero-ruby/models/accounting/payment_delete.rb +7 -3
  115. data/lib/xero-ruby/models/accounting/payment_service.rb +12 -8
  116. data/lib/xero-ruby/models/accounting/payment_services.rb +8 -3
  117. data/lib/xero-ruby/models/accounting/payment_term.rb +9 -3
  118. data/lib/xero-ruby/models/accounting/payment_term_type.rb +2 -2
  119. data/lib/xero-ruby/models/accounting/payments.rb +8 -3
  120. data/lib/xero-ruby/models/accounting/phone.rb +16 -6
  121. data/lib/xero-ruby/models/accounting/prepayment.rb +37 -23
  122. data/lib/xero-ruby/models/accounting/prepayments.rb +8 -3
  123. data/lib/xero-ruby/models/accounting/purchase.rb +11 -7
  124. data/lib/xero-ruby/models/accounting/purchase_order.rb +45 -33
  125. data/lib/xero-ruby/models/accounting/purchase_orders.rb +8 -3
  126. data/lib/xero-ruby/models/accounting/quote.rb +58 -28
  127. data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +2 -2
  128. data/lib/xero-ruby/models/accounting/quote_status_codes.rb +3 -2
  129. data/lib/xero-ruby/models/accounting/quotes.rb +8 -3
  130. data/lib/xero-ruby/models/accounting/receipt.rb +32 -19
  131. data/lib/xero-ruby/models/accounting/receipts.rb +8 -3
  132. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +30 -17
  133. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +8 -3
  134. data/lib/xero-ruby/models/accounting/report.rb +15 -9
  135. data/lib/xero-ruby/models/accounting/report_attribute.rb +9 -3
  136. data/lib/xero-ruby/models/accounting/report_cell.rb +9 -3
  137. data/lib/xero-ruby/models/accounting/report_fields.rb +10 -3
  138. data/lib/xero-ruby/models/accounting/report_row.rb +10 -3
  139. data/lib/xero-ruby/models/accounting/report_rows.rb +11 -3
  140. data/lib/xero-ruby/models/accounting/report_with_row.rb +15 -9
  141. data/lib/xero-ruby/models/accounting/report_with_rows.rb +8 -3
  142. data/lib/xero-ruby/models/accounting/reports.rb +8 -3
  143. data/lib/xero-ruby/models/accounting/request_empty.rb +7 -3
  144. data/lib/xero-ruby/models/accounting/row_type.rb +2 -2
  145. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +8 -4
  146. data/lib/xero-ruby/models/accounting/schedule.rb +23 -11
  147. data/lib/xero-ruby/models/accounting/tax_component.rb +11 -7
  148. data/lib/xero-ruby/models/accounting/tax_rate.rb +100 -18
  149. data/lib/xero-ruby/models/accounting/tax_rates.rb +8 -3
  150. data/lib/xero-ruby/models/accounting/tax_type.rb +6 -2
  151. data/lib/xero-ruby/models/accounting/{ten_nintey_nine_contact.rb → ten_ninety_nine_contact.rb} +44 -40
  152. data/lib/xero-ruby/models/accounting/time_zone.rb +2 -2
  153. data/lib/xero-ruby/models/accounting/tracking_categories.rb +8 -3
  154. data/lib/xero-ruby/models/accounting/tracking_category.rb +15 -8
  155. data/lib/xero-ruby/models/accounting/tracking_option.rb +13 -6
  156. data/lib/xero-ruby/models/accounting/tracking_options.rb +8 -3
  157. data/lib/xero-ruby/models/accounting/user.rb +20 -9
  158. data/lib/xero-ruby/models/accounting/users.rb +8 -3
  159. data/lib/xero-ruby/models/accounting/validation_error.rb +7 -3
  160. data/lib/xero-ruby/models/assets/asset.rb +24 -17
  161. data/lib/xero-ruby/models/assets/asset_status.rb +2 -2
  162. data/lib/xero-ruby/models/assets/asset_status_query_param.rb +2 -2
  163. data/lib/xero-ruby/models/assets/asset_type.rb +13 -13
  164. data/lib/xero-ruby/models/assets/assets.rb +9 -3
  165. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +19 -15
  166. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +26 -11
  167. data/lib/xero-ruby/models/assets/error.rb +11 -7
  168. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +12 -8
  169. data/lib/xero-ruby/models/assets/pagination.rb +11 -3
  170. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +11 -7
  171. data/lib/xero-ruby/models/assets/setting.rb +14 -10
  172. data/lib/xero-ruby/models/projects/amount.rb +218 -0
  173. data/lib/xero-ruby/models/projects/charge_type.rb +38 -0
  174. data/lib/xero-ruby/models/projects/currency_code.rb +199 -0
  175. data/lib/xero-ruby/models/projects/error.rb +218 -0
  176. data/lib/xero-ruby/models/projects/pagination.rb +238 -0
  177. data/lib/xero-ruby/models/projects/project.rb +423 -0
  178. data/lib/xero-ruby/models/projects/project_create_or_update.rb +243 -0
  179. data/lib/xero-ruby/models/projects/project_patch.rb +213 -0
  180. data/lib/xero-ruby/models/projects/project_status.rb +37 -0
  181. data/lib/xero-ruby/models/projects/project_user.rb +228 -0
  182. data/lib/xero-ruby/models/projects/project_users.rb +220 -0
  183. data/lib/xero-ruby/models/projects/projects.rb +220 -0
  184. data/lib/xero-ruby/models/projects/task.rb +385 -0
  185. data/lib/xero-ruby/models/projects/task_create_or_update.rb +253 -0
  186. data/lib/xero-ruby/models/projects/tasks.rb +220 -0
  187. data/lib/xero-ruby/models/projects/time_entries.rb +220 -0
  188. data/lib/xero-ruby/models/projects/time_entry.rb +324 -0
  189. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +268 -0
  190. data/lib/xero-ruby/version.rb +3 -3
  191. data/spec/accounting/api/accounting_api_spec.rb +19 -6
  192. data/spec/accounting/models/account_spec.rb +1 -1
  193. data/spec/accounting/models/account_type_spec.rb +1 -1
  194. data/spec/accounting/models/accounts_payable_spec.rb +1 -1
  195. data/spec/accounting/models/accounts_receivable_spec.rb +1 -1
  196. data/spec/accounting/models/accounts_spec.rb +1 -1
  197. data/spec/accounting/models/address_spec.rb +1 -1
  198. data/spec/accounting/models/allocation_spec.rb +1 -1
  199. data/spec/accounting/models/allocations_spec.rb +1 -1
  200. data/spec/accounting/models/attachment_spec.rb +1 -1
  201. data/spec/accounting/models/attachments_spec.rb +1 -1
  202. data/spec/accounting/models/balances_spec.rb +1 -1
  203. data/spec/accounting/models/bank_transaction_spec.rb +1 -1
  204. data/spec/accounting/models/bank_transactions_spec.rb +1 -1
  205. data/spec/accounting/models/bank_transfer_spec.rb +1 -1
  206. data/spec/accounting/models/bank_transfers_spec.rb +1 -1
  207. data/spec/accounting/models/batch_payment_details_spec.rb +1 -1
  208. data/spec/accounting/models/batch_payment_spec.rb +1 -1
  209. data/spec/accounting/models/batch_payments_spec.rb +1 -1
  210. data/spec/accounting/models/bill_spec.rb +1 -1
  211. data/spec/accounting/models/branding_theme_spec.rb +1 -1
  212. data/spec/accounting/models/branding_themes_spec.rb +1 -1
  213. data/spec/accounting/models/cis_org_setting_spec.rb +1 -1
  214. data/spec/accounting/models/cis_setting_spec.rb +1 -1
  215. data/spec/accounting/models/cis_settings_spec.rb +1 -1
  216. data/spec/accounting/models/contact_group_spec.rb +1 -1
  217. data/spec/accounting/models/contact_groups_spec.rb +1 -1
  218. data/spec/accounting/models/contact_person_spec.rb +1 -1
  219. data/spec/accounting/models/contact_spec.rb +1 -1
  220. data/spec/accounting/models/contacts_spec.rb +1 -1
  221. data/spec/accounting/models/country_code_spec.rb +1 -1
  222. data/spec/accounting/models/credit_note_spec.rb +1 -1
  223. data/spec/accounting/models/credit_notes_spec.rb +1 -1
  224. data/spec/accounting/models/currencies_spec.rb +1 -1
  225. data/spec/accounting/models/currency_code_spec.rb +1 -1
  226. data/spec/accounting/models/currency_spec.rb +1 -1
  227. data/spec/accounting/models/element_spec.rb +1 -1
  228. data/spec/accounting/models/employee_spec.rb +1 -1
  229. data/spec/accounting/models/employees_spec.rb +1 -1
  230. data/spec/accounting/models/error_spec.rb +1 -1
  231. data/spec/accounting/models/expense_claim_spec.rb +1 -1
  232. data/spec/accounting/models/expense_claims_spec.rb +1 -1
  233. data/spec/accounting/models/external_link_spec.rb +1 -1
  234. data/spec/accounting/models/history_record_spec.rb +1 -1
  235. data/spec/accounting/models/history_records_spec.rb +1 -1
  236. data/spec/accounting/models/invoice_reminder_spec.rb +1 -1
  237. data/spec/accounting/models/invoice_reminders_spec.rb +1 -1
  238. data/spec/accounting/models/invoice_spec.rb +1 -1
  239. data/spec/accounting/models/invoices_spec.rb +1 -1
  240. data/spec/accounting/models/item_spec.rb +1 -1
  241. data/spec/accounting/models/items_spec.rb +1 -1
  242. data/spec/accounting/models/journal_line_spec.rb +1 -1
  243. data/spec/accounting/models/journal_spec.rb +1 -1
  244. data/spec/accounting/models/journals_spec.rb +1 -1
  245. data/spec/accounting/models/line_amount_types_spec.rb +1 -1
  246. data/spec/accounting/models/line_item_spec.rb +1 -1
  247. data/spec/accounting/models/line_item_tracking_spec.rb +1 -1
  248. data/spec/accounting/models/linked_transaction_spec.rb +1 -1
  249. data/spec/accounting/models/linked_transactions_spec.rb +1 -1
  250. data/spec/accounting/models/manual_journal_line_spec.rb +1 -1
  251. data/spec/accounting/models/manual_journal_spec.rb +1 -1
  252. data/spec/accounting/models/manual_journals_spec.rb +1 -1
  253. data/spec/accounting/models/online_invoice_spec.rb +1 -1
  254. data/spec/accounting/models/online_invoices_spec.rb +1 -1
  255. data/spec/accounting/models/organisation_spec.rb +1 -1
  256. data/spec/accounting/models/organisations_spec.rb +1 -1
  257. data/spec/accounting/models/overpayment_spec.rb +1 -1
  258. data/spec/accounting/models/overpayments_spec.rb +1 -1
  259. data/spec/accounting/models/payment_delete_spec.rb +1 -1
  260. data/spec/accounting/models/payment_service_spec.rb +1 -1
  261. data/spec/accounting/models/payment_services_spec.rb +1 -1
  262. data/spec/accounting/models/payment_spec.rb +7 -1
  263. data/spec/accounting/models/payment_term_spec.rb +1 -1
  264. data/spec/accounting/models/payment_term_type_spec.rb +1 -1
  265. data/spec/accounting/models/payments_spec.rb +1 -1
  266. data/spec/accounting/models/phone_spec.rb +1 -1
  267. data/spec/accounting/models/prepayment_spec.rb +1 -1
  268. data/spec/accounting/models/prepayments_spec.rb +1 -1
  269. data/spec/accounting/models/purchase_order_spec.rb +1 -1
  270. data/spec/accounting/models/purchase_orders_spec.rb +1 -1
  271. data/spec/accounting/models/purchase_spec.rb +1 -1
  272. data/spec/accounting/models/quote_line_amount_types_spec.rb +1 -1
  273. data/spec/accounting/models/quote_spec.rb +1 -1
  274. data/spec/accounting/models/quote_status_codes_spec.rb +1 -1
  275. data/spec/accounting/models/quotes_spec.rb +1 -1
  276. data/spec/accounting/models/receipt_spec.rb +1 -1
  277. data/spec/accounting/models/receipts_spec.rb +1 -1
  278. data/spec/accounting/models/repeating_invoice_spec.rb +1 -1
  279. data/spec/accounting/models/repeating_invoices_spec.rb +1 -1
  280. data/spec/accounting/models/report_attribute_spec.rb +1 -1
  281. data/spec/accounting/models/report_cell_spec.rb +1 -1
  282. data/spec/accounting/models/report_fields_spec.rb +1 -1
  283. data/spec/accounting/models/report_row_spec.rb +1 -1
  284. data/spec/accounting/models/report_rows_spec.rb +1 -1
  285. data/spec/accounting/models/report_spec.rb +1 -1
  286. data/spec/accounting/models/report_with_row_spec.rb +1 -1
  287. data/spec/accounting/models/report_with_rows_spec.rb +1 -1
  288. data/spec/accounting/models/reports_spec.rb +1 -1
  289. data/spec/accounting/models/request_empty_spec.rb +1 -1
  290. data/spec/accounting/models/row_type_spec.rb +1 -1
  291. data/spec/accounting/models/sales_tracking_category_spec.rb +1 -1
  292. data/spec/accounting/models/schedule_spec.rb +1 -1
  293. data/spec/accounting/models/tax_component_spec.rb +1 -1
  294. data/spec/accounting/models/tax_rate_spec.rb +2 -2
  295. data/spec/accounting/models/tax_rates_spec.rb +1 -1
  296. data/spec/accounting/models/tax_type_spec.rb +1 -1
  297. data/spec/accounting/models/ten_nintey_nine_contact_spec.rb +7 -7
  298. data/spec/accounting/models/time_zone_spec.rb +1 -1
  299. data/spec/accounting/models/tracking_categories_spec.rb +1 -1
  300. data/spec/accounting/models/tracking_category_spec.rb +1 -1
  301. data/spec/accounting/models/tracking_option_spec.rb +1 -1
  302. data/spec/accounting/models/tracking_options_spec.rb +1 -1
  303. data/spec/accounting/models/user_spec.rb +1 -1
  304. data/spec/accounting/models/users_spec.rb +1 -1
  305. data/spec/accounting/models/validation_error_spec.rb +1 -1
  306. data/spec/api_client_spec.rb +120 -33
  307. data/spec/assets/api/asset_api_spec.rb +4 -4
  308. data/spec/assets/models/asset_spec.rb +1 -1
  309. data/spec/assets/models/asset_status_query_param_spec.rb +1 -1
  310. data/spec/assets/models/asset_status_spec.rb +1 -1
  311. data/spec/assets/models/asset_type_spec.rb +1 -1
  312. data/spec/assets/models/assets_spec.rb +1 -1
  313. data/spec/assets/models/book_depreciation_detail_spec.rb +1 -1
  314. data/spec/assets/models/book_depreciation_setting_spec.rb +1 -1
  315. data/spec/assets/models/error_spec.rb +1 -1
  316. data/spec/assets/models/field_validation_errors_element_spec.rb +1 -1
  317. data/spec/assets/models/pagination_spec.rb +1 -1
  318. data/spec/assets/models/resource_validation_errors_element_spec.rb +1 -1
  319. data/spec/assets/models/setting_spec.rb +1 -1
  320. data/spec/configuration_spec.rb +8 -24
  321. data/spec/projects/api/project_api_spec.rb +229 -0
  322. data/spec/projects/models/amount_spec.rb +47 -0
  323. data/spec/projects/models/charge_type_spec.rb +35 -0
  324. data/spec/projects/models/currency_code_spec.rb +35 -0
  325. data/spec/projects/models/error_spec.rb +47 -0
  326. data/spec/projects/models/pagination_spec.rb +59 -0
  327. data/spec/projects/models/project_create_or_update_spec.rb +59 -0
  328. data/spec/projects/models/project_patch_spec.rb +41 -0
  329. data/spec/projects/models/project_spec.rb +167 -0
  330. data/spec/projects/models/project_status_spec.rb +35 -0
  331. data/spec/projects/models/project_user_spec.rb +53 -0
  332. data/spec/projects/models/project_users_spec.rb +47 -0
  333. data/spec/projects/models/projects_spec.rb +47 -0
  334. data/spec/projects/models/task_create_or_update_spec.rb +59 -0
  335. data/spec/projects/models/task_spec.rb +129 -0
  336. data/spec/projects/models/tasks_spec.rb +47 -0
  337. data/spec/projects/models/time_entries_spec.rb +47 -0
  338. data/spec/projects/models/time_entry_create_or_update_spec.rb +65 -0
  339. data/spec/projects/models/time_entry_spec.rb +93 -0
  340. data/spec/spec_helper.rb +1 -1
  341. data/xero-ruby.gemspec +3 -4
  342. metadata +85 -9
  343. data/xero-ruby.gem +0 -0
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.11
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby::Projects
17
+ require 'bigdecimal'
18
+
19
+ class ProjectPatch
20
+
21
+ attr_accessor :status
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'status' => :'status'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'status' => :'ProjectStatus'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ if (!attributes.is_a?(Hash))
41
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::ProjectPatch` initialize method"
42
+ end
43
+
44
+ # check to see if the attribute exists and convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h|
46
+ if (!self.class.attribute_map.key?(k.to_sym))
47
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::ProjectPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
48
+ end
49
+ h[k.to_sym] = v
50
+ }
51
+
52
+ if attributes.key?(:'status')
53
+ self.status = attributes[:'status']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ if @status.nil?
62
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
63
+ end
64
+
65
+ invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return false if @status.nil?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ status == o.status
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [status].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(parse_date(value))
130
+ when :Date
131
+ Date.parse(parse_date(value))
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BigDecimal
139
+ BigDecimal(value.to_s)
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ # customized data_parser
208
+ def parse_date(datestring)
209
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
210
+ return Time.at(seconds_since_epoch).to_s
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.11
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby::Projects
17
+ class ProjectStatus
18
+ INPROGRESS = "INPROGRESS".freeze
19
+ CLOSED = "CLOSED".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = ProjectStatus.constants.select { |c| ProjectStatus::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #ProjectStatus" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.11
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby::Projects
17
+ require 'bigdecimal'
18
+
19
+ class ProjectUser
20
+ # Identifier of the user of the project.
21
+ attr_accessor :user_id
22
+
23
+ # Full name of the user.
24
+ attr_accessor :name
25
+
26
+ # Email address of the user.
27
+ attr_accessor :email
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'user_id' => :'userId',
33
+ :'name' => :'name',
34
+ :'email' => :'email'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'user_id' => :'String',
42
+ :'name' => :'String',
43
+ :'email' => :'String'
44
+ }
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::ProjectUser` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::ProjectUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'user_id')
63
+ self.user_id = attributes[:'user_id']
64
+ end
65
+
66
+ if attributes.key?(:'name')
67
+ self.name = attributes[:'name']
68
+ end
69
+
70
+ if attributes.key?(:'email')
71
+ self.email = attributes[:'email']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ user_id == o.user_id &&
94
+ name == o.name &&
95
+ email == o.email
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [user_id, name, email].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ new.build_from_hash(attributes)
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(parse_date(value))
145
+ when :Date
146
+ Date.parse(parse_date(value))
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BigDecimal
154
+ BigDecimal(value.to_s)
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ # customized data_parser
223
+ def parse_date(datestring)
224
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
225
+ return Time.at(seconds_since_epoch).to_s
226
+ end
227
+ end
228
+ end