xero-ruby 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (349) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +454 -0
  5. data/Rakefile +10 -0
  6. data/docs/Account.md +53 -0
  7. data/docs/AccountType.md +16 -0
  8. data/docs/AccountingApi.md +11269 -0
  9. data/docs/Accounts.md +17 -0
  10. data/docs/AccountsPayable.md +19 -0
  11. data/docs/AccountsReceivable.md +19 -0
  12. data/docs/Address.md +35 -0
  13. data/docs/Allocation.md +21 -0
  14. data/docs/Allocations.md +17 -0
  15. data/docs/Attachment.md +27 -0
  16. data/docs/Attachments.md +17 -0
  17. data/docs/Balances.md +19 -0
  18. data/docs/BankTransaction.md +59 -0
  19. data/docs/BankTransactions.md +17 -0
  20. data/docs/BankTransfer.md +37 -0
  21. data/docs/BankTransfers.md +17 -0
  22. data/docs/BatchPayment.md +47 -0
  23. data/docs/BatchPaymentDetails.md +25 -0
  24. data/docs/BatchPayments.md +17 -0
  25. data/docs/Bill.md +19 -0
  26. data/docs/BrandingTheme.md +23 -0
  27. data/docs/BrandingThemes.md +17 -0
  28. data/docs/CISOrgSetting.md +21 -0
  29. data/docs/CISSetting.md +19 -0
  30. data/docs/CISSettings.md +17 -0
  31. data/docs/Contact.md +91 -0
  32. data/docs/ContactGroup.md +23 -0
  33. data/docs/ContactGroups.md +17 -0
  34. data/docs/ContactPerson.md +23 -0
  35. data/docs/Contacts.md +17 -0
  36. data/docs/CountryCode.md +16 -0
  37. data/docs/CreditNote.md +61 -0
  38. data/docs/CreditNotes.md +17 -0
  39. data/docs/Currencies.md +17 -0
  40. data/docs/Currency.md +19 -0
  41. data/docs/CurrencyCode.md +16 -0
  42. data/docs/Element.md +17 -0
  43. data/docs/Employee.md +27 -0
  44. data/docs/Employees.md +17 -0
  45. data/docs/Error.md +23 -0
  46. data/docs/ExpenseClaim.md +39 -0
  47. data/docs/ExpenseClaims.md +17 -0
  48. data/docs/ExternalLink.md +21 -0
  49. data/docs/HistoryRecord.md +23 -0
  50. data/docs/HistoryRecords.md +17 -0
  51. data/docs/Invoice.md +89 -0
  52. data/docs/InvoiceReminder.md +17 -0
  53. data/docs/InvoiceReminders.md +17 -0
  54. data/docs/Invoices.md +17 -0
  55. data/docs/Item.md +45 -0
  56. data/docs/Items.md +17 -0
  57. data/docs/Journal.md +31 -0
  58. data/docs/JournalLine.md +39 -0
  59. data/docs/Journals.md +17 -0
  60. data/docs/LineAmountTypes.md +16 -0
  61. data/docs/LineItem.md +41 -0
  62. data/docs/LineItemTracking.md +21 -0
  63. data/docs/LinkedTransaction.md +37 -0
  64. data/docs/LinkedTransactions.md +17 -0
  65. data/docs/ManualJournal.md +41 -0
  66. data/docs/ManualJournalLine.md +29 -0
  67. data/docs/ManualJournals.md +17 -0
  68. data/docs/OnlineInvoice.md +17 -0
  69. data/docs/OnlineInvoices.md +17 -0
  70. data/docs/Organisation.md +79 -0
  71. data/docs/Organisations.md +17 -0
  72. data/docs/Overpayment.md +51 -0
  73. data/docs/Overpayments.md +17 -0
  74. data/docs/Payment.md +61 -0
  75. data/docs/PaymentService.md +27 -0
  76. data/docs/PaymentServices.md +17 -0
  77. data/docs/PaymentTerm.md +19 -0
  78. data/docs/PaymentTermType.md +16 -0
  79. data/docs/Payments.md +17 -0
  80. data/docs/Phone.md +23 -0
  81. data/docs/Prepayment.md +49 -0
  82. data/docs/Prepayments.md +17 -0
  83. data/docs/Purchase.md +23 -0
  84. data/docs/PurchaseOrder.md +71 -0
  85. data/docs/PurchaseOrders.md +17 -0
  86. data/docs/Receipt.md +49 -0
  87. data/docs/Receipts.md +17 -0
  88. data/docs/RepeatingInvoice.md +47 -0
  89. data/docs/RepeatingInvoices.md +17 -0
  90. data/docs/Report.md +29 -0
  91. data/docs/ReportAttribute.md +19 -0
  92. data/docs/ReportCell.md +19 -0
  93. data/docs/ReportFields.md +21 -0
  94. data/docs/ReportRow.md +21 -0
  95. data/docs/ReportRows.md +23 -0
  96. data/docs/ReportWithRow.md +33 -0
  97. data/docs/ReportWithRows.md +17 -0
  98. data/docs/Reports.md +17 -0
  99. data/docs/RequestEmpty.md +17 -0
  100. data/docs/RowType.md +16 -0
  101. data/docs/SalesTrackingCategory.md +19 -0
  102. data/docs/Schedule.md +29 -0
  103. data/docs/TaxComponent.md +23 -0
  104. data/docs/TaxRate.md +39 -0
  105. data/docs/TaxRates.md +17 -0
  106. data/docs/TaxType.md +16 -0
  107. data/docs/TenNinteyNineContact.md +59 -0
  108. data/docs/TimeZone.md +16 -0
  109. data/docs/TrackingCategories.md +17 -0
  110. data/docs/TrackingCategory.md +27 -0
  111. data/docs/TrackingOption.md +23 -0
  112. data/docs/TrackingOptions.md +17 -0
  113. data/docs/User.md +29 -0
  114. data/docs/Users.md +17 -0
  115. data/docs/ValidationError.md +17 -0
  116. data/git_push.sh +55 -0
  117. data/lib/.DS_Store +0 -0
  118. data/lib/xero-ruby.rb +149 -0
  119. data/lib/xero-ruby/api/accounting_api.rb +14686 -0
  120. data/lib/xero-ruby/api_client.rb +386 -0
  121. data/lib/xero-ruby/api_error.rb +57 -0
  122. data/lib/xero-ruby/configuration.rb +252 -0
  123. data/lib/xero-ruby/models/account.rb +484 -0
  124. data/lib/xero-ruby/models/account_type.rb +57 -0
  125. data/lib/xero-ruby/models/accounts.rb +205 -0
  126. data/lib/xero-ruby/models/accounts_payable.rb +212 -0
  127. data/lib/xero-ruby/models/accounts_receivable.rb +212 -0
  128. data/lib/xero-ruby/models/address.rb +463 -0
  129. data/lib/xero-ruby/models/allocation.rb +238 -0
  130. data/lib/xero-ruby/models/allocations.rb +205 -0
  131. data/lib/xero-ruby/models/attachment.rb +254 -0
  132. data/lib/xero-ruby/models/attachments.rb +205 -0
  133. data/lib/xero-ruby/models/balances.rb +213 -0
  134. data/lib/xero-ruby/models/bank_transaction.rb +480 -0
  135. data/lib/xero-ruby/models/bank_transactions.rb +205 -0
  136. data/lib/xero-ruby/models/bank_transfer.rb +319 -0
  137. data/lib/xero-ruby/models/bank_transfers.rb +205 -0
  138. data/lib/xero-ruby/models/batch_payment.rb +429 -0
  139. data/lib/xero-ruby/models/batch_payment_details.rb +290 -0
  140. data/lib/xero-ruby/models/batch_payments.rb +205 -0
  141. data/lib/xero-ruby/models/bill.rb +213 -0
  142. data/lib/xero-ruby/models/branding_theme.rb +234 -0
  143. data/lib/xero-ruby/models/branding_themes.rb +205 -0
  144. data/lib/xero-ruby/models/cis_org_setting.rb +224 -0
  145. data/lib/xero-ruby/models/cis_setting.rb +214 -0
  146. data/lib/xero-ruby/models/cis_settings.rb +205 -0
  147. data/lib/xero-ruby/models/contact.rb +724 -0
  148. data/lib/xero-ruby/models/contact_group.rb +270 -0
  149. data/lib/xero-ruby/models/contact_groups.rb +205 -0
  150. data/lib/xero-ruby/models/contact_person.rb +234 -0
  151. data/lib/xero-ruby/models/contacts.rb +205 -0
  152. data/lib/xero-ruby/models/country_code.rb +275 -0
  153. data/lib/xero-ruby/models/credit_note.rb +475 -0
  154. data/lib/xero-ruby/models/credit_notes.rb +205 -0
  155. data/lib/xero-ruby/models/currencies.rb +205 -0
  156. data/lib/xero-ruby/models/currency.rb +213 -0
  157. data/lib/xero-ruby/models/currency_code.rb +197 -0
  158. data/lib/xero-ruby/models/element.rb +206 -0
  159. data/lib/xero-ruby/models/employee.rb +316 -0
  160. data/lib/xero-ruby/models/employees.rb +205 -0
  161. data/lib/xero-ruby/models/error.rb +236 -0
  162. data/lib/xero-ruby/models/expense_claim.rb +350 -0
  163. data/lib/xero-ruby/models/expense_claims.rb +205 -0
  164. data/lib/xero-ruby/models/external_link.rb +257 -0
  165. data/lib/xero-ruby/models/history_record.rb +234 -0
  166. data/lib/xero-ruby/models/history_records.rb +205 -0
  167. data/lib/xero-ruby/models/invoice.rb +666 -0
  168. data/lib/xero-ruby/models/invoice_reminder.rb +204 -0
  169. data/lib/xero-ruby/models/invoice_reminders.rb +205 -0
  170. data/lib/xero-ruby/models/invoices.rb +205 -0
  171. data/lib/xero-ruby/models/item.rb +418 -0
  172. data/lib/xero-ruby/models/items.rb +205 -0
  173. data/lib/xero-ruby/models/journal.rb +310 -0
  174. data/lib/xero-ruby/models/journal_line.rb +315 -0
  175. data/lib/xero-ruby/models/journals.rb +205 -0
  176. data/lib/xero-ruby/models/line_amount_types.rb +38 -0
  177. data/lib/xero-ruby/models/line_item.rb +326 -0
  178. data/lib/xero-ruby/models/line_item_tracking.rb +239 -0
  179. data/lib/xero-ruby/models/linked_transaction.rb +369 -0
  180. data/lib/xero-ruby/models/linked_transactions.rb +205 -0
  181. data/lib/xero-ruby/models/manual_journal.rb +375 -0
  182. data/lib/xero-ruby/models/manual_journal_line.rb +266 -0
  183. data/lib/xero-ruby/models/manual_journals.rb +205 -0
  184. data/lib/xero-ruby/models/online_invoice.rb +204 -0
  185. data/lib/xero-ruby/models/online_invoices.rb +205 -0
  186. data/lib/xero-ruby/models/organisation.rb +622 -0
  187. data/lib/xero-ruby/models/organisations.rb +205 -0
  188. data/lib/xero-ruby/models/overpayment.rb +425 -0
  189. data/lib/xero-ruby/models/overpayments.rb +205 -0
  190. data/lib/xero-ruby/models/payment.rb +467 -0
  191. data/lib/xero-ruby/models/payment_service.rb +256 -0
  192. data/lib/xero-ruby/models/payment_services.rb +205 -0
  193. data/lib/xero-ruby/models/payment_term.rb +212 -0
  194. data/lib/xero-ruby/models/payment_term_type.rb +39 -0
  195. data/lib/xero-ruby/models/payments.rb +205 -0
  196. data/lib/xero-ruby/models/phone.rb +312 -0
  197. data/lib/xero-ruby/models/prepayment.rb +413 -0
  198. data/lib/xero-ruby/models/prepayments.rb +205 -0
  199. data/lib/xero-ruby/models/purchase.rb +234 -0
  200. data/lib/xero-ruby/models/purchase_order.rb +523 -0
  201. data/lib/xero-ruby/models/purchase_orders.rb +205 -0
  202. data/lib/xero-ruby/models/receipt.rb +420 -0
  203. data/lib/xero-ruby/models/receipts.rb +205 -0
  204. data/lib/xero-ruby/models/repeating_invoice.rb +400 -0
  205. data/lib/xero-ruby/models/repeating_invoices.rb +205 -0
  206. data/lib/xero-ruby/models/report.rb +299 -0
  207. data/lib/xero-ruby/models/report_attribute.rb +212 -0
  208. data/lib/xero-ruby/models/report_cell.rb +214 -0
  209. data/lib/xero-ruby/models/report_fields.rb +221 -0
  210. data/lib/xero-ruby/models/report_row.rb +223 -0
  211. data/lib/xero-ruby/models/report_rows.rb +234 -0
  212. data/lib/xero-ruby/models/report_with_row.rb +288 -0
  213. data/lib/xero-ruby/models/report_with_rows.rb +205 -0
  214. data/lib/xero-ruby/models/reports.rb +205 -0
  215. data/lib/xero-ruby/models/request_empty.rb +204 -0
  216. data/lib/xero-ruby/models/row_type.rb +39 -0
  217. data/lib/xero-ruby/models/sales_tracking_category.rb +214 -0
  218. data/lib/xero-ruby/models/schedule.rb +310 -0
  219. data/lib/xero-ruby/models/tax_component.rb +234 -0
  220. data/lib/xero-ruby/models/tax_rate.rb +367 -0
  221. data/lib/xero-ruby/models/tax_rates.rb +205 -0
  222. data/lib/xero-ruby/models/tax_type.rb +87 -0
  223. data/lib/xero-ruby/models/ten_nintey_nine_contact.rb +414 -0
  224. data/lib/xero-ruby/models/time_zone.rb +142 -0
  225. data/lib/xero-ruby/models/tracking_categories.rb +205 -0
  226. data/lib/xero-ruby/models/tracking_category.rb +320 -0
  227. data/lib/xero-ruby/models/tracking_option.rb +283 -0
  228. data/lib/xero-ruby/models/tracking_options.rb +205 -0
  229. data/lib/xero-ruby/models/user.rb +298 -0
  230. data/lib/xero-ruby/models/users.rb +205 -0
  231. data/lib/xero-ruby/models/validation_error.rb +204 -0
  232. data/lib/xero-ruby/version.rb +15 -0
  233. data/pkg/xero-ruby-0.1.0.gem +0 -0
  234. data/pkg/xero-ruby-1.0.0.gem +0 -0
  235. data/spec/api/accounting_api_spec.rb +2322 -0
  236. data/spec/api_client_spec.rb +226 -0
  237. data/spec/configuration_spec.rb +42 -0
  238. data/spec/models/account_spec.rb +165 -0
  239. data/spec/models/account_type_spec.rb +35 -0
  240. data/spec/models/accounts_payable_spec.rb +47 -0
  241. data/spec/models/accounts_receivable_spec.rb +47 -0
  242. data/spec/models/accounts_spec.rb +41 -0
  243. data/spec/models/address_spec.rb +99 -0
  244. data/spec/models/allocation_spec.rb +53 -0
  245. data/spec/models/allocations_spec.rb +41 -0
  246. data/spec/models/attachment_spec.rb +71 -0
  247. data/spec/models/attachments_spec.rb +41 -0
  248. data/spec/models/balances_spec.rb +47 -0
  249. data/spec/models/bank_transaction_spec.rb +175 -0
  250. data/spec/models/bank_transactions_spec.rb +41 -0
  251. data/spec/models/bank_transfer_spec.rb +101 -0
  252. data/spec/models/bank_transfers_spec.rb +41 -0
  253. data/spec/models/batch_payment_details_spec.rb +65 -0
  254. data/spec/models/batch_payment_spec.rb +131 -0
  255. data/spec/models/batch_payments_spec.rb +41 -0
  256. data/spec/models/bill_spec.rb +47 -0
  257. data/spec/models/branding_theme_spec.rb +59 -0
  258. data/spec/models/branding_themes_spec.rb +41 -0
  259. data/spec/models/cis_org_setting_spec.rb +53 -0
  260. data/spec/models/cis_setting_spec.rb +47 -0
  261. data/spec/models/cis_settings_spec.rb +41 -0
  262. data/spec/models/contact_group_spec.rb +63 -0
  263. data/spec/models/contact_groups_spec.rb +41 -0
  264. data/spec/models/contact_person_spec.rb +59 -0
  265. data/spec/models/contact_spec.rb +267 -0
  266. data/spec/models/contacts_spec.rb +41 -0
  267. data/spec/models/country_code_spec.rb +35 -0
  268. data/spec/models/credit_note_spec.rb +181 -0
  269. data/spec/models/credit_notes_spec.rb +41 -0
  270. data/spec/models/currencies_spec.rb +41 -0
  271. data/spec/models/currency_code_spec.rb +35 -0
  272. data/spec/models/currency_spec.rb +47 -0
  273. data/spec/models/element_spec.rb +41 -0
  274. data/spec/models/employee_spec.rb +75 -0
  275. data/spec/models/employees_spec.rb +41 -0
  276. data/spec/models/error_spec.rb +59 -0
  277. data/spec/models/expense_claim_spec.rb +111 -0
  278. data/spec/models/expense_claims_spec.rb +41 -0
  279. data/spec/models/external_link_spec.rb +57 -0
  280. data/spec/models/history_record_spec.rb +59 -0
  281. data/spec/models/history_records_spec.rb +41 -0
  282. data/spec/models/invoice_reminder_spec.rb +41 -0
  283. data/spec/models/invoice_reminders_spec.rb +41 -0
  284. data/spec/models/invoice_spec.rb +259 -0
  285. data/spec/models/invoices_spec.rb +41 -0
  286. data/spec/models/item_spec.rb +125 -0
  287. data/spec/models/items_spec.rb +41 -0
  288. data/spec/models/journal_line_spec.rb +107 -0
  289. data/spec/models/journal_spec.rb +87 -0
  290. data/spec/models/journals_spec.rb +41 -0
  291. data/spec/models/line_amount_types_spec.rb +35 -0
  292. data/spec/models/line_item_spec.rb +107 -0
  293. data/spec/models/line_item_tracking_spec.rb +53 -0
  294. data/spec/models/linked_transaction_spec.rb +113 -0
  295. data/spec/models/linked_transactions_spec.rb +41 -0
  296. data/spec/models/manual_journal_line_spec.rb +77 -0
  297. data/spec/models/manual_journal_spec.rb +117 -0
  298. data/spec/models/manual_journals_spec.rb +41 -0
  299. data/spec/models/online_invoice_spec.rb +41 -0
  300. data/spec/models/online_invoices_spec.rb +41 -0
  301. data/spec/models/organisation_spec.rb +255 -0
  302. data/spec/models/organisations_spec.rb +41 -0
  303. data/spec/models/overpayment_spec.rb +151 -0
  304. data/spec/models/overpayments_spec.rb +41 -0
  305. data/spec/models/payment_service_spec.rb +71 -0
  306. data/spec/models/payment_services_spec.rb +41 -0
  307. data/spec/models/payment_spec.rb +181 -0
  308. data/spec/models/payment_term_spec.rb +47 -0
  309. data/spec/models/payment_term_type_spec.rb +35 -0
  310. data/spec/models/payments_spec.rb +41 -0
  311. data/spec/models/phone_spec.rb +63 -0
  312. data/spec/models/prepayment_spec.rb +145 -0
  313. data/spec/models/prepayments_spec.rb +41 -0
  314. data/spec/models/purchase_order_spec.rb +207 -0
  315. data/spec/models/purchase_orders_spec.rb +41 -0
  316. data/spec/models/purchase_spec.rb +59 -0
  317. data/spec/models/receipt_spec.rb +141 -0
  318. data/spec/models/receipts_spec.rb +41 -0
  319. data/spec/models/repeating_invoice_spec.rb +139 -0
  320. data/spec/models/repeating_invoices_spec.rb +41 -0
  321. data/spec/models/report_attribute_spec.rb +47 -0
  322. data/spec/models/report_cell_spec.rb +47 -0
  323. data/spec/models/report_fields_spec.rb +53 -0
  324. data/spec/models/report_row_spec.rb +53 -0
  325. data/spec/models/report_rows_spec.rb +59 -0
  326. data/spec/models/report_spec.rb +81 -0
  327. data/spec/models/report_with_row_spec.rb +89 -0
  328. data/spec/models/report_with_rows_spec.rb +41 -0
  329. data/spec/models/reports_spec.rb +41 -0
  330. data/spec/models/request_empty_spec.rb +41 -0
  331. data/spec/models/row_type_spec.rb +35 -0
  332. data/spec/models/sales_tracking_category_spec.rb +47 -0
  333. data/spec/models/schedule_spec.rb +85 -0
  334. data/spec/models/tax_component_spec.rb +59 -0
  335. data/spec/models/tax_rate_spec.rb +115 -0
  336. data/spec/models/tax_rates_spec.rb +41 -0
  337. data/spec/models/tax_type_spec.rb +35 -0
  338. data/spec/models/ten_nintey_nine_contact_spec.rb +167 -0
  339. data/spec/models/time_zone_spec.rb +35 -0
  340. data/spec/models/tracking_categories_spec.rb +41 -0
  341. data/spec/models/tracking_category_spec.rb +75 -0
  342. data/spec/models/tracking_option_spec.rb +63 -0
  343. data/spec/models/tracking_options_spec.rb +41 -0
  344. data/spec/models/user_spec.rb +81 -0
  345. data/spec/models/users_spec.rb +41 -0
  346. data/spec/models/validation_error_spec.rb +41 -0
  347. data/spec/spec_helper.rb +111 -0
  348. data/xero-ruby.gemspec +39 -0
  349. metadata +563 -0
@@ -0,0 +1,724 @@
1
+ =begin
2
+ #Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.3
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby
17
+ class Contact
18
+ # Xero identifier
19
+ attr_accessor :contact_id
20
+
21
+ # This can be updated via the API only i.e. This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). If the Contact Number is used, this is displayed as Contact Code in the Contacts UI in Xero.
22
+ attr_accessor :contact_number
23
+
24
+ # A user defined account number. This can be updated via the API and the Xero UI (max length = 50)
25
+ attr_accessor :account_number
26
+
27
+ # Current status of a contact – see contact status types
28
+ attr_accessor :contact_status
29
+
30
+ # Full name of contact/organisation (max length = 255)
31
+ attr_accessor :name
32
+
33
+ # First name of contact person (max length = 255)
34
+ attr_accessor :first_name
35
+
36
+ # Last name of contact person (max length = 255)
37
+ attr_accessor :last_name
38
+
39
+ # Email address of contact person (umlauts not supported) (max length = 255)
40
+ attr_accessor :email_address
41
+
42
+ # Skype user name of contact
43
+ attr_accessor :skype_user_name
44
+
45
+ # See contact persons
46
+ attr_accessor :contact_persons
47
+
48
+ # Bank account number of contact
49
+ attr_accessor :bank_account_details
50
+
51
+ # Tax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50)
52
+ attr_accessor :tax_number
53
+
54
+ # The tax type from TaxRates
55
+ attr_accessor :accounts_receivable_tax_type
56
+
57
+ # The tax type from TaxRates
58
+ attr_accessor :accounts_payable_tax_type
59
+
60
+ # Store certain address types for a contact – see address types
61
+ attr_accessor :addresses
62
+
63
+ # Store certain phone types for a contact – see phone types
64
+ attr_accessor :phones
65
+
66
+ # true or false – Boolean that describes if a contact that has any AP invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts payable invoice is generated against this contact.
67
+ attr_accessor :is_supplier
68
+
69
+ # true or false – Boolean that describes if a contact has any AR invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts receivable invoice is generated against this contact.
70
+ attr_accessor :is_customer
71
+
72
+ attr_accessor :default_currency
73
+
74
+ # Store XeroNetworkKey for contacts.
75
+ attr_accessor :xero_network_key
76
+
77
+ # The default sales account code for contacts
78
+ attr_accessor :sales_default_account_code
79
+
80
+ # The default purchases account code for contacts
81
+ attr_accessor :purchases_default_account_code
82
+
83
+ # The default sales tracking categories for contacts
84
+ attr_accessor :sales_tracking_categories
85
+
86
+ # The default purchases tracking categories for contacts
87
+ attr_accessor :purchases_tracking_categories
88
+
89
+ # The name of the Tracking Category assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
90
+ attr_accessor :tracking_category_name
91
+
92
+ # The name of the Tracking Option assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
93
+ attr_accessor :tracking_category_option
94
+
95
+ attr_accessor :payment_terms
96
+
97
+ # UTC timestamp of last update to contact
98
+ attr_accessor :updated_date_utc
99
+
100
+ # Displays which contact groups a contact is included in
101
+ attr_accessor :contact_groups
102
+
103
+ # Website address for contact (read only)
104
+ attr_accessor :website
105
+
106
+ attr_accessor :branding_theme
107
+
108
+ attr_accessor :batch_payments
109
+
110
+ # The default discount rate for the contact (read only)
111
+ attr_accessor :discount
112
+
113
+ attr_accessor :balances
114
+
115
+ # Displays array of attachments from the API
116
+ attr_accessor :attachments
117
+
118
+ # A boolean to indicate if a contact has an attachment
119
+ attr_accessor :has_attachments
120
+
121
+ # Displays validation errors returned from the API
122
+ attr_accessor :validation_errors
123
+
124
+ # A boolean to indicate if a contact has an validation errors
125
+ attr_accessor :has_validation_errors
126
+
127
+ class EnumAttributeValidator
128
+ attr_reader :datatype
129
+ attr_reader :allowable_values
130
+
131
+ def initialize(datatype, allowable_values)
132
+ @allowable_values = allowable_values.map do |value|
133
+ case datatype.to_s
134
+ when /Integer/i
135
+ value.to_i
136
+ when /Float/i
137
+ value.to_f
138
+ else
139
+ value
140
+ end
141
+ end
142
+ end
143
+
144
+ def valid?(value)
145
+ !value || allowable_values.include?(value)
146
+ end
147
+ end
148
+
149
+ # Attribute mapping from ruby-style variable name to JSON key.
150
+ def self.attribute_map
151
+ {
152
+ :'contact_id' => :'ContactID',
153
+ :'contact_number' => :'ContactNumber',
154
+ :'account_number' => :'AccountNumber',
155
+ :'contact_status' => :'ContactStatus',
156
+ :'name' => :'Name',
157
+ :'first_name' => :'FirstName',
158
+ :'last_name' => :'LastName',
159
+ :'email_address' => :'EmailAddress',
160
+ :'skype_user_name' => :'SkypeUserName',
161
+ :'contact_persons' => :'ContactPersons',
162
+ :'bank_account_details' => :'BankAccountDetails',
163
+ :'tax_number' => :'TaxNumber',
164
+ :'accounts_receivable_tax_type' => :'AccountsReceivableTaxType',
165
+ :'accounts_payable_tax_type' => :'AccountsPayableTaxType',
166
+ :'addresses' => :'Addresses',
167
+ :'phones' => :'Phones',
168
+ :'is_supplier' => :'IsSupplier',
169
+ :'is_customer' => :'IsCustomer',
170
+ :'default_currency' => :'DefaultCurrency',
171
+ :'xero_network_key' => :'XeroNetworkKey',
172
+ :'sales_default_account_code' => :'SalesDefaultAccountCode',
173
+ :'purchases_default_account_code' => :'PurchasesDefaultAccountCode',
174
+ :'sales_tracking_categories' => :'SalesTrackingCategories',
175
+ :'purchases_tracking_categories' => :'PurchasesTrackingCategories',
176
+ :'tracking_category_name' => :'TrackingCategoryName',
177
+ :'tracking_category_option' => :'TrackingCategoryOption',
178
+ :'payment_terms' => :'PaymentTerms',
179
+ :'updated_date_utc' => :'UpdatedDateUTC',
180
+ :'contact_groups' => :'ContactGroups',
181
+ :'website' => :'Website',
182
+ :'branding_theme' => :'BrandingTheme',
183
+ :'batch_payments' => :'BatchPayments',
184
+ :'discount' => :'Discount',
185
+ :'balances' => :'Balances',
186
+ :'attachments' => :'Attachments',
187
+ :'has_attachments' => :'HasAttachments',
188
+ :'validation_errors' => :'ValidationErrors',
189
+ :'has_validation_errors' => :'HasValidationErrors'
190
+ }
191
+ end
192
+
193
+ # Attribute type mapping.
194
+ def self.openapi_types
195
+ {
196
+ :'contact_id' => :'String',
197
+ :'contact_number' => :'String',
198
+ :'account_number' => :'String',
199
+ :'contact_status' => :'String',
200
+ :'name' => :'String',
201
+ :'first_name' => :'String',
202
+ :'last_name' => :'String',
203
+ :'email_address' => :'String',
204
+ :'skype_user_name' => :'String',
205
+ :'contact_persons' => :'Array<ContactPerson>',
206
+ :'bank_account_details' => :'String',
207
+ :'tax_number' => :'String',
208
+ :'accounts_receivable_tax_type' => :'String',
209
+ :'accounts_payable_tax_type' => :'String',
210
+ :'addresses' => :'Array<Address>',
211
+ :'phones' => :'Array<Phone>',
212
+ :'is_supplier' => :'Boolean',
213
+ :'is_customer' => :'Boolean',
214
+ :'default_currency' => :'CurrencyCode',
215
+ :'xero_network_key' => :'String',
216
+ :'sales_default_account_code' => :'String',
217
+ :'purchases_default_account_code' => :'String',
218
+ :'sales_tracking_categories' => :'Array<SalesTrackingCategory>',
219
+ :'purchases_tracking_categories' => :'Array<SalesTrackingCategory>',
220
+ :'tracking_category_name' => :'String',
221
+ :'tracking_category_option' => :'String',
222
+ :'payment_terms' => :'PaymentTerm',
223
+ :'updated_date_utc' => :'DateTime',
224
+ :'contact_groups' => :'Array<ContactGroup>',
225
+ :'website' => :'String',
226
+ :'branding_theme' => :'BrandingTheme',
227
+ :'batch_payments' => :'BatchPaymentDetails',
228
+ :'discount' => :'Float',
229
+ :'balances' => :'Balances',
230
+ :'attachments' => :'Array<Attachment>',
231
+ :'has_attachments' => :'Boolean',
232
+ :'validation_errors' => :'Array<ValidationError>',
233
+ :'has_validation_errors' => :'Boolean'
234
+ }
235
+ end
236
+
237
+ # Initializes the object
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ def initialize(attributes = {})
240
+ if (!attributes.is_a?(Hash))
241
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Contact` initialize method"
242
+ end
243
+
244
+ # check to see if the attribute exists and convert string to symbol for hash key
245
+ attributes = attributes.each_with_object({}) { |(k, v), h|
246
+ if (!self.class.attribute_map.key?(k.to_sym))
247
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
248
+ end
249
+ h[k.to_sym] = v
250
+ }
251
+
252
+ if attributes.key?(:'contact_id')
253
+ self.contact_id = attributes[:'contact_id']
254
+ end
255
+
256
+ if attributes.key?(:'contact_number')
257
+ self.contact_number = attributes[:'contact_number']
258
+ end
259
+
260
+ if attributes.key?(:'account_number')
261
+ self.account_number = attributes[:'account_number']
262
+ end
263
+
264
+ if attributes.key?(:'contact_status')
265
+ self.contact_status = attributes[:'contact_status']
266
+ end
267
+
268
+ if attributes.key?(:'name')
269
+ self.name = attributes[:'name']
270
+ end
271
+
272
+ if attributes.key?(:'first_name')
273
+ self.first_name = attributes[:'first_name']
274
+ end
275
+
276
+ if attributes.key?(:'last_name')
277
+ self.last_name = attributes[:'last_name']
278
+ end
279
+
280
+ if attributes.key?(:'email_address')
281
+ self.email_address = attributes[:'email_address']
282
+ end
283
+
284
+ if attributes.key?(:'skype_user_name')
285
+ self.skype_user_name = attributes[:'skype_user_name']
286
+ end
287
+
288
+ if attributes.key?(:'contact_persons')
289
+ if (value = attributes[:'contact_persons']).is_a?(Array)
290
+ self.contact_persons = value
291
+ end
292
+ end
293
+
294
+ if attributes.key?(:'bank_account_details')
295
+ self.bank_account_details = attributes[:'bank_account_details']
296
+ end
297
+
298
+ if attributes.key?(:'tax_number')
299
+ self.tax_number = attributes[:'tax_number']
300
+ end
301
+
302
+ if attributes.key?(:'accounts_receivable_tax_type')
303
+ self.accounts_receivable_tax_type = attributes[:'accounts_receivable_tax_type']
304
+ end
305
+
306
+ if attributes.key?(:'accounts_payable_tax_type')
307
+ self.accounts_payable_tax_type = attributes[:'accounts_payable_tax_type']
308
+ end
309
+
310
+ if attributes.key?(:'addresses')
311
+ if (value = attributes[:'addresses']).is_a?(Array)
312
+ self.addresses = value
313
+ end
314
+ end
315
+
316
+ if attributes.key?(:'phones')
317
+ if (value = attributes[:'phones']).is_a?(Array)
318
+ self.phones = value
319
+ end
320
+ end
321
+
322
+ if attributes.key?(:'is_supplier')
323
+ self.is_supplier = attributes[:'is_supplier']
324
+ end
325
+
326
+ if attributes.key?(:'is_customer')
327
+ self.is_customer = attributes[:'is_customer']
328
+ end
329
+
330
+ if attributes.key?(:'default_currency')
331
+ self.default_currency = attributes[:'default_currency']
332
+ end
333
+
334
+ if attributes.key?(:'xero_network_key')
335
+ self.xero_network_key = attributes[:'xero_network_key']
336
+ end
337
+
338
+ if attributes.key?(:'sales_default_account_code')
339
+ self.sales_default_account_code = attributes[:'sales_default_account_code']
340
+ end
341
+
342
+ if attributes.key?(:'purchases_default_account_code')
343
+ self.purchases_default_account_code = attributes[:'purchases_default_account_code']
344
+ end
345
+
346
+ if attributes.key?(:'sales_tracking_categories')
347
+ if (value = attributes[:'sales_tracking_categories']).is_a?(Array)
348
+ self.sales_tracking_categories = value
349
+ end
350
+ end
351
+
352
+ if attributes.key?(:'purchases_tracking_categories')
353
+ if (value = attributes[:'purchases_tracking_categories']).is_a?(Array)
354
+ self.purchases_tracking_categories = value
355
+ end
356
+ end
357
+
358
+ if attributes.key?(:'tracking_category_name')
359
+ self.tracking_category_name = attributes[:'tracking_category_name']
360
+ end
361
+
362
+ if attributes.key?(:'tracking_category_option')
363
+ self.tracking_category_option = attributes[:'tracking_category_option']
364
+ end
365
+
366
+ if attributes.key?(:'payment_terms')
367
+ self.payment_terms = attributes[:'payment_terms']
368
+ end
369
+
370
+ if attributes.key?(:'updated_date_utc')
371
+ self.updated_date_utc = attributes[:'updated_date_utc']
372
+ end
373
+
374
+ if attributes.key?(:'contact_groups')
375
+ if (value = attributes[:'contact_groups']).is_a?(Array)
376
+ self.contact_groups = value
377
+ end
378
+ end
379
+
380
+ if attributes.key?(:'website')
381
+ self.website = attributes[:'website']
382
+ end
383
+
384
+ if attributes.key?(:'branding_theme')
385
+ self.branding_theme = attributes[:'branding_theme']
386
+ end
387
+
388
+ if attributes.key?(:'batch_payments')
389
+ self.batch_payments = attributes[:'batch_payments']
390
+ end
391
+
392
+ if attributes.key?(:'discount')
393
+ self.discount = attributes[:'discount']
394
+ end
395
+
396
+ if attributes.key?(:'balances')
397
+ self.balances = attributes[:'balances']
398
+ end
399
+
400
+ if attributes.key?(:'attachments')
401
+ if (value = attributes[:'attachments']).is_a?(Array)
402
+ self.attachments = value
403
+ end
404
+ end
405
+
406
+ if attributes.key?(:'has_attachments')
407
+ self.has_attachments = attributes[:'has_attachments']
408
+ end
409
+
410
+ if attributes.key?(:'validation_errors')
411
+ if (value = attributes[:'validation_errors']).is_a?(Array)
412
+ self.validation_errors = value
413
+ end
414
+ end
415
+
416
+ if attributes.key?(:'has_validation_errors')
417
+ self.has_validation_errors = attributes[:'has_validation_errors']
418
+ end
419
+ end
420
+
421
+ # Show invalid properties with the reasons. Usually used together with valid?
422
+ # @return Array for valid properties with the reasons
423
+ def list_invalid_properties
424
+ invalid_properties = Array.new
425
+ if !@contact_number.nil? && @contact_number.to_s.length > 50
426
+ invalid_properties.push('invalid value for "contact_number", the character length must be smaller than or equal to 50.')
427
+ end
428
+
429
+ if !@account_number.nil? && @account_number.to_s.length > 50
430
+ invalid_properties.push('invalid value for "account_number", the character length must be smaller than or equal to 50.')
431
+ end
432
+
433
+ if !@name.nil? && @name.to_s.length > 255
434
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
435
+ end
436
+
437
+ if !@first_name.nil? && @first_name.to_s.length > 255
438
+ invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.')
439
+ end
440
+
441
+ if !@last_name.nil? && @last_name.to_s.length > 255
442
+ invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.')
443
+ end
444
+
445
+ if !@email_address.nil? && @email_address.to_s.length > 255
446
+ invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to 255.')
447
+ end
448
+
449
+ if !@tax_number.nil? && @tax_number.to_s.length > 50
450
+ invalid_properties.push('invalid value for "tax_number", the character length must be smaller than or equal to 50.')
451
+ end
452
+
453
+ invalid_properties
454
+ end
455
+
456
+ # Check to see if the all the properties in the model are valid
457
+ # @return true if the model is valid
458
+ def valid?
459
+ return false if !@contact_number.nil? && @contact_number.to_s.length > 50
460
+ return false if !@account_number.nil? && @account_number.to_s.length > 50
461
+ contact_status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "GDPRREQUEST"])
462
+ return false unless contact_status_validator.valid?(@contact_status)
463
+ return false if !@name.nil? && @name.to_s.length > 255
464
+ return false if !@first_name.nil? && @first_name.to_s.length > 255
465
+ return false if !@last_name.nil? && @last_name.to_s.length > 255
466
+ return false if !@email_address.nil? && @email_address.to_s.length > 255
467
+ return false if !@tax_number.nil? && @tax_number.to_s.length > 50
468
+ true
469
+ end
470
+
471
+ # Custom attribute writer method with validation
472
+ # @param [Object] contact_number Value to be assigned
473
+ def contact_number=(contact_number)
474
+ if !contact_number.nil? && contact_number.to_s.length > 50
475
+ fail ArgumentError, 'invalid value for "contact_number", the character length must be smaller than or equal to 50.'
476
+ end
477
+
478
+ @contact_number = contact_number
479
+ end
480
+
481
+ # Custom attribute writer method with validation
482
+ # @param [Object] account_number Value to be assigned
483
+ def account_number=(account_number)
484
+ if !account_number.nil? && account_number.to_s.length > 50
485
+ fail ArgumentError, 'invalid value for "account_number", the character length must be smaller than or equal to 50.'
486
+ end
487
+
488
+ @account_number = account_number
489
+ end
490
+
491
+ # Custom attribute writer method checking allowed values (enum).
492
+ # @param [Object] contact_status Object to be assigned
493
+ def contact_status=(contact_status)
494
+ validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "GDPRREQUEST"])
495
+ unless validator.valid?(contact_status)
496
+ fail ArgumentError, "invalid value for \"contact_status\", must be one of #{validator.allowable_values}."
497
+ end
498
+ @contact_status = contact_status
499
+ end
500
+
501
+ # Custom attribute writer method with validation
502
+ # @param [Object] name Value to be assigned
503
+ def name=(name)
504
+ if !name.nil? && name.to_s.length > 255
505
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
506
+ end
507
+
508
+ @name = name
509
+ end
510
+
511
+ # Custom attribute writer method with validation
512
+ # @param [Object] first_name Value to be assigned
513
+ def first_name=(first_name)
514
+ if !first_name.nil? && first_name.to_s.length > 255
515
+ fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 255.'
516
+ end
517
+
518
+ @first_name = first_name
519
+ end
520
+
521
+ # Custom attribute writer method with validation
522
+ # @param [Object] last_name Value to be assigned
523
+ def last_name=(last_name)
524
+ if !last_name.nil? && last_name.to_s.length > 255
525
+ fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 255.'
526
+ end
527
+
528
+ @last_name = last_name
529
+ end
530
+
531
+ # Custom attribute writer method with validation
532
+ # @param [Object] email_address Value to be assigned
533
+ def email_address=(email_address)
534
+ if !email_address.nil? && email_address.to_s.length > 255
535
+ fail ArgumentError, 'invalid value for "email_address", the character length must be smaller than or equal to 255.'
536
+ end
537
+
538
+ @email_address = email_address
539
+ end
540
+
541
+ # Custom attribute writer method with validation
542
+ # @param [Object] tax_number Value to be assigned
543
+ def tax_number=(tax_number)
544
+ if !tax_number.nil? && tax_number.to_s.length > 50
545
+ fail ArgumentError, 'invalid value for "tax_number", the character length must be smaller than or equal to 50.'
546
+ end
547
+
548
+ @tax_number = tax_number
549
+ end
550
+
551
+ # Checks equality by comparing each attribute.
552
+ # @param [Object] Object to be compared
553
+ def ==(o)
554
+ return true if self.equal?(o)
555
+ self.class == o.class &&
556
+ contact_id == o.contact_id &&
557
+ contact_number == o.contact_number &&
558
+ account_number == o.account_number &&
559
+ contact_status == o.contact_status &&
560
+ name == o.name &&
561
+ first_name == o.first_name &&
562
+ last_name == o.last_name &&
563
+ email_address == o.email_address &&
564
+ skype_user_name == o.skype_user_name &&
565
+ contact_persons == o.contact_persons &&
566
+ bank_account_details == o.bank_account_details &&
567
+ tax_number == o.tax_number &&
568
+ accounts_receivable_tax_type == o.accounts_receivable_tax_type &&
569
+ accounts_payable_tax_type == o.accounts_payable_tax_type &&
570
+ addresses == o.addresses &&
571
+ phones == o.phones &&
572
+ is_supplier == o.is_supplier &&
573
+ is_customer == o.is_customer &&
574
+ default_currency == o.default_currency &&
575
+ xero_network_key == o.xero_network_key &&
576
+ sales_default_account_code == o.sales_default_account_code &&
577
+ purchases_default_account_code == o.purchases_default_account_code &&
578
+ sales_tracking_categories == o.sales_tracking_categories &&
579
+ purchases_tracking_categories == o.purchases_tracking_categories &&
580
+ tracking_category_name == o.tracking_category_name &&
581
+ tracking_category_option == o.tracking_category_option &&
582
+ payment_terms == o.payment_terms &&
583
+ updated_date_utc == o.updated_date_utc &&
584
+ contact_groups == o.contact_groups &&
585
+ website == o.website &&
586
+ branding_theme == o.branding_theme &&
587
+ batch_payments == o.batch_payments &&
588
+ discount == o.discount &&
589
+ balances == o.balances &&
590
+ attachments == o.attachments &&
591
+ has_attachments == o.has_attachments &&
592
+ validation_errors == o.validation_errors &&
593
+ has_validation_errors == o.has_validation_errors
594
+ end
595
+
596
+ # @see the `==` method
597
+ # @param [Object] Object to be compared
598
+ def eql?(o)
599
+ self == o
600
+ end
601
+
602
+ # Calculates hash code according to all attributes.
603
+ # @return [Integer] Hash code
604
+ def hash
605
+ [contact_id, contact_number, account_number, contact_status, name, first_name, last_name, email_address, skype_user_name, contact_persons, bank_account_details, tax_number, accounts_receivable_tax_type, accounts_payable_tax_type, addresses, phones, is_supplier, is_customer, default_currency, xero_network_key, sales_default_account_code, purchases_default_account_code, sales_tracking_categories, purchases_tracking_categories, tracking_category_name, tracking_category_option, payment_terms, updated_date_utc, contact_groups, website, branding_theme, batch_payments, discount, balances, attachments, has_attachments, validation_errors, has_validation_errors].hash
606
+ end
607
+
608
+ # Builds the object from hash
609
+ # @param [Hash] attributes Model attributes in the form of hash
610
+ # @return [Object] Returns the model itself
611
+ def self.build_from_hash(attributes)
612
+ new.build_from_hash(attributes)
613
+ end
614
+
615
+ # Builds the object from hash
616
+ # @param [Hash] attributes Model attributes in the form of hash
617
+ # @return [Object] Returns the model itself
618
+ def build_from_hash(attributes)
619
+ return nil unless attributes.is_a?(Hash)
620
+ self.class.openapi_types.each_pair do |key, type|
621
+ if type =~ /\AArray<(.*)>/i
622
+ # check to ensure the input is an array given that the attribute
623
+ # is documented as an array but the input is not
624
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
625
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
626
+ end
627
+ elsif !attributes[self.class.attribute_map[key]].nil?
628
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
629
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
630
+ end
631
+
632
+ self
633
+ end
634
+
635
+ # Deserializes the data based on type
636
+ # @param string type Data type
637
+ # @param string value Value to be deserialized
638
+ # @return [Object] Deserialized data
639
+ def _deserialize(type, value)
640
+ case type.to_sym
641
+ when :DateTime
642
+ DateTime.parse(parse_date(value))
643
+ when :Date
644
+ Date._iso8601(parse_date(value))
645
+ when :String
646
+ value.to_s
647
+ when :Integer
648
+ value.to_i
649
+ when :Float
650
+ value.to_f
651
+ when :Boolean
652
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
653
+ true
654
+ else
655
+ false
656
+ end
657
+ when :Object
658
+ # generic object (usually a Hash), return directly
659
+ value
660
+ when /\AArray<(?<inner_type>.+)>\z/
661
+ inner_type = Regexp.last_match[:inner_type]
662
+ value.map { |v| _deserialize(inner_type, v) }
663
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
664
+ k_type = Regexp.last_match[:k_type]
665
+ v_type = Regexp.last_match[:v_type]
666
+ {}.tap do |hash|
667
+ value.each do |k, v|
668
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
669
+ end
670
+ end
671
+ else # model
672
+ XeroRuby.const_get(type).build_from_hash(value)
673
+ end
674
+ end
675
+
676
+ # Returns the string representation of the object
677
+ # @return [String] String presentation of the object
678
+ def to_s
679
+ to_hash.to_s
680
+ end
681
+
682
+ # to_body is an alias to to_hash (backward compatibility)
683
+ # @return [Hash] Returns the object in the form of hash
684
+ def to_body
685
+ to_hash
686
+ end
687
+
688
+ # Returns the object in the form of hash
689
+ # @return [Hash] Returns the object in the form of hash
690
+ def to_hash
691
+ hash = {}
692
+ self.class.attribute_map.each_pair do |attr, param|
693
+ value = self.send(attr)
694
+ next if value.nil?
695
+ hash[param] = _to_hash(value)
696
+ end
697
+ hash
698
+ end
699
+
700
+ # Outputs non-array value in the form of hash
701
+ # For object, use to_hash. Otherwise, just return the value
702
+ # @param [Object] value Any valid value
703
+ # @return [Hash] Returns the value in the form of hash
704
+ def _to_hash(value)
705
+ if value.is_a?(Array)
706
+ value.compact.map { |v| _to_hash(v) }
707
+ elsif value.is_a?(Hash)
708
+ {}.tap do |hash|
709
+ value.each { |k, v| hash[k] = _to_hash(v) }
710
+ end
711
+ elsif value.respond_to? :to_hash
712
+ value.to_hash
713
+ else
714
+ value
715
+ end
716
+ end
717
+
718
+ # customized data_parser
719
+ def parse_date(datestring)
720
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
721
+ return Time.at(seconds_since_epoch).to_s
722
+ end
723
+ end
724
+ end