xero-ruby 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +454 -0
- data/Rakefile +10 -0
- data/docs/Account.md +53 -0
- data/docs/AccountType.md +16 -0
- data/docs/AccountingApi.md +11269 -0
- data/docs/Accounts.md +17 -0
- data/docs/AccountsPayable.md +19 -0
- data/docs/AccountsReceivable.md +19 -0
- data/docs/Address.md +35 -0
- data/docs/Allocation.md +21 -0
- data/docs/Allocations.md +17 -0
- data/docs/Attachment.md +27 -0
- data/docs/Attachments.md +17 -0
- data/docs/Balances.md +19 -0
- data/docs/BankTransaction.md +59 -0
- data/docs/BankTransactions.md +17 -0
- data/docs/BankTransfer.md +37 -0
- data/docs/BankTransfers.md +17 -0
- data/docs/BatchPayment.md +47 -0
- data/docs/BatchPaymentDetails.md +25 -0
- data/docs/BatchPayments.md +17 -0
- data/docs/Bill.md +19 -0
- data/docs/BrandingTheme.md +23 -0
- data/docs/BrandingThemes.md +17 -0
- data/docs/CISOrgSetting.md +21 -0
- data/docs/CISSetting.md +19 -0
- data/docs/CISSettings.md +17 -0
- data/docs/Contact.md +91 -0
- data/docs/ContactGroup.md +23 -0
- data/docs/ContactGroups.md +17 -0
- data/docs/ContactPerson.md +23 -0
- data/docs/Contacts.md +17 -0
- data/docs/CountryCode.md +16 -0
- data/docs/CreditNote.md +61 -0
- data/docs/CreditNotes.md +17 -0
- data/docs/Currencies.md +17 -0
- data/docs/Currency.md +19 -0
- data/docs/CurrencyCode.md +16 -0
- data/docs/Element.md +17 -0
- data/docs/Employee.md +27 -0
- data/docs/Employees.md +17 -0
- data/docs/Error.md +23 -0
- data/docs/ExpenseClaim.md +39 -0
- data/docs/ExpenseClaims.md +17 -0
- data/docs/ExternalLink.md +21 -0
- data/docs/HistoryRecord.md +23 -0
- data/docs/HistoryRecords.md +17 -0
- data/docs/Invoice.md +89 -0
- data/docs/InvoiceReminder.md +17 -0
- data/docs/InvoiceReminders.md +17 -0
- data/docs/Invoices.md +17 -0
- data/docs/Item.md +45 -0
- data/docs/Items.md +17 -0
- data/docs/Journal.md +31 -0
- data/docs/JournalLine.md +39 -0
- data/docs/Journals.md +17 -0
- data/docs/LineAmountTypes.md +16 -0
- data/docs/LineItem.md +41 -0
- data/docs/LineItemTracking.md +21 -0
- data/docs/LinkedTransaction.md +37 -0
- data/docs/LinkedTransactions.md +17 -0
- data/docs/ManualJournal.md +41 -0
- data/docs/ManualJournalLine.md +29 -0
- data/docs/ManualJournals.md +17 -0
- data/docs/OnlineInvoice.md +17 -0
- data/docs/OnlineInvoices.md +17 -0
- data/docs/Organisation.md +79 -0
- data/docs/Organisations.md +17 -0
- data/docs/Overpayment.md +51 -0
- data/docs/Overpayments.md +17 -0
- data/docs/Payment.md +61 -0
- data/docs/PaymentService.md +27 -0
- data/docs/PaymentServices.md +17 -0
- data/docs/PaymentTerm.md +19 -0
- data/docs/PaymentTermType.md +16 -0
- data/docs/Payments.md +17 -0
- data/docs/Phone.md +23 -0
- data/docs/Prepayment.md +49 -0
- data/docs/Prepayments.md +17 -0
- data/docs/Purchase.md +23 -0
- data/docs/PurchaseOrder.md +71 -0
- data/docs/PurchaseOrders.md +17 -0
- data/docs/Receipt.md +49 -0
- data/docs/Receipts.md +17 -0
- data/docs/RepeatingInvoice.md +47 -0
- data/docs/RepeatingInvoices.md +17 -0
- data/docs/Report.md +29 -0
- data/docs/ReportAttribute.md +19 -0
- data/docs/ReportCell.md +19 -0
- data/docs/ReportFields.md +21 -0
- data/docs/ReportRow.md +21 -0
- data/docs/ReportRows.md +23 -0
- data/docs/ReportWithRow.md +33 -0
- data/docs/ReportWithRows.md +17 -0
- data/docs/Reports.md +17 -0
- data/docs/RequestEmpty.md +17 -0
- data/docs/RowType.md +16 -0
- data/docs/SalesTrackingCategory.md +19 -0
- data/docs/Schedule.md +29 -0
- data/docs/TaxComponent.md +23 -0
- data/docs/TaxRate.md +39 -0
- data/docs/TaxRates.md +17 -0
- data/docs/TaxType.md +16 -0
- data/docs/TenNinteyNineContact.md +59 -0
- data/docs/TimeZone.md +16 -0
- data/docs/TrackingCategories.md +17 -0
- data/docs/TrackingCategory.md +27 -0
- data/docs/TrackingOption.md +23 -0
- data/docs/TrackingOptions.md +17 -0
- data/docs/User.md +29 -0
- data/docs/Users.md +17 -0
- data/docs/ValidationError.md +17 -0
- data/git_push.sh +55 -0
- data/lib/.DS_Store +0 -0
- data/lib/xero-ruby.rb +149 -0
- data/lib/xero-ruby/api/accounting_api.rb +14686 -0
- data/lib/xero-ruby/api_client.rb +386 -0
- data/lib/xero-ruby/api_error.rb +57 -0
- data/lib/xero-ruby/configuration.rb +252 -0
- data/lib/xero-ruby/models/account.rb +484 -0
- data/lib/xero-ruby/models/account_type.rb +57 -0
- data/lib/xero-ruby/models/accounts.rb +205 -0
- data/lib/xero-ruby/models/accounts_payable.rb +212 -0
- data/lib/xero-ruby/models/accounts_receivable.rb +212 -0
- data/lib/xero-ruby/models/address.rb +463 -0
- data/lib/xero-ruby/models/allocation.rb +238 -0
- data/lib/xero-ruby/models/allocations.rb +205 -0
- data/lib/xero-ruby/models/attachment.rb +254 -0
- data/lib/xero-ruby/models/attachments.rb +205 -0
- data/lib/xero-ruby/models/balances.rb +213 -0
- data/lib/xero-ruby/models/bank_transaction.rb +480 -0
- data/lib/xero-ruby/models/bank_transactions.rb +205 -0
- data/lib/xero-ruby/models/bank_transfer.rb +319 -0
- data/lib/xero-ruby/models/bank_transfers.rb +205 -0
- data/lib/xero-ruby/models/batch_payment.rb +429 -0
- data/lib/xero-ruby/models/batch_payment_details.rb +290 -0
- data/lib/xero-ruby/models/batch_payments.rb +205 -0
- data/lib/xero-ruby/models/bill.rb +213 -0
- data/lib/xero-ruby/models/branding_theme.rb +234 -0
- data/lib/xero-ruby/models/branding_themes.rb +205 -0
- data/lib/xero-ruby/models/cis_org_setting.rb +224 -0
- data/lib/xero-ruby/models/cis_setting.rb +214 -0
- data/lib/xero-ruby/models/cis_settings.rb +205 -0
- data/lib/xero-ruby/models/contact.rb +724 -0
- data/lib/xero-ruby/models/contact_group.rb +270 -0
- data/lib/xero-ruby/models/contact_groups.rb +205 -0
- data/lib/xero-ruby/models/contact_person.rb +234 -0
- data/lib/xero-ruby/models/contacts.rb +205 -0
- data/lib/xero-ruby/models/country_code.rb +275 -0
- data/lib/xero-ruby/models/credit_note.rb +475 -0
- data/lib/xero-ruby/models/credit_notes.rb +205 -0
- data/lib/xero-ruby/models/currencies.rb +205 -0
- data/lib/xero-ruby/models/currency.rb +213 -0
- data/lib/xero-ruby/models/currency_code.rb +197 -0
- data/lib/xero-ruby/models/element.rb +206 -0
- data/lib/xero-ruby/models/employee.rb +316 -0
- data/lib/xero-ruby/models/employees.rb +205 -0
- data/lib/xero-ruby/models/error.rb +236 -0
- data/lib/xero-ruby/models/expense_claim.rb +350 -0
- data/lib/xero-ruby/models/expense_claims.rb +205 -0
- data/lib/xero-ruby/models/external_link.rb +257 -0
- data/lib/xero-ruby/models/history_record.rb +234 -0
- data/lib/xero-ruby/models/history_records.rb +205 -0
- data/lib/xero-ruby/models/invoice.rb +666 -0
- data/lib/xero-ruby/models/invoice_reminder.rb +204 -0
- data/lib/xero-ruby/models/invoice_reminders.rb +205 -0
- data/lib/xero-ruby/models/invoices.rb +205 -0
- data/lib/xero-ruby/models/item.rb +418 -0
- data/lib/xero-ruby/models/items.rb +205 -0
- data/lib/xero-ruby/models/journal.rb +310 -0
- data/lib/xero-ruby/models/journal_line.rb +315 -0
- data/lib/xero-ruby/models/journals.rb +205 -0
- data/lib/xero-ruby/models/line_amount_types.rb +38 -0
- data/lib/xero-ruby/models/line_item.rb +326 -0
- data/lib/xero-ruby/models/line_item_tracking.rb +239 -0
- data/lib/xero-ruby/models/linked_transaction.rb +369 -0
- data/lib/xero-ruby/models/linked_transactions.rb +205 -0
- data/lib/xero-ruby/models/manual_journal.rb +375 -0
- data/lib/xero-ruby/models/manual_journal_line.rb +266 -0
- data/lib/xero-ruby/models/manual_journals.rb +205 -0
- data/lib/xero-ruby/models/online_invoice.rb +204 -0
- data/lib/xero-ruby/models/online_invoices.rb +205 -0
- data/lib/xero-ruby/models/organisation.rb +622 -0
- data/lib/xero-ruby/models/organisations.rb +205 -0
- data/lib/xero-ruby/models/overpayment.rb +425 -0
- data/lib/xero-ruby/models/overpayments.rb +205 -0
- data/lib/xero-ruby/models/payment.rb +467 -0
- data/lib/xero-ruby/models/payment_service.rb +256 -0
- data/lib/xero-ruby/models/payment_services.rb +205 -0
- data/lib/xero-ruby/models/payment_term.rb +212 -0
- data/lib/xero-ruby/models/payment_term_type.rb +39 -0
- data/lib/xero-ruby/models/payments.rb +205 -0
- data/lib/xero-ruby/models/phone.rb +312 -0
- data/lib/xero-ruby/models/prepayment.rb +413 -0
- data/lib/xero-ruby/models/prepayments.rb +205 -0
- data/lib/xero-ruby/models/purchase.rb +234 -0
- data/lib/xero-ruby/models/purchase_order.rb +523 -0
- data/lib/xero-ruby/models/purchase_orders.rb +205 -0
- data/lib/xero-ruby/models/receipt.rb +420 -0
- data/lib/xero-ruby/models/receipts.rb +205 -0
- data/lib/xero-ruby/models/repeating_invoice.rb +400 -0
- data/lib/xero-ruby/models/repeating_invoices.rb +205 -0
- data/lib/xero-ruby/models/report.rb +299 -0
- data/lib/xero-ruby/models/report_attribute.rb +212 -0
- data/lib/xero-ruby/models/report_cell.rb +214 -0
- data/lib/xero-ruby/models/report_fields.rb +221 -0
- data/lib/xero-ruby/models/report_row.rb +223 -0
- data/lib/xero-ruby/models/report_rows.rb +234 -0
- data/lib/xero-ruby/models/report_with_row.rb +288 -0
- data/lib/xero-ruby/models/report_with_rows.rb +205 -0
- data/lib/xero-ruby/models/reports.rb +205 -0
- data/lib/xero-ruby/models/request_empty.rb +204 -0
- data/lib/xero-ruby/models/row_type.rb +39 -0
- data/lib/xero-ruby/models/sales_tracking_category.rb +214 -0
- data/lib/xero-ruby/models/schedule.rb +310 -0
- data/lib/xero-ruby/models/tax_component.rb +234 -0
- data/lib/xero-ruby/models/tax_rate.rb +367 -0
- data/lib/xero-ruby/models/tax_rates.rb +205 -0
- data/lib/xero-ruby/models/tax_type.rb +87 -0
- data/lib/xero-ruby/models/ten_nintey_nine_contact.rb +414 -0
- data/lib/xero-ruby/models/time_zone.rb +142 -0
- data/lib/xero-ruby/models/tracking_categories.rb +205 -0
- data/lib/xero-ruby/models/tracking_category.rb +320 -0
- data/lib/xero-ruby/models/tracking_option.rb +283 -0
- data/lib/xero-ruby/models/tracking_options.rb +205 -0
- data/lib/xero-ruby/models/user.rb +298 -0
- data/lib/xero-ruby/models/users.rb +205 -0
- data/lib/xero-ruby/models/validation_error.rb +204 -0
- data/lib/xero-ruby/version.rb +15 -0
- data/pkg/xero-ruby-0.1.0.gem +0 -0
- data/pkg/xero-ruby-1.0.0.gem +0 -0
- data/spec/api/accounting_api_spec.rb +2322 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/account_spec.rb +165 -0
- data/spec/models/account_type_spec.rb +35 -0
- data/spec/models/accounts_payable_spec.rb +47 -0
- data/spec/models/accounts_receivable_spec.rb +47 -0
- data/spec/models/accounts_spec.rb +41 -0
- data/spec/models/address_spec.rb +99 -0
- data/spec/models/allocation_spec.rb +53 -0
- data/spec/models/allocations_spec.rb +41 -0
- data/spec/models/attachment_spec.rb +71 -0
- data/spec/models/attachments_spec.rb +41 -0
- data/spec/models/balances_spec.rb +47 -0
- data/spec/models/bank_transaction_spec.rb +175 -0
- data/spec/models/bank_transactions_spec.rb +41 -0
- data/spec/models/bank_transfer_spec.rb +101 -0
- data/spec/models/bank_transfers_spec.rb +41 -0
- data/spec/models/batch_payment_details_spec.rb +65 -0
- data/spec/models/batch_payment_spec.rb +131 -0
- data/spec/models/batch_payments_spec.rb +41 -0
- data/spec/models/bill_spec.rb +47 -0
- data/spec/models/branding_theme_spec.rb +59 -0
- data/spec/models/branding_themes_spec.rb +41 -0
- data/spec/models/cis_org_setting_spec.rb +53 -0
- data/spec/models/cis_setting_spec.rb +47 -0
- data/spec/models/cis_settings_spec.rb +41 -0
- data/spec/models/contact_group_spec.rb +63 -0
- data/spec/models/contact_groups_spec.rb +41 -0
- data/spec/models/contact_person_spec.rb +59 -0
- data/spec/models/contact_spec.rb +267 -0
- data/spec/models/contacts_spec.rb +41 -0
- data/spec/models/country_code_spec.rb +35 -0
- data/spec/models/credit_note_spec.rb +181 -0
- data/spec/models/credit_notes_spec.rb +41 -0
- data/spec/models/currencies_spec.rb +41 -0
- data/spec/models/currency_code_spec.rb +35 -0
- data/spec/models/currency_spec.rb +47 -0
- data/spec/models/element_spec.rb +41 -0
- data/spec/models/employee_spec.rb +75 -0
- data/spec/models/employees_spec.rb +41 -0
- data/spec/models/error_spec.rb +59 -0
- data/spec/models/expense_claim_spec.rb +111 -0
- data/spec/models/expense_claims_spec.rb +41 -0
- data/spec/models/external_link_spec.rb +57 -0
- data/spec/models/history_record_spec.rb +59 -0
- data/spec/models/history_records_spec.rb +41 -0
- data/spec/models/invoice_reminder_spec.rb +41 -0
- data/spec/models/invoice_reminders_spec.rb +41 -0
- data/spec/models/invoice_spec.rb +259 -0
- data/spec/models/invoices_spec.rb +41 -0
- data/spec/models/item_spec.rb +125 -0
- data/spec/models/items_spec.rb +41 -0
- data/spec/models/journal_line_spec.rb +107 -0
- data/spec/models/journal_spec.rb +87 -0
- data/spec/models/journals_spec.rb +41 -0
- data/spec/models/line_amount_types_spec.rb +35 -0
- data/spec/models/line_item_spec.rb +107 -0
- data/spec/models/line_item_tracking_spec.rb +53 -0
- data/spec/models/linked_transaction_spec.rb +113 -0
- data/spec/models/linked_transactions_spec.rb +41 -0
- data/spec/models/manual_journal_line_spec.rb +77 -0
- data/spec/models/manual_journal_spec.rb +117 -0
- data/spec/models/manual_journals_spec.rb +41 -0
- data/spec/models/online_invoice_spec.rb +41 -0
- data/spec/models/online_invoices_spec.rb +41 -0
- data/spec/models/organisation_spec.rb +255 -0
- data/spec/models/organisations_spec.rb +41 -0
- data/spec/models/overpayment_spec.rb +151 -0
- data/spec/models/overpayments_spec.rb +41 -0
- data/spec/models/payment_service_spec.rb +71 -0
- data/spec/models/payment_services_spec.rb +41 -0
- data/spec/models/payment_spec.rb +181 -0
- data/spec/models/payment_term_spec.rb +47 -0
- data/spec/models/payment_term_type_spec.rb +35 -0
- data/spec/models/payments_spec.rb +41 -0
- data/spec/models/phone_spec.rb +63 -0
- data/spec/models/prepayment_spec.rb +145 -0
- data/spec/models/prepayments_spec.rb +41 -0
- data/spec/models/purchase_order_spec.rb +207 -0
- data/spec/models/purchase_orders_spec.rb +41 -0
- data/spec/models/purchase_spec.rb +59 -0
- data/spec/models/receipt_spec.rb +141 -0
- data/spec/models/receipts_spec.rb +41 -0
- data/spec/models/repeating_invoice_spec.rb +139 -0
- data/spec/models/repeating_invoices_spec.rb +41 -0
- data/spec/models/report_attribute_spec.rb +47 -0
- data/spec/models/report_cell_spec.rb +47 -0
- data/spec/models/report_fields_spec.rb +53 -0
- data/spec/models/report_row_spec.rb +53 -0
- data/spec/models/report_rows_spec.rb +59 -0
- data/spec/models/report_spec.rb +81 -0
- data/spec/models/report_with_row_spec.rb +89 -0
- data/spec/models/report_with_rows_spec.rb +41 -0
- data/spec/models/reports_spec.rb +41 -0
- data/spec/models/request_empty_spec.rb +41 -0
- data/spec/models/row_type_spec.rb +35 -0
- data/spec/models/sales_tracking_category_spec.rb +47 -0
- data/spec/models/schedule_spec.rb +85 -0
- data/spec/models/tax_component_spec.rb +59 -0
- data/spec/models/tax_rate_spec.rb +115 -0
- data/spec/models/tax_rates_spec.rb +41 -0
- data/spec/models/tax_type_spec.rb +35 -0
- data/spec/models/ten_nintey_nine_contact_spec.rb +167 -0
- data/spec/models/time_zone_spec.rb +35 -0
- data/spec/models/tracking_categories_spec.rb +41 -0
- data/spec/models/tracking_category_spec.rb +75 -0
- data/spec/models/tracking_option_spec.rb +63 -0
- data/spec/models/tracking_options_spec.rb +41 -0
- data/spec/models/user_spec.rb +81 -0
- data/spec/models/users_spec.rb +41 -0
- data/spec/models/validation_error_spec.rb +41 -0
- data/spec/spec_helper.rb +111 -0
- data/xero-ruby.gemspec +39 -0
- metadata +563 -0
@@ -0,0 +1,197 @@
|
|
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 CurrencyCode
|
18
|
+
AED = "AED".freeze
|
19
|
+
AFN = "AFN".freeze
|
20
|
+
ALL = "ALL".freeze
|
21
|
+
AMD = "AMD".freeze
|
22
|
+
ANG = "ANG".freeze
|
23
|
+
AOA = "AOA".freeze
|
24
|
+
ARS = "ARS".freeze
|
25
|
+
AUD = "AUD".freeze
|
26
|
+
AWG = "AWG".freeze
|
27
|
+
AZN = "AZN".freeze
|
28
|
+
BAM = "BAM".freeze
|
29
|
+
BBD = "BBD".freeze
|
30
|
+
BDT = "BDT".freeze
|
31
|
+
BGN = "BGN".freeze
|
32
|
+
BHD = "BHD".freeze
|
33
|
+
BIF = "BIF".freeze
|
34
|
+
BMD = "BMD".freeze
|
35
|
+
BND = "BND".freeze
|
36
|
+
BOB = "BOB".freeze
|
37
|
+
BRL = "BRL".freeze
|
38
|
+
BSD = "BSD".freeze
|
39
|
+
BTN = "BTN".freeze
|
40
|
+
BWP = "BWP".freeze
|
41
|
+
BYN = "BYN".freeze
|
42
|
+
BZD = "BZD".freeze
|
43
|
+
CAD = "CAD".freeze
|
44
|
+
CDF = "CDF".freeze
|
45
|
+
CHF = "CHF".freeze
|
46
|
+
CLP = "CLP".freeze
|
47
|
+
CNY = "CNY".freeze
|
48
|
+
COP = "COP".freeze
|
49
|
+
CRC = "CRC".freeze
|
50
|
+
CUC = "CUC".freeze
|
51
|
+
CUP = "CUP".freeze
|
52
|
+
CVE = "CVE".freeze
|
53
|
+
CZK = "CZK".freeze
|
54
|
+
DJF = "DJF".freeze
|
55
|
+
DKK = "DKK".freeze
|
56
|
+
DOP = "DOP".freeze
|
57
|
+
DZD = "DZD".freeze
|
58
|
+
EGP = "EGP".freeze
|
59
|
+
ERN = "ERN".freeze
|
60
|
+
ETB = "ETB".freeze
|
61
|
+
EUR = "EUR".freeze
|
62
|
+
FJD = "FJD".freeze
|
63
|
+
FKP = "FKP".freeze
|
64
|
+
GBP = "GBP".freeze
|
65
|
+
GEL = "GEL".freeze
|
66
|
+
GGP = "GGP".freeze
|
67
|
+
GHS = "GHS".freeze
|
68
|
+
GIP = "GIP".freeze
|
69
|
+
GMD = "GMD".freeze
|
70
|
+
GNF = "GNF".freeze
|
71
|
+
GTQ = "GTQ".freeze
|
72
|
+
GYD = "GYD".freeze
|
73
|
+
HKD = "HKD".freeze
|
74
|
+
HNL = "HNL".freeze
|
75
|
+
HRK = "HRK".freeze
|
76
|
+
HTG = "HTG".freeze
|
77
|
+
HUF = "HUF".freeze
|
78
|
+
IDR = "IDR".freeze
|
79
|
+
ILS = "ILS".freeze
|
80
|
+
IMP = "IMP".freeze
|
81
|
+
INR = "INR".freeze
|
82
|
+
IQD = "IQD".freeze
|
83
|
+
IRR = "IRR".freeze
|
84
|
+
ISK = "ISK".freeze
|
85
|
+
JEP = "JEP".freeze
|
86
|
+
JMD = "JMD".freeze
|
87
|
+
JOD = "JOD".freeze
|
88
|
+
JPY = "JPY".freeze
|
89
|
+
KES = "KES".freeze
|
90
|
+
KGS = "KGS".freeze
|
91
|
+
KHR = "KHR".freeze
|
92
|
+
KMF = "KMF".freeze
|
93
|
+
KPW = "KPW".freeze
|
94
|
+
KRW = "KRW".freeze
|
95
|
+
KWD = "KWD".freeze
|
96
|
+
KYD = "KYD".freeze
|
97
|
+
KZT = "KZT".freeze
|
98
|
+
LAK = "LAK".freeze
|
99
|
+
LBP = "LBP".freeze
|
100
|
+
LKR = "LKR".freeze
|
101
|
+
LRD = "LRD".freeze
|
102
|
+
LSL = "LSL".freeze
|
103
|
+
LYD = "LYD".freeze
|
104
|
+
MAD = "MAD".freeze
|
105
|
+
MDL = "MDL".freeze
|
106
|
+
MGA = "MGA".freeze
|
107
|
+
MKD = "MKD".freeze
|
108
|
+
MMK = "MMK".freeze
|
109
|
+
MNT = "MNT".freeze
|
110
|
+
MOP = "MOP".freeze
|
111
|
+
MRU = "MRU".freeze
|
112
|
+
MUR = "MUR".freeze
|
113
|
+
MVR = "MVR".freeze
|
114
|
+
MWK = "MWK".freeze
|
115
|
+
MXN = "MXN".freeze
|
116
|
+
MYR = "MYR".freeze
|
117
|
+
MZN = "MZN".freeze
|
118
|
+
NAD = "NAD".freeze
|
119
|
+
NGN = "NGN".freeze
|
120
|
+
NIO = "NIO".freeze
|
121
|
+
NOK = "NOK".freeze
|
122
|
+
NPR = "NPR".freeze
|
123
|
+
NZD = "NZD".freeze
|
124
|
+
OMR = "OMR".freeze
|
125
|
+
PAB = "PAB".freeze
|
126
|
+
PEN = "PEN".freeze
|
127
|
+
PGK = "PGK".freeze
|
128
|
+
PHP = "PHP".freeze
|
129
|
+
PKR = "PKR".freeze
|
130
|
+
PLN = "PLN".freeze
|
131
|
+
PYG = "PYG".freeze
|
132
|
+
QAR = "QAR".freeze
|
133
|
+
RON = "RON".freeze
|
134
|
+
RSD = "RSD".freeze
|
135
|
+
RUB = "RUB".freeze
|
136
|
+
RWF = "RWF".freeze
|
137
|
+
SAR = "SAR".freeze
|
138
|
+
SBD = "SBD".freeze
|
139
|
+
SCR = "SCR".freeze
|
140
|
+
SDG = "SDG".freeze
|
141
|
+
SEK = "SEK".freeze
|
142
|
+
SGD = "SGD".freeze
|
143
|
+
SHP = "SHP".freeze
|
144
|
+
SLL = "SLL".freeze
|
145
|
+
SOS = "SOS".freeze
|
146
|
+
SPL = "SPL".freeze
|
147
|
+
SRD = "SRD".freeze
|
148
|
+
STN = "STN".freeze
|
149
|
+
SVC = "SVC".freeze
|
150
|
+
SYP = "SYP".freeze
|
151
|
+
SZL = "SZL".freeze
|
152
|
+
THB = "THB".freeze
|
153
|
+
TJS = "TJS".freeze
|
154
|
+
TMT = "TMT".freeze
|
155
|
+
TND = "TND".freeze
|
156
|
+
TOP = "TOP".freeze
|
157
|
+
TRY = "TRY".freeze
|
158
|
+
TTD = "TTD".freeze
|
159
|
+
TVD = "TVD".freeze
|
160
|
+
TWD = "TWD".freeze
|
161
|
+
TZS = "TZS".freeze
|
162
|
+
UAH = "UAH".freeze
|
163
|
+
UGX = "UGX".freeze
|
164
|
+
USD = "USD".freeze
|
165
|
+
UYU = "UYU".freeze
|
166
|
+
UZS = "UZS".freeze
|
167
|
+
VEF = "VEF".freeze
|
168
|
+
VND = "VND".freeze
|
169
|
+
VUV = "VUV".freeze
|
170
|
+
WST = "WST".freeze
|
171
|
+
XAF = "XAF".freeze
|
172
|
+
XCD = "XCD".freeze
|
173
|
+
XDR = "XDR".freeze
|
174
|
+
XOF = "XOF".freeze
|
175
|
+
XPF = "XPF".freeze
|
176
|
+
YER = "YER".freeze
|
177
|
+
ZAR = "ZAR".freeze
|
178
|
+
ZMW = "ZMW".freeze
|
179
|
+
ZWD = "ZWD".freeze
|
180
|
+
|
181
|
+
# Builds the enum from string
|
182
|
+
# @param [String] The enum value in the form of the string
|
183
|
+
# @return [String] The enum value
|
184
|
+
def self.build_from_hash(value)
|
185
|
+
new.build_from_hash(value)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Builds the enum from string
|
189
|
+
# @param [String] The enum value in the form of the string
|
190
|
+
# @return [String] The enum value
|
191
|
+
def build_from_hash(value)
|
192
|
+
constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }
|
193
|
+
raise "Invalid ENUM value #{value} for class #CurrencyCode" if constantValues.empty?
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,206 @@
|
|
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 Element
|
18
|
+
# Array of Validation Error message
|
19
|
+
attr_accessor :validation_errors
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'validation_errors' => :'ValidationErrors'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.openapi_types
|
30
|
+
{
|
31
|
+
:'validation_errors' => :'Array<ValidationError>'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
if (!attributes.is_a?(Hash))
|
39
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Element` initialize method"
|
40
|
+
end
|
41
|
+
|
42
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
43
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
44
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
45
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Element`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
46
|
+
end
|
47
|
+
h[k.to_sym] = v
|
48
|
+
}
|
49
|
+
|
50
|
+
if attributes.key?(:'validation_errors')
|
51
|
+
if (value = attributes[:'validation_errors']).is_a?(Array)
|
52
|
+
self.validation_errors = value
|
53
|
+
end
|
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
|
+
invalid_properties
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check to see if the all the properties in the model are valid
|
65
|
+
# @return true if the model is valid
|
66
|
+
def valid?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(o)
|
73
|
+
return true if self.equal?(o)
|
74
|
+
self.class == o.class &&
|
75
|
+
validation_errors == o.validation_errors
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Integer] Hash code
|
86
|
+
def hash
|
87
|
+
[validation_errors].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def self.build_from_hash(attributes)
|
94
|
+
new.build_from_hash(attributes)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def build_from_hash(attributes)
|
101
|
+
return nil unless attributes.is_a?(Hash)
|
102
|
+
self.class.openapi_types.each_pair do |key, type|
|
103
|
+
if type =~ /\AArray<(.*)>/i
|
104
|
+
# check to ensure the input is an array given that the attribute
|
105
|
+
# is documented as an array but the input is not
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
|
+
end
|
109
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
111
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
112
|
+
end
|
113
|
+
|
114
|
+
self
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserializes the data based on type
|
118
|
+
# @param string type Data type
|
119
|
+
# @param string value Value to be deserialized
|
120
|
+
# @return [Object] Deserialized data
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(parse_date(value))
|
125
|
+
when :Date
|
126
|
+
Date._iso8601(parse_date(value))
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :Boolean
|
134
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns the string representation of the object
|
159
|
+
# @return [String] String presentation of the object
|
160
|
+
def to_s
|
161
|
+
to_hash.to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
# to_body is an alias to to_hash (backward compatibility)
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_body
|
167
|
+
to_hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the object in the form of hash
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
172
|
+
def to_hash
|
173
|
+
hash = {}
|
174
|
+
self.class.attribute_map.each_pair do |attr, param|
|
175
|
+
value = self.send(attr)
|
176
|
+
next if value.nil?
|
177
|
+
hash[param] = _to_hash(value)
|
178
|
+
end
|
179
|
+
hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Outputs non-array value in the form of hash
|
183
|
+
# For object, use to_hash. Otherwise, just return the value
|
184
|
+
# @param [Object] value Any valid value
|
185
|
+
# @return [Hash] Returns the value in the form of hash
|
186
|
+
def _to_hash(value)
|
187
|
+
if value.is_a?(Array)
|
188
|
+
value.compact.map { |v| _to_hash(v) }
|
189
|
+
elsif value.is_a?(Hash)
|
190
|
+
{}.tap do |hash|
|
191
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
192
|
+
end
|
193
|
+
elsif value.respond_to? :to_hash
|
194
|
+
value.to_hash
|
195
|
+
else
|
196
|
+
value
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# customized data_parser
|
201
|
+
def parse_date(datestring)
|
202
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
203
|
+
return Time.at(seconds_since_epoch).to_s
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,316 @@
|
|
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 Employee
|
18
|
+
# The Xero identifier for an employee e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9
|
19
|
+
attr_accessor :employee_id
|
20
|
+
|
21
|
+
# Current status of an employee – see contact status types
|
22
|
+
attr_accessor :status
|
23
|
+
|
24
|
+
# First name of an employee (max length = 255)
|
25
|
+
attr_accessor :first_name
|
26
|
+
|
27
|
+
# Last name of an employee (max length = 255)
|
28
|
+
attr_accessor :last_name
|
29
|
+
|
30
|
+
attr_accessor :external_link
|
31
|
+
|
32
|
+
attr_accessor :updated_date_utc
|
33
|
+
|
34
|
+
class EnumAttributeValidator
|
35
|
+
attr_reader :datatype
|
36
|
+
attr_reader :allowable_values
|
37
|
+
|
38
|
+
def initialize(datatype, allowable_values)
|
39
|
+
@allowable_values = allowable_values.map do |value|
|
40
|
+
case datatype.to_s
|
41
|
+
when /Integer/i
|
42
|
+
value.to_i
|
43
|
+
when /Float/i
|
44
|
+
value.to_f
|
45
|
+
else
|
46
|
+
value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def valid?(value)
|
52
|
+
!value || allowable_values.include?(value)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'employee_id' => :'EmployeeID',
|
60
|
+
:'status' => :'Status',
|
61
|
+
:'first_name' => :'FirstName',
|
62
|
+
:'last_name' => :'LastName',
|
63
|
+
:'external_link' => :'ExternalLink',
|
64
|
+
:'updated_date_utc' => :'UpdatedDateUTC'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'employee_id' => :'String',
|
72
|
+
:'status' => :'String',
|
73
|
+
:'first_name' => :'String',
|
74
|
+
:'last_name' => :'String',
|
75
|
+
:'external_link' => :'ExternalLink',
|
76
|
+
:'updated_date_utc' => :'DateTime'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Employee` initialize method"
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Employee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'employee_id')
|
96
|
+
self.employee_id = attributes[:'employee_id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'status')
|
100
|
+
self.status = attributes[:'status']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'first_name')
|
104
|
+
self.first_name = attributes[:'first_name']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'last_name')
|
108
|
+
self.last_name = attributes[:'last_name']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'external_link')
|
112
|
+
self.external_link = attributes[:'external_link']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'updated_date_utc')
|
116
|
+
self.updated_date_utc = attributes[:'updated_date_utc']
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
+
# @return Array for valid properties with the reasons
|
122
|
+
def list_invalid_properties
|
123
|
+
invalid_properties = Array.new
|
124
|
+
if !@first_name.nil? && @first_name.to_s.length > 255
|
125
|
+
invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.')
|
126
|
+
end
|
127
|
+
|
128
|
+
if !@last_name.nil? && @last_name.to_s.length > 255
|
129
|
+
invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.')
|
130
|
+
end
|
131
|
+
|
132
|
+
invalid_properties
|
133
|
+
end
|
134
|
+
|
135
|
+
# Check to see if the all the properties in the model are valid
|
136
|
+
# @return true if the model is valid
|
137
|
+
def valid?
|
138
|
+
status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "GDPRREQUEST"])
|
139
|
+
return false unless status_validator.valid?(@status)
|
140
|
+
return false if !@first_name.nil? && @first_name.to_s.length > 255
|
141
|
+
return false if !@last_name.nil? && @last_name.to_s.length > 255
|
142
|
+
true
|
143
|
+
end
|
144
|
+
|
145
|
+
# Custom attribute writer method checking allowed values (enum).
|
146
|
+
# @param [Object] status Object to be assigned
|
147
|
+
def status=(status)
|
148
|
+
validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "GDPRREQUEST"])
|
149
|
+
unless validator.valid?(status)
|
150
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
151
|
+
end
|
152
|
+
@status = status
|
153
|
+
end
|
154
|
+
|
155
|
+
# Custom attribute writer method with validation
|
156
|
+
# @param [Object] first_name Value to be assigned
|
157
|
+
def first_name=(first_name)
|
158
|
+
if !first_name.nil? && first_name.to_s.length > 255
|
159
|
+
fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 255.'
|
160
|
+
end
|
161
|
+
|
162
|
+
@first_name = first_name
|
163
|
+
end
|
164
|
+
|
165
|
+
# Custom attribute writer method with validation
|
166
|
+
# @param [Object] last_name Value to be assigned
|
167
|
+
def last_name=(last_name)
|
168
|
+
if !last_name.nil? && last_name.to_s.length > 255
|
169
|
+
fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 255.'
|
170
|
+
end
|
171
|
+
|
172
|
+
@last_name = last_name
|
173
|
+
end
|
174
|
+
|
175
|
+
# Checks equality by comparing each attribute.
|
176
|
+
# @param [Object] Object to be compared
|
177
|
+
def ==(o)
|
178
|
+
return true if self.equal?(o)
|
179
|
+
self.class == o.class &&
|
180
|
+
employee_id == o.employee_id &&
|
181
|
+
status == o.status &&
|
182
|
+
first_name == o.first_name &&
|
183
|
+
last_name == o.last_name &&
|
184
|
+
external_link == o.external_link &&
|
185
|
+
updated_date_utc == o.updated_date_utc
|
186
|
+
end
|
187
|
+
|
188
|
+
# @see the `==` method
|
189
|
+
# @param [Object] Object to be compared
|
190
|
+
def eql?(o)
|
191
|
+
self == o
|
192
|
+
end
|
193
|
+
|
194
|
+
# Calculates hash code according to all attributes.
|
195
|
+
# @return [Integer] Hash code
|
196
|
+
def hash
|
197
|
+
[employee_id, status, first_name, last_name, external_link, updated_date_utc].hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Builds the object from hash
|
201
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
202
|
+
# @return [Object] Returns the model itself
|
203
|
+
def self.build_from_hash(attributes)
|
204
|
+
new.build_from_hash(attributes)
|
205
|
+
end
|
206
|
+
|
207
|
+
# Builds the object from hash
|
208
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
209
|
+
# @return [Object] Returns the model itself
|
210
|
+
def build_from_hash(attributes)
|
211
|
+
return nil unless attributes.is_a?(Hash)
|
212
|
+
self.class.openapi_types.each_pair do |key, type|
|
213
|
+
if type =~ /\AArray<(.*)>/i
|
214
|
+
# check to ensure the input is an array given that the attribute
|
215
|
+
# is documented as an array but the input is not
|
216
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
217
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
218
|
+
end
|
219
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
220
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
221
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
222
|
+
end
|
223
|
+
|
224
|
+
self
|
225
|
+
end
|
226
|
+
|
227
|
+
# Deserializes the data based on type
|
228
|
+
# @param string type Data type
|
229
|
+
# @param string value Value to be deserialized
|
230
|
+
# @return [Object] Deserialized data
|
231
|
+
def _deserialize(type, value)
|
232
|
+
case type.to_sym
|
233
|
+
when :DateTime
|
234
|
+
DateTime.parse(parse_date(value))
|
235
|
+
when :Date
|
236
|
+
Date._iso8601(parse_date(value))
|
237
|
+
when :String
|
238
|
+
value.to_s
|
239
|
+
when :Integer
|
240
|
+
value.to_i
|
241
|
+
when :Float
|
242
|
+
value.to_f
|
243
|
+
when :Boolean
|
244
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
245
|
+
true
|
246
|
+
else
|
247
|
+
false
|
248
|
+
end
|
249
|
+
when :Object
|
250
|
+
# generic object (usually a Hash), return directly
|
251
|
+
value
|
252
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
253
|
+
inner_type = Regexp.last_match[:inner_type]
|
254
|
+
value.map { |v| _deserialize(inner_type, v) }
|
255
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
256
|
+
k_type = Regexp.last_match[:k_type]
|
257
|
+
v_type = Regexp.last_match[:v_type]
|
258
|
+
{}.tap do |hash|
|
259
|
+
value.each do |k, v|
|
260
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
else # model
|
264
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# Returns the string representation of the object
|
269
|
+
# @return [String] String presentation of the object
|
270
|
+
def to_s
|
271
|
+
to_hash.to_s
|
272
|
+
end
|
273
|
+
|
274
|
+
# to_body is an alias to to_hash (backward compatibility)
|
275
|
+
# @return [Hash] Returns the object in the form of hash
|
276
|
+
def to_body
|
277
|
+
to_hash
|
278
|
+
end
|
279
|
+
|
280
|
+
# Returns the object in the form of hash
|
281
|
+
# @return [Hash] Returns the object in the form of hash
|
282
|
+
def to_hash
|
283
|
+
hash = {}
|
284
|
+
self.class.attribute_map.each_pair do |attr, param|
|
285
|
+
value = self.send(attr)
|
286
|
+
next if value.nil?
|
287
|
+
hash[param] = _to_hash(value)
|
288
|
+
end
|
289
|
+
hash
|
290
|
+
end
|
291
|
+
|
292
|
+
# Outputs non-array value in the form of hash
|
293
|
+
# For object, use to_hash. Otherwise, just return the value
|
294
|
+
# @param [Object] value Any valid value
|
295
|
+
# @return [Hash] Returns the value in the form of hash
|
296
|
+
def _to_hash(value)
|
297
|
+
if value.is_a?(Array)
|
298
|
+
value.compact.map { |v| _to_hash(v) }
|
299
|
+
elsif value.is_a?(Hash)
|
300
|
+
{}.tap do |hash|
|
301
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
302
|
+
end
|
303
|
+
elsif value.respond_to? :to_hash
|
304
|
+
value.to_hash
|
305
|
+
else
|
306
|
+
value
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
# customized data_parser
|
311
|
+
def parse_date(datestring)
|
312
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
313
|
+
return Time.at(seconds_since_epoch).to_s
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|