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,205 @@
|
|
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 TaxRates
|
18
|
+
attr_accessor :tax_rates
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'tax_rates' => :'TaxRates'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'tax_rates' => :'Array<TaxRate>'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
if (!attributes.is_a?(Hash))
|
38
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::TaxRates` initialize method"
|
39
|
+
end
|
40
|
+
|
41
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
42
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
43
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
44
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::TaxRates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
45
|
+
end
|
46
|
+
h[k.to_sym] = v
|
47
|
+
}
|
48
|
+
|
49
|
+
if attributes.key?(:'tax_rates')
|
50
|
+
if (value = attributes[:'tax_rates']).is_a?(Array)
|
51
|
+
self.tax_rates = value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properties with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
invalid_properties
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check to see if the all the properties in the model are valid
|
64
|
+
# @return true if the model is valid
|
65
|
+
def valid?
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks equality by comparing each attribute.
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
tax_rates == o.tax_rates
|
75
|
+
end
|
76
|
+
|
77
|
+
# @see the `==` method
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def eql?(o)
|
80
|
+
self == o
|
81
|
+
end
|
82
|
+
|
83
|
+
# Calculates hash code according to all attributes.
|
84
|
+
# @return [Integer] Hash code
|
85
|
+
def hash
|
86
|
+
[tax_rates].hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# Builds the object from hash
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
# @return [Object] Returns the model itself
|
92
|
+
def self.build_from_hash(attributes)
|
93
|
+
new.build_from_hash(attributes)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Builds the object from hash
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
+
# @return [Object] Returns the model itself
|
99
|
+
def build_from_hash(attributes)
|
100
|
+
return nil unless attributes.is_a?(Hash)
|
101
|
+
self.class.openapi_types.each_pair do |key, type|
|
102
|
+
if type =~ /\AArray<(.*)>/i
|
103
|
+
# check to ensure the input is an array given that the attribute
|
104
|
+
# is documented as an array but the input is not
|
105
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
106
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
107
|
+
end
|
108
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
109
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
110
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
111
|
+
end
|
112
|
+
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
# Deserializes the data based on type
|
117
|
+
# @param string type Data type
|
118
|
+
# @param string value Value to be deserialized
|
119
|
+
# @return [Object] Deserialized data
|
120
|
+
def _deserialize(type, value)
|
121
|
+
case type.to_sym
|
122
|
+
when :DateTime
|
123
|
+
DateTime.parse(parse_date(value))
|
124
|
+
when :Date
|
125
|
+
Date._iso8601(parse_date(value))
|
126
|
+
when :String
|
127
|
+
value.to_s
|
128
|
+
when :Integer
|
129
|
+
value.to_i
|
130
|
+
when :Float
|
131
|
+
value.to_f
|
132
|
+
when :Boolean
|
133
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
134
|
+
true
|
135
|
+
else
|
136
|
+
false
|
137
|
+
end
|
138
|
+
when :Object
|
139
|
+
# generic object (usually a Hash), return directly
|
140
|
+
value
|
141
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
142
|
+
inner_type = Regexp.last_match[:inner_type]
|
143
|
+
value.map { |v| _deserialize(inner_type, v) }
|
144
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
145
|
+
k_type = Regexp.last_match[:k_type]
|
146
|
+
v_type = Regexp.last_match[:v_type]
|
147
|
+
{}.tap do |hash|
|
148
|
+
value.each do |k, v|
|
149
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else # model
|
153
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the string representation of the object
|
158
|
+
# @return [String] String presentation of the object
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_hash (backward compatibility)
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_body
|
166
|
+
to_hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the object in the form of hash
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_hash
|
172
|
+
hash = {}
|
173
|
+
self.class.attribute_map.each_pair do |attr, param|
|
174
|
+
value = self.send(attr)
|
175
|
+
next if value.nil?
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Outputs non-array value in the form of hash
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
183
|
+
# @param [Object] value Any valid value
|
184
|
+
# @return [Hash] Returns the value in the form of hash
|
185
|
+
def _to_hash(value)
|
186
|
+
if value.is_a?(Array)
|
187
|
+
value.compact.map { |v| _to_hash(v) }
|
188
|
+
elsif value.is_a?(Hash)
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
191
|
+
end
|
192
|
+
elsif value.respond_to? :to_hash
|
193
|
+
value.to_hash
|
194
|
+
else
|
195
|
+
value
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# customized data_parser
|
200
|
+
def parse_date(datestring)
|
201
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
202
|
+
return Time.at(seconds_since_epoch).to_s
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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 TaxType
|
18
|
+
OUTPUT = "OUTPUT".freeze
|
19
|
+
INPUT = "INPUT".freeze
|
20
|
+
CAPEXINPUT = "CAPEXINPUT".freeze
|
21
|
+
EXEMPTEXPORT = "EXEMPTEXPORT".freeze
|
22
|
+
EXEMPTEXPENSES = "EXEMPTEXPENSES".freeze
|
23
|
+
EXEMPTCAPITAL = "EXEMPTCAPITAL".freeze
|
24
|
+
EXEMPTOUTPUT = "EXEMPTOUTPUT".freeze
|
25
|
+
INPUTTAXED = "INPUTTAXED".freeze
|
26
|
+
BASEXCLUDED = "BASEXCLUDED".freeze
|
27
|
+
GSTONCAPIMPORTS = "GSTONCAPIMPORTS".freeze
|
28
|
+
GSTONIMPORTS = "GSTONIMPORTS".freeze
|
29
|
+
NONE = "NONE".freeze
|
30
|
+
INPUT2 = "INPUT2".freeze
|
31
|
+
ZERORATED = "ZERORATED".freeze
|
32
|
+
OUTPUT2 = "OUTPUT2".freeze
|
33
|
+
CAPEXINPUT2 = "CAPEXINPUT2".freeze
|
34
|
+
CAPEXOUTPUT = "CAPEXOUTPUT".freeze
|
35
|
+
CAPEXOUTPUT2 = "CAPEXOUTPUT2".freeze
|
36
|
+
CAPEXSRINPUT = "CAPEXSRINPUT".freeze
|
37
|
+
CAPEXSROUTPUT = "CAPEXSROUTPUT".freeze
|
38
|
+
ECACQUISITIONS = "ECACQUISITIONS".freeze
|
39
|
+
ECZRINPUT = "ECZRINPUT".freeze
|
40
|
+
ECZROUTPUT = "ECZROUTPUT".freeze
|
41
|
+
ECZROUTPUTSERVICES = "ECZROUTPUTSERVICES".freeze
|
42
|
+
EXEMPTINPUT = "EXEMPTINPUT".freeze
|
43
|
+
REVERSECHARGES = "REVERSECHARGES".freeze
|
44
|
+
RRINPUT = "RRINPUT".freeze
|
45
|
+
RROUTPUT = "RROUTPUT".freeze
|
46
|
+
SRINPUT = "SRINPUT".freeze
|
47
|
+
SROUTPUT = "SROUTPUT".freeze
|
48
|
+
ZERORATEDINPUT = "ZERORATEDINPUT".freeze
|
49
|
+
ZERORATEDOUTPUT = "ZERORATEDOUTPUT".freeze
|
50
|
+
BLINPUT = "BLINPUT".freeze
|
51
|
+
DSOUTPUT = "DSOUTPUT".freeze
|
52
|
+
EPINPUT = "EPINPUT".freeze
|
53
|
+
ES33_OUTPUT = "ES33OUTPUT".freeze
|
54
|
+
ESN33_OUTPUT = "ESN33OUTPUT".freeze
|
55
|
+
IGDSINPUT2 = "IGDSINPUT2".freeze
|
56
|
+
IMINPUT2 = "IMINPUT2".freeze
|
57
|
+
MEINPUT = "MEINPUT".freeze
|
58
|
+
NRINPUT = "NRINPUT".freeze
|
59
|
+
OPINPUT = "OPINPUT".freeze
|
60
|
+
OSOUTPUT = "OSOUTPUT".freeze
|
61
|
+
TXESSINPUT = "TXESSINPUT".freeze
|
62
|
+
TXN33_INPUT = "TXN33INPUT".freeze
|
63
|
+
TXPETINPUT = "TXPETINPUT".freeze
|
64
|
+
TXREINPUT = "TXREINPUT".freeze
|
65
|
+
INPUT3 = "INPUT3".freeze
|
66
|
+
INPUT4 = "INPUT4".freeze
|
67
|
+
OUTPUT3 = "OUTPUT3".freeze
|
68
|
+
OUTPUT4 = "OUTPUT4".freeze
|
69
|
+
SROUTPUT2 = "SROUTPUT2".freeze
|
70
|
+
|
71
|
+
# Builds the enum from string
|
72
|
+
# @param [String] The enum value in the form of the string
|
73
|
+
# @return [String] The enum value
|
74
|
+
def self.build_from_hash(value)
|
75
|
+
new.build_from_hash(value)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Builds the enum from string
|
79
|
+
# @param [String] The enum value in the form of the string
|
80
|
+
# @return [String] The enum value
|
81
|
+
def build_from_hash(value)
|
82
|
+
constantValues = TaxType.constants.select { |c| TaxType::const_get(c) == value }
|
83
|
+
raise "Invalid ENUM value #{value} for class #TaxType" if constantValues.empty?
|
84
|
+
value
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,414 @@
|
|
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 TenNinteyNineContact
|
18
|
+
# Box 1 on 1099 Form
|
19
|
+
attr_accessor :box1
|
20
|
+
|
21
|
+
# Box 2 on 1099 Form
|
22
|
+
attr_accessor :box2
|
23
|
+
|
24
|
+
# Box 3 on 1099 Form
|
25
|
+
attr_accessor :box3
|
26
|
+
|
27
|
+
# Box 4 on 1099 Form
|
28
|
+
attr_accessor :box4
|
29
|
+
|
30
|
+
# Box 5 on 1099 Form
|
31
|
+
attr_accessor :box5
|
32
|
+
|
33
|
+
# Box 6 on 1099 Form
|
34
|
+
attr_accessor :box6
|
35
|
+
|
36
|
+
# Box 7 on 1099 Form
|
37
|
+
attr_accessor :box7
|
38
|
+
|
39
|
+
# Box 8 on 1099 Form
|
40
|
+
attr_accessor :box8
|
41
|
+
|
42
|
+
# Box 9 on 1099 Form
|
43
|
+
attr_accessor :box9
|
44
|
+
|
45
|
+
# Box 10 on 1099 Form
|
46
|
+
attr_accessor :box10
|
47
|
+
|
48
|
+
# Box 11 on 1099 Form
|
49
|
+
attr_accessor :box11
|
50
|
+
|
51
|
+
# Box 13 on 1099 Form
|
52
|
+
attr_accessor :box13
|
53
|
+
|
54
|
+
# Box 14 on 1099 Form
|
55
|
+
attr_accessor :box14
|
56
|
+
|
57
|
+
# Contact name on 1099 Form
|
58
|
+
attr_accessor :name
|
59
|
+
|
60
|
+
# Contact Fed Tax ID type
|
61
|
+
attr_accessor :federal_tax_id_type
|
62
|
+
|
63
|
+
# Contact city on 1099 Form
|
64
|
+
attr_accessor :city
|
65
|
+
|
66
|
+
# Contact zip on 1099 Form
|
67
|
+
attr_accessor :zip
|
68
|
+
|
69
|
+
# Contact State on 1099 Form
|
70
|
+
attr_accessor :state
|
71
|
+
|
72
|
+
# Contact email on 1099 Form
|
73
|
+
attr_accessor :email
|
74
|
+
|
75
|
+
# Contact address on 1099 Form
|
76
|
+
attr_accessor :street_address
|
77
|
+
|
78
|
+
# Contact tax id on 1099 Form
|
79
|
+
attr_accessor :tax_id
|
80
|
+
|
81
|
+
# Contact contact id
|
82
|
+
attr_accessor :contact_id
|
83
|
+
|
84
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
85
|
+
def self.attribute_map
|
86
|
+
{
|
87
|
+
:'box1' => :'Box1',
|
88
|
+
:'box2' => :'Box2',
|
89
|
+
:'box3' => :'Box3',
|
90
|
+
:'box4' => :'Box4',
|
91
|
+
:'box5' => :'Box5',
|
92
|
+
:'box6' => :'Box6',
|
93
|
+
:'box7' => :'Box7',
|
94
|
+
:'box8' => :'Box8',
|
95
|
+
:'box9' => :'Box9',
|
96
|
+
:'box10' => :'Box10',
|
97
|
+
:'box11' => :'Box11',
|
98
|
+
:'box13' => :'Box13',
|
99
|
+
:'box14' => :'Box14',
|
100
|
+
:'name' => :'Name',
|
101
|
+
:'federal_tax_id_type' => :'FederalTaxIDType',
|
102
|
+
:'city' => :'City',
|
103
|
+
:'zip' => :'Zip',
|
104
|
+
:'state' => :'State',
|
105
|
+
:'email' => :'Email',
|
106
|
+
:'street_address' => :'StreetAddress',
|
107
|
+
:'tax_id' => :'TaxID',
|
108
|
+
:'contact_id' => :'ContactId'
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
# Attribute type mapping.
|
113
|
+
def self.openapi_types
|
114
|
+
{
|
115
|
+
:'box1' => :'Float',
|
116
|
+
:'box2' => :'Float',
|
117
|
+
:'box3' => :'Float',
|
118
|
+
:'box4' => :'Float',
|
119
|
+
:'box5' => :'Float',
|
120
|
+
:'box6' => :'Float',
|
121
|
+
:'box7' => :'Float',
|
122
|
+
:'box8' => :'Float',
|
123
|
+
:'box9' => :'Float',
|
124
|
+
:'box10' => :'Float',
|
125
|
+
:'box11' => :'Float',
|
126
|
+
:'box13' => :'Float',
|
127
|
+
:'box14' => :'Float',
|
128
|
+
:'name' => :'String',
|
129
|
+
:'federal_tax_id_type' => :'String',
|
130
|
+
:'city' => :'String',
|
131
|
+
:'zip' => :'String',
|
132
|
+
:'state' => :'String',
|
133
|
+
:'email' => :'String',
|
134
|
+
:'street_address' => :'String',
|
135
|
+
:'tax_id' => :'String',
|
136
|
+
:'contact_id' => :'String'
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
# Initializes the object
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
142
|
+
def initialize(attributes = {})
|
143
|
+
if (!attributes.is_a?(Hash))
|
144
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::TenNinteyNineContact` initialize method"
|
145
|
+
end
|
146
|
+
|
147
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
148
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
149
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
150
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::TenNinteyNineContact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
151
|
+
end
|
152
|
+
h[k.to_sym] = v
|
153
|
+
}
|
154
|
+
|
155
|
+
if attributes.key?(:'box1')
|
156
|
+
self.box1 = attributes[:'box1']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'box2')
|
160
|
+
self.box2 = attributes[:'box2']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'box3')
|
164
|
+
self.box3 = attributes[:'box3']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.key?(:'box4')
|
168
|
+
self.box4 = attributes[:'box4']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'box5')
|
172
|
+
self.box5 = attributes[:'box5']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'box6')
|
176
|
+
self.box6 = attributes[:'box6']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'box7')
|
180
|
+
self.box7 = attributes[:'box7']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'box8')
|
184
|
+
self.box8 = attributes[:'box8']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'box9')
|
188
|
+
self.box9 = attributes[:'box9']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.key?(:'box10')
|
192
|
+
self.box10 = attributes[:'box10']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'box11')
|
196
|
+
self.box11 = attributes[:'box11']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.key?(:'box13')
|
200
|
+
self.box13 = attributes[:'box13']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.key?(:'box14')
|
204
|
+
self.box14 = attributes[:'box14']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'name')
|
208
|
+
self.name = attributes[:'name']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.key?(:'federal_tax_id_type')
|
212
|
+
self.federal_tax_id_type = attributes[:'federal_tax_id_type']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.key?(:'city')
|
216
|
+
self.city = attributes[:'city']
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.key?(:'zip')
|
220
|
+
self.zip = attributes[:'zip']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.key?(:'state')
|
224
|
+
self.state = attributes[:'state']
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.key?(:'email')
|
228
|
+
self.email = attributes[:'email']
|
229
|
+
end
|
230
|
+
|
231
|
+
if attributes.key?(:'street_address')
|
232
|
+
self.street_address = attributes[:'street_address']
|
233
|
+
end
|
234
|
+
|
235
|
+
if attributes.key?(:'tax_id')
|
236
|
+
self.tax_id = attributes[:'tax_id']
|
237
|
+
end
|
238
|
+
|
239
|
+
if attributes.key?(:'contact_id')
|
240
|
+
self.contact_id = attributes[:'contact_id']
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
245
|
+
# @return Array for valid properties with the reasons
|
246
|
+
def list_invalid_properties
|
247
|
+
invalid_properties = Array.new
|
248
|
+
invalid_properties
|
249
|
+
end
|
250
|
+
|
251
|
+
# Check to see if the all the properties in the model are valid
|
252
|
+
# @return true if the model is valid
|
253
|
+
def valid?
|
254
|
+
true
|
255
|
+
end
|
256
|
+
|
257
|
+
# Checks equality by comparing each attribute.
|
258
|
+
# @param [Object] Object to be compared
|
259
|
+
def ==(o)
|
260
|
+
return true if self.equal?(o)
|
261
|
+
self.class == o.class &&
|
262
|
+
box1 == o.box1 &&
|
263
|
+
box2 == o.box2 &&
|
264
|
+
box3 == o.box3 &&
|
265
|
+
box4 == o.box4 &&
|
266
|
+
box5 == o.box5 &&
|
267
|
+
box6 == o.box6 &&
|
268
|
+
box7 == o.box7 &&
|
269
|
+
box8 == o.box8 &&
|
270
|
+
box9 == o.box9 &&
|
271
|
+
box10 == o.box10 &&
|
272
|
+
box11 == o.box11 &&
|
273
|
+
box13 == o.box13 &&
|
274
|
+
box14 == o.box14 &&
|
275
|
+
name == o.name &&
|
276
|
+
federal_tax_id_type == o.federal_tax_id_type &&
|
277
|
+
city == o.city &&
|
278
|
+
zip == o.zip &&
|
279
|
+
state == o.state &&
|
280
|
+
email == o.email &&
|
281
|
+
street_address == o.street_address &&
|
282
|
+
tax_id == o.tax_id &&
|
283
|
+
contact_id == o.contact_id
|
284
|
+
end
|
285
|
+
|
286
|
+
# @see the `==` method
|
287
|
+
# @param [Object] Object to be compared
|
288
|
+
def eql?(o)
|
289
|
+
self == o
|
290
|
+
end
|
291
|
+
|
292
|
+
# Calculates hash code according to all attributes.
|
293
|
+
# @return [Integer] Hash code
|
294
|
+
def hash
|
295
|
+
[box1, box2, box3, box4, box5, box6, box7, box8, box9, box10, box11, box13, box14, name, federal_tax_id_type, city, zip, state, email, street_address, tax_id, contact_id].hash
|
296
|
+
end
|
297
|
+
|
298
|
+
# Builds the object from hash
|
299
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
300
|
+
# @return [Object] Returns the model itself
|
301
|
+
def self.build_from_hash(attributes)
|
302
|
+
new.build_from_hash(attributes)
|
303
|
+
end
|
304
|
+
|
305
|
+
# Builds the object from hash
|
306
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
307
|
+
# @return [Object] Returns the model itself
|
308
|
+
def build_from_hash(attributes)
|
309
|
+
return nil unless attributes.is_a?(Hash)
|
310
|
+
self.class.openapi_types.each_pair do |key, type|
|
311
|
+
if type =~ /\AArray<(.*)>/i
|
312
|
+
# check to ensure the input is an array given that the attribute
|
313
|
+
# is documented as an array but the input is not
|
314
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
315
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
316
|
+
end
|
317
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
318
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
319
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
320
|
+
end
|
321
|
+
|
322
|
+
self
|
323
|
+
end
|
324
|
+
|
325
|
+
# Deserializes the data based on type
|
326
|
+
# @param string type Data type
|
327
|
+
# @param string value Value to be deserialized
|
328
|
+
# @return [Object] Deserialized data
|
329
|
+
def _deserialize(type, value)
|
330
|
+
case type.to_sym
|
331
|
+
when :DateTime
|
332
|
+
DateTime.parse(parse_date(value))
|
333
|
+
when :Date
|
334
|
+
Date._iso8601(parse_date(value))
|
335
|
+
when :String
|
336
|
+
value.to_s
|
337
|
+
when :Integer
|
338
|
+
value.to_i
|
339
|
+
when :Float
|
340
|
+
value.to_f
|
341
|
+
when :Boolean
|
342
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
343
|
+
true
|
344
|
+
else
|
345
|
+
false
|
346
|
+
end
|
347
|
+
when :Object
|
348
|
+
# generic object (usually a Hash), return directly
|
349
|
+
value
|
350
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
351
|
+
inner_type = Regexp.last_match[:inner_type]
|
352
|
+
value.map { |v| _deserialize(inner_type, v) }
|
353
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
354
|
+
k_type = Regexp.last_match[:k_type]
|
355
|
+
v_type = Regexp.last_match[:v_type]
|
356
|
+
{}.tap do |hash|
|
357
|
+
value.each do |k, v|
|
358
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
else # model
|
362
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# Returns the string representation of the object
|
367
|
+
# @return [String] String presentation of the object
|
368
|
+
def to_s
|
369
|
+
to_hash.to_s
|
370
|
+
end
|
371
|
+
|
372
|
+
# to_body is an alias to to_hash (backward compatibility)
|
373
|
+
# @return [Hash] Returns the object in the form of hash
|
374
|
+
def to_body
|
375
|
+
to_hash
|
376
|
+
end
|
377
|
+
|
378
|
+
# Returns the object in the form of hash
|
379
|
+
# @return [Hash] Returns the object in the form of hash
|
380
|
+
def to_hash
|
381
|
+
hash = {}
|
382
|
+
self.class.attribute_map.each_pair do |attr, param|
|
383
|
+
value = self.send(attr)
|
384
|
+
next if value.nil?
|
385
|
+
hash[param] = _to_hash(value)
|
386
|
+
end
|
387
|
+
hash
|
388
|
+
end
|
389
|
+
|
390
|
+
# Outputs non-array value in the form of hash
|
391
|
+
# For object, use to_hash. Otherwise, just return the value
|
392
|
+
# @param [Object] value Any valid value
|
393
|
+
# @return [Hash] Returns the value in the form of hash
|
394
|
+
def _to_hash(value)
|
395
|
+
if value.is_a?(Array)
|
396
|
+
value.compact.map { |v| _to_hash(v) }
|
397
|
+
elsif value.is_a?(Hash)
|
398
|
+
{}.tap do |hash|
|
399
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
400
|
+
end
|
401
|
+
elsif value.respond_to? :to_hash
|
402
|
+
value.to_hash
|
403
|
+
else
|
404
|
+
value
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
# customized data_parser
|
409
|
+
def parse_date(datestring)
|
410
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
411
|
+
return Time.at(seconds_since_epoch).to_s
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|