xero-ruby 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,484 @@
|
|
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 Account
|
18
|
+
# Customer defined alpha numeric account code e.g 200 or SALES (max length = 10)
|
19
|
+
attr_accessor :code
|
20
|
+
|
21
|
+
# Name of account (max length = 150)
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
# The Xero identifier for an account – specified as a string following the endpoint name e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9
|
25
|
+
attr_accessor :account_id
|
26
|
+
|
27
|
+
attr_accessor :type
|
28
|
+
|
29
|
+
# For bank accounts only (Account Type BANK)
|
30
|
+
attr_accessor :bank_account_number
|
31
|
+
|
32
|
+
# Accounts with a status of ACTIVE can be updated to ARCHIVED. See Account Status Codes
|
33
|
+
attr_accessor :status
|
34
|
+
|
35
|
+
# Description of the Account. Valid for all types of accounts except bank accounts (max length = 4000)
|
36
|
+
attr_accessor :description
|
37
|
+
|
38
|
+
# For bank accounts only. See Bank Account types
|
39
|
+
attr_accessor :bank_account_type
|
40
|
+
|
41
|
+
attr_accessor :currency_code
|
42
|
+
|
43
|
+
# The tax type from TaxRates
|
44
|
+
attr_accessor :tax_type
|
45
|
+
|
46
|
+
# Boolean – describes whether account can have payments applied to it
|
47
|
+
attr_accessor :enable_payments_to_account
|
48
|
+
|
49
|
+
# Boolean – describes whether account code is available for use with expense claims
|
50
|
+
attr_accessor :show_in_expense_claims
|
51
|
+
|
52
|
+
# See Account Class Types
|
53
|
+
attr_accessor :_class
|
54
|
+
|
55
|
+
# If this is a system account then this element is returned. See System Account types. Note that non-system accounts may have this element set as either “” or null.
|
56
|
+
attr_accessor :system_account
|
57
|
+
|
58
|
+
# Shown if set
|
59
|
+
attr_accessor :reporting_code
|
60
|
+
|
61
|
+
# Shown if set
|
62
|
+
attr_accessor :reporting_code_name
|
63
|
+
|
64
|
+
# boolean to indicate if an account has an attachment (read only)
|
65
|
+
attr_accessor :has_attachments
|
66
|
+
|
67
|
+
# Last modified date UTC format
|
68
|
+
attr_accessor :updated_date_utc
|
69
|
+
|
70
|
+
# Displays array of validation error messages from the API
|
71
|
+
attr_accessor :validation_errors
|
72
|
+
|
73
|
+
class EnumAttributeValidator
|
74
|
+
attr_reader :datatype
|
75
|
+
attr_reader :allowable_values
|
76
|
+
|
77
|
+
def initialize(datatype, allowable_values)
|
78
|
+
@allowable_values = allowable_values.map do |value|
|
79
|
+
case datatype.to_s
|
80
|
+
when /Integer/i
|
81
|
+
value.to_i
|
82
|
+
when /Float/i
|
83
|
+
value.to_f
|
84
|
+
else
|
85
|
+
value
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def valid?(value)
|
91
|
+
!value || allowable_values.include?(value)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
96
|
+
def self.attribute_map
|
97
|
+
{
|
98
|
+
:'code' => :'Code',
|
99
|
+
:'name' => :'Name',
|
100
|
+
:'account_id' => :'AccountID',
|
101
|
+
:'type' => :'Type',
|
102
|
+
:'bank_account_number' => :'BankAccountNumber',
|
103
|
+
:'status' => :'Status',
|
104
|
+
:'description' => :'Description',
|
105
|
+
:'bank_account_type' => :'BankAccountType',
|
106
|
+
:'currency_code' => :'CurrencyCode',
|
107
|
+
:'tax_type' => :'TaxType',
|
108
|
+
:'enable_payments_to_account' => :'EnablePaymentsToAccount',
|
109
|
+
:'show_in_expense_claims' => :'ShowInExpenseClaims',
|
110
|
+
:'_class' => :'Class',
|
111
|
+
:'system_account' => :'SystemAccount',
|
112
|
+
:'reporting_code' => :'ReportingCode',
|
113
|
+
:'reporting_code_name' => :'ReportingCodeName',
|
114
|
+
:'has_attachments' => :'HasAttachments',
|
115
|
+
:'updated_date_utc' => :'UpdatedDateUTC',
|
116
|
+
:'validation_errors' => :'ValidationErrors'
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
# Attribute type mapping.
|
121
|
+
def self.openapi_types
|
122
|
+
{
|
123
|
+
:'code' => :'String',
|
124
|
+
:'name' => :'String',
|
125
|
+
:'account_id' => :'String',
|
126
|
+
:'type' => :'AccountType',
|
127
|
+
:'bank_account_number' => :'String',
|
128
|
+
:'status' => :'String',
|
129
|
+
:'description' => :'String',
|
130
|
+
:'bank_account_type' => :'String',
|
131
|
+
:'currency_code' => :'CurrencyCode',
|
132
|
+
:'tax_type' => :'String',
|
133
|
+
:'enable_payments_to_account' => :'Boolean',
|
134
|
+
:'show_in_expense_claims' => :'Boolean',
|
135
|
+
:'_class' => :'String',
|
136
|
+
:'system_account' => :'String',
|
137
|
+
:'reporting_code' => :'String',
|
138
|
+
:'reporting_code_name' => :'String',
|
139
|
+
:'has_attachments' => :'Boolean',
|
140
|
+
:'updated_date_utc' => :'DateTime',
|
141
|
+
:'validation_errors' => :'Array<ValidationError>'
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
# Initializes the object
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
def initialize(attributes = {})
|
148
|
+
if (!attributes.is_a?(Hash))
|
149
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Account` initialize method"
|
150
|
+
end
|
151
|
+
|
152
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
153
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
154
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
155
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Account`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
156
|
+
end
|
157
|
+
h[k.to_sym] = v
|
158
|
+
}
|
159
|
+
|
160
|
+
if attributes.key?(:'code')
|
161
|
+
self.code = attributes[:'code']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'name')
|
165
|
+
self.name = attributes[:'name']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.key?(:'account_id')
|
169
|
+
self.account_id = attributes[:'account_id']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'type')
|
173
|
+
self.type = attributes[:'type']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.key?(:'bank_account_number')
|
177
|
+
self.bank_account_number = attributes[:'bank_account_number']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.key?(:'status')
|
181
|
+
self.status = attributes[:'status']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'description')
|
185
|
+
self.description = attributes[:'description']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'bank_account_type')
|
189
|
+
self.bank_account_type = attributes[:'bank_account_type']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'currency_code')
|
193
|
+
self.currency_code = attributes[:'currency_code']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'tax_type')
|
197
|
+
self.tax_type = attributes[:'tax_type']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.key?(:'enable_payments_to_account')
|
201
|
+
self.enable_payments_to_account = attributes[:'enable_payments_to_account']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.key?(:'show_in_expense_claims')
|
205
|
+
self.show_in_expense_claims = attributes[:'show_in_expense_claims']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.key?(:'_class')
|
209
|
+
self._class = attributes[:'_class']
|
210
|
+
end
|
211
|
+
|
212
|
+
if attributes.key?(:'system_account')
|
213
|
+
self.system_account = attributes[:'system_account']
|
214
|
+
end
|
215
|
+
|
216
|
+
if attributes.key?(:'reporting_code')
|
217
|
+
self.reporting_code = attributes[:'reporting_code']
|
218
|
+
end
|
219
|
+
|
220
|
+
if attributes.key?(:'reporting_code_name')
|
221
|
+
self.reporting_code_name = attributes[:'reporting_code_name']
|
222
|
+
end
|
223
|
+
|
224
|
+
if attributes.key?(:'has_attachments')
|
225
|
+
self.has_attachments = attributes[:'has_attachments']
|
226
|
+
end
|
227
|
+
|
228
|
+
if attributes.key?(:'updated_date_utc')
|
229
|
+
self.updated_date_utc = attributes[:'updated_date_utc']
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.key?(:'validation_errors')
|
233
|
+
if (value = attributes[:'validation_errors']).is_a?(Array)
|
234
|
+
self.validation_errors = value
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
240
|
+
# @return Array for valid properties with the reasons
|
241
|
+
def list_invalid_properties
|
242
|
+
invalid_properties = Array.new
|
243
|
+
if !@code.nil? && @code.to_s.length > 10
|
244
|
+
invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 10.')
|
245
|
+
end
|
246
|
+
|
247
|
+
if !@name.nil? && @name.to_s.length > 150
|
248
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 150.')
|
249
|
+
end
|
250
|
+
|
251
|
+
invalid_properties
|
252
|
+
end
|
253
|
+
|
254
|
+
# Check to see if the all the properties in the model are valid
|
255
|
+
# @return true if the model is valid
|
256
|
+
def valid?
|
257
|
+
return false if !@code.nil? && @code.to_s.length > 10
|
258
|
+
return false if !@name.nil? && @name.to_s.length > 150
|
259
|
+
status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "DELETED"])
|
260
|
+
return false unless status_validator.valid?(@status)
|
261
|
+
bank_account_type_validator = EnumAttributeValidator.new('String', ["BANK", "CREDITCARD", "PAYPAL", "NONE", ""])
|
262
|
+
return false unless bank_account_type_validator.valid?(@bank_account_type)
|
263
|
+
_class_validator = EnumAttributeValidator.new('String', ["ASSET", "EQUITY", "EXPENSE", "LIABILITY", "REVENUE"])
|
264
|
+
return false unless _class_validator.valid?(@_class)
|
265
|
+
system_account_validator = EnumAttributeValidator.new('String', ["DEBTORS", "CREDITORS", "BANKCURRENCYGAIN", "GST", "GSTONIMPORTS", "HISTORICAL", "REALISEDCURRENCYGAIN", "RETAINEDEARNINGS", "ROUNDING", "TRACKINGTRANSFERS", "UNPAIDEXPCLM", "UNREALISEDCURRENCYGAIN", "WAGEPAYABLES", ""])
|
266
|
+
return false unless system_account_validator.valid?(@system_account)
|
267
|
+
true
|
268
|
+
end
|
269
|
+
|
270
|
+
# Custom attribute writer method with validation
|
271
|
+
# @param [Object] code Value to be assigned
|
272
|
+
def code=(code)
|
273
|
+
if !code.nil? && code.to_s.length > 10
|
274
|
+
fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 10.'
|
275
|
+
end
|
276
|
+
|
277
|
+
@code = code
|
278
|
+
end
|
279
|
+
|
280
|
+
# Custom attribute writer method with validation
|
281
|
+
# @param [Object] name Value to be assigned
|
282
|
+
def name=(name)
|
283
|
+
if !name.nil? && name.to_s.length > 150
|
284
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 150.'
|
285
|
+
end
|
286
|
+
|
287
|
+
@name = name
|
288
|
+
end
|
289
|
+
|
290
|
+
# Custom attribute writer method checking allowed values (enum).
|
291
|
+
# @param [Object] status Object to be assigned
|
292
|
+
def status=(status)
|
293
|
+
validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "DELETED"])
|
294
|
+
unless validator.valid?(status)
|
295
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
296
|
+
end
|
297
|
+
@status = status
|
298
|
+
end
|
299
|
+
|
300
|
+
# Custom attribute writer method checking allowed values (enum).
|
301
|
+
# @param [Object] bank_account_type Object to be assigned
|
302
|
+
def bank_account_type=(bank_account_type)
|
303
|
+
validator = EnumAttributeValidator.new('String', ["BANK", "CREDITCARD", "PAYPAL", "NONE", ""])
|
304
|
+
unless validator.valid?(bank_account_type)
|
305
|
+
fail ArgumentError, "invalid value for \"bank_account_type\", must be one of #{validator.allowable_values}."
|
306
|
+
end
|
307
|
+
@bank_account_type = bank_account_type
|
308
|
+
end
|
309
|
+
|
310
|
+
# Custom attribute writer method checking allowed values (enum).
|
311
|
+
# @param [Object] _class Object to be assigned
|
312
|
+
def _class=(_class)
|
313
|
+
validator = EnumAttributeValidator.new('String', ["ASSET", "EQUITY", "EXPENSE", "LIABILITY", "REVENUE"])
|
314
|
+
unless validator.valid?(_class)
|
315
|
+
fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
|
316
|
+
end
|
317
|
+
@_class = _class
|
318
|
+
end
|
319
|
+
|
320
|
+
# Custom attribute writer method checking allowed values (enum).
|
321
|
+
# @param [Object] system_account Object to be assigned
|
322
|
+
def system_account=(system_account)
|
323
|
+
validator = EnumAttributeValidator.new('String', ["DEBTORS", "CREDITORS", "BANKCURRENCYGAIN", "GST", "GSTONIMPORTS", "HISTORICAL", "REALISEDCURRENCYGAIN", "RETAINEDEARNINGS", "ROUNDING", "TRACKINGTRANSFERS", "UNPAIDEXPCLM", "UNREALISEDCURRENCYGAIN", "WAGEPAYABLES", ""])
|
324
|
+
unless validator.valid?(system_account)
|
325
|
+
fail ArgumentError, "invalid value for \"system_account\", must be one of #{validator.allowable_values}."
|
326
|
+
end
|
327
|
+
@system_account = system_account
|
328
|
+
end
|
329
|
+
|
330
|
+
# Checks equality by comparing each attribute.
|
331
|
+
# @param [Object] Object to be compared
|
332
|
+
def ==(o)
|
333
|
+
return true if self.equal?(o)
|
334
|
+
self.class == o.class &&
|
335
|
+
code == o.code &&
|
336
|
+
name == o.name &&
|
337
|
+
account_id == o.account_id &&
|
338
|
+
type == o.type &&
|
339
|
+
bank_account_number == o.bank_account_number &&
|
340
|
+
status == o.status &&
|
341
|
+
description == o.description &&
|
342
|
+
bank_account_type == o.bank_account_type &&
|
343
|
+
currency_code == o.currency_code &&
|
344
|
+
tax_type == o.tax_type &&
|
345
|
+
enable_payments_to_account == o.enable_payments_to_account &&
|
346
|
+
show_in_expense_claims == o.show_in_expense_claims &&
|
347
|
+
_class == o._class &&
|
348
|
+
system_account == o.system_account &&
|
349
|
+
reporting_code == o.reporting_code &&
|
350
|
+
reporting_code_name == o.reporting_code_name &&
|
351
|
+
has_attachments == o.has_attachments &&
|
352
|
+
updated_date_utc == o.updated_date_utc &&
|
353
|
+
validation_errors == o.validation_errors
|
354
|
+
end
|
355
|
+
|
356
|
+
# @see the `==` method
|
357
|
+
# @param [Object] Object to be compared
|
358
|
+
def eql?(o)
|
359
|
+
self == o
|
360
|
+
end
|
361
|
+
|
362
|
+
# Calculates hash code according to all attributes.
|
363
|
+
# @return [Integer] Hash code
|
364
|
+
def hash
|
365
|
+
[code, name, account_id, type, bank_account_number, status, description, bank_account_type, currency_code, tax_type, enable_payments_to_account, show_in_expense_claims, _class, system_account, reporting_code, reporting_code_name, has_attachments, updated_date_utc, validation_errors].hash
|
366
|
+
end
|
367
|
+
|
368
|
+
# Builds the object from hash
|
369
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
370
|
+
# @return [Object] Returns the model itself
|
371
|
+
def self.build_from_hash(attributes)
|
372
|
+
new.build_from_hash(attributes)
|
373
|
+
end
|
374
|
+
|
375
|
+
# Builds the object from hash
|
376
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
377
|
+
# @return [Object] Returns the model itself
|
378
|
+
def build_from_hash(attributes)
|
379
|
+
return nil unless attributes.is_a?(Hash)
|
380
|
+
self.class.openapi_types.each_pair do |key, type|
|
381
|
+
if type =~ /\AArray<(.*)>/i
|
382
|
+
# check to ensure the input is an array given that the attribute
|
383
|
+
# is documented as an array but the input is not
|
384
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
385
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
386
|
+
end
|
387
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
388
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
389
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
390
|
+
end
|
391
|
+
|
392
|
+
self
|
393
|
+
end
|
394
|
+
|
395
|
+
# Deserializes the data based on type
|
396
|
+
# @param string type Data type
|
397
|
+
# @param string value Value to be deserialized
|
398
|
+
# @return [Object] Deserialized data
|
399
|
+
def _deserialize(type, value)
|
400
|
+
case type.to_sym
|
401
|
+
when :DateTime
|
402
|
+
DateTime.parse(parse_date(value))
|
403
|
+
when :Date
|
404
|
+
Date._iso8601(parse_date(value))
|
405
|
+
when :String
|
406
|
+
value.to_s
|
407
|
+
when :Integer
|
408
|
+
value.to_i
|
409
|
+
when :Float
|
410
|
+
value.to_f
|
411
|
+
when :Boolean
|
412
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
413
|
+
true
|
414
|
+
else
|
415
|
+
false
|
416
|
+
end
|
417
|
+
when :Object
|
418
|
+
# generic object (usually a Hash), return directly
|
419
|
+
value
|
420
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
421
|
+
inner_type = Regexp.last_match[:inner_type]
|
422
|
+
value.map { |v| _deserialize(inner_type, v) }
|
423
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
424
|
+
k_type = Regexp.last_match[:k_type]
|
425
|
+
v_type = Regexp.last_match[:v_type]
|
426
|
+
{}.tap do |hash|
|
427
|
+
value.each do |k, v|
|
428
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
429
|
+
end
|
430
|
+
end
|
431
|
+
else # model
|
432
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
# Returns the string representation of the object
|
437
|
+
# @return [String] String presentation of the object
|
438
|
+
def to_s
|
439
|
+
to_hash.to_s
|
440
|
+
end
|
441
|
+
|
442
|
+
# to_body is an alias to to_hash (backward compatibility)
|
443
|
+
# @return [Hash] Returns the object in the form of hash
|
444
|
+
def to_body
|
445
|
+
to_hash
|
446
|
+
end
|
447
|
+
|
448
|
+
# Returns the object in the form of hash
|
449
|
+
# @return [Hash] Returns the object in the form of hash
|
450
|
+
def to_hash
|
451
|
+
hash = {}
|
452
|
+
self.class.attribute_map.each_pair do |attr, param|
|
453
|
+
value = self.send(attr)
|
454
|
+
next if value.nil?
|
455
|
+
hash[param] = _to_hash(value)
|
456
|
+
end
|
457
|
+
hash
|
458
|
+
end
|
459
|
+
|
460
|
+
# Outputs non-array value in the form of hash
|
461
|
+
# For object, use to_hash. Otherwise, just return the value
|
462
|
+
# @param [Object] value Any valid value
|
463
|
+
# @return [Hash] Returns the value in the form of hash
|
464
|
+
def _to_hash(value)
|
465
|
+
if value.is_a?(Array)
|
466
|
+
value.compact.map { |v| _to_hash(v) }
|
467
|
+
elsif value.is_a?(Hash)
|
468
|
+
{}.tap do |hash|
|
469
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
470
|
+
end
|
471
|
+
elsif value.respond_to? :to_hash
|
472
|
+
value.to_hash
|
473
|
+
else
|
474
|
+
value
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
# customized data_parser
|
479
|
+
def parse_date(datestring)
|
480
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
481
|
+
return Time.at(seconds_since_epoch).to_s
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|