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,234 @@
|
|
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 HistoryRecord
|
18
|
+
# details
|
19
|
+
attr_accessor :details
|
20
|
+
|
21
|
+
# Name of branding theme
|
22
|
+
attr_accessor :changes
|
23
|
+
|
24
|
+
# has a value of 0
|
25
|
+
attr_accessor :user
|
26
|
+
|
27
|
+
# UTC timestamp of creation date of branding theme
|
28
|
+
attr_accessor :date_utc
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'details' => :'Details',
|
34
|
+
:'changes' => :'Changes',
|
35
|
+
:'user' => :'User',
|
36
|
+
:'date_utc' => :'DateUTC'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.openapi_types
|
42
|
+
{
|
43
|
+
:'details' => :'String',
|
44
|
+
:'changes' => :'String',
|
45
|
+
:'user' => :'String',
|
46
|
+
:'date_utc' => :'DateTime'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::HistoryRecord` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::HistoryRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'details')
|
66
|
+
self.details = attributes[:'details']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'changes')
|
70
|
+
self.changes = attributes[:'changes']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'user')
|
74
|
+
self.user = attributes[:'user']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'date_utc')
|
78
|
+
self.date_utc = attributes[:'date_utc']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
details == o.details &&
|
101
|
+
changes == o.changes &&
|
102
|
+
user == o.user &&
|
103
|
+
date_utc == o.date_utc
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Integer] Hash code
|
114
|
+
def hash
|
115
|
+
[details, changes, user, date_utc].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def self.build_from_hash(attributes)
|
122
|
+
new.build_from_hash(attributes)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def build_from_hash(attributes)
|
129
|
+
return nil unless attributes.is_a?(Hash)
|
130
|
+
self.class.openapi_types.each_pair do |key, type|
|
131
|
+
if type =~ /\AArray<(.*)>/i
|
132
|
+
# check to ensure the input is an array given that the attribute
|
133
|
+
# is documented as an array but the input is not
|
134
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
135
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
136
|
+
end
|
137
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
138
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
139
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
140
|
+
end
|
141
|
+
|
142
|
+
self
|
143
|
+
end
|
144
|
+
|
145
|
+
# Deserializes the data based on type
|
146
|
+
# @param string type Data type
|
147
|
+
# @param string value Value to be deserialized
|
148
|
+
# @return [Object] Deserialized data
|
149
|
+
def _deserialize(type, value)
|
150
|
+
case type.to_sym
|
151
|
+
when :DateTime
|
152
|
+
DateTime.parse(parse_date(value))
|
153
|
+
when :Date
|
154
|
+
Date._iso8601(parse_date(value))
|
155
|
+
when :String
|
156
|
+
value.to_s
|
157
|
+
when :Integer
|
158
|
+
value.to_i
|
159
|
+
when :Float
|
160
|
+
value.to_f
|
161
|
+
when :Boolean
|
162
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
163
|
+
true
|
164
|
+
else
|
165
|
+
false
|
166
|
+
end
|
167
|
+
when :Object
|
168
|
+
# generic object (usually a Hash), return directly
|
169
|
+
value
|
170
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
+
inner_type = Regexp.last_match[:inner_type]
|
172
|
+
value.map { |v| _deserialize(inner_type, v) }
|
173
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
+
k_type = Regexp.last_match[:k_type]
|
175
|
+
v_type = Regexp.last_match[:v_type]
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each do |k, v|
|
178
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
else # model
|
182
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the string representation of the object
|
187
|
+
# @return [String] String presentation of the object
|
188
|
+
def to_s
|
189
|
+
to_hash.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_body
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = self.send(attr)
|
204
|
+
next if value.nil?
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# customized data_parser
|
229
|
+
def parse_date(datestring)
|
230
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
231
|
+
return Time.at(seconds_since_epoch).to_s
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -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 HistoryRecords
|
18
|
+
attr_accessor :history_records
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'history_records' => :'HistoryRecords'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'history_records' => :'Array<HistoryRecord>'
|
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::HistoryRecords` 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::HistoryRecords`. 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?(:'history_records')
|
50
|
+
if (value = attributes[:'history_records']).is_a?(Array)
|
51
|
+
self.history_records = 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
|
+
history_records == o.history_records
|
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
|
+
[history_records].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,666 @@
|
|
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 Invoice
|
18
|
+
# See Invoice Types
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
attr_accessor :contact
|
22
|
+
|
23
|
+
# See LineItems
|
24
|
+
attr_accessor :line_items
|
25
|
+
|
26
|
+
# Date invoice was issued – YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation
|
27
|
+
attr_accessor :date
|
28
|
+
|
29
|
+
# Date invoice is due – YYYY-MM-DD
|
30
|
+
attr_accessor :due_date
|
31
|
+
|
32
|
+
attr_accessor :line_amount_types
|
33
|
+
|
34
|
+
# ACCREC – Unique alpha numeric code identifying invoice (when missing will auto-generate from your Organisation Invoice Settings) (max length = 255)
|
35
|
+
attr_accessor :invoice_number
|
36
|
+
|
37
|
+
# ACCREC only – additional reference number (max length = 255)
|
38
|
+
attr_accessor :reference
|
39
|
+
|
40
|
+
# See BrandingThemes
|
41
|
+
attr_accessor :branding_theme_id
|
42
|
+
|
43
|
+
# URL link to a source document – shown as “Go to [appName]” in the Xero app
|
44
|
+
attr_accessor :url
|
45
|
+
|
46
|
+
attr_accessor :currency_code
|
47
|
+
|
48
|
+
# The currency rate for a multicurrency invoice. If no rate is specified, the XE.com day rate is used. (max length = [18].[6])
|
49
|
+
attr_accessor :currency_rate
|
50
|
+
|
51
|
+
# See Invoice Status Codes
|
52
|
+
attr_accessor :status
|
53
|
+
|
54
|
+
# Boolean to set whether the invoice in the Xero app should be marked as “sent”. This can be set only on invoices that have been approved
|
55
|
+
attr_accessor :sent_to_contact
|
56
|
+
|
57
|
+
# Shown on sales invoices (Accounts Receivable) when this has been set
|
58
|
+
attr_accessor :expected_payment_date
|
59
|
+
|
60
|
+
# Shown on bills (Accounts Payable) when this has been set
|
61
|
+
attr_accessor :planned_payment_date
|
62
|
+
|
63
|
+
# CIS deduction for UK contractors
|
64
|
+
attr_accessor :cis_deduction
|
65
|
+
|
66
|
+
# Total of invoice excluding taxes
|
67
|
+
attr_accessor :sub_total
|
68
|
+
|
69
|
+
# Total tax on invoice
|
70
|
+
attr_accessor :total_tax
|
71
|
+
|
72
|
+
# Total of Invoice tax inclusive (i.e. SubTotal + TotalTax). This will be ignored if it doesn’t equal the sum of the LineAmounts
|
73
|
+
attr_accessor :total
|
74
|
+
|
75
|
+
# Total of discounts applied on the invoice line items
|
76
|
+
attr_accessor :total_discount
|
77
|
+
|
78
|
+
# Xero generated unique identifier for invoice
|
79
|
+
attr_accessor :invoice_id
|
80
|
+
|
81
|
+
# boolean to indicate if an invoice has an attachment
|
82
|
+
attr_accessor :has_attachments
|
83
|
+
|
84
|
+
# boolean to indicate if an invoice has a discount
|
85
|
+
attr_accessor :is_discounted
|
86
|
+
|
87
|
+
# See Payments
|
88
|
+
attr_accessor :payments
|
89
|
+
|
90
|
+
# See Prepayments
|
91
|
+
attr_accessor :prepayments
|
92
|
+
|
93
|
+
# See Overpayments
|
94
|
+
attr_accessor :overpayments
|
95
|
+
|
96
|
+
# Amount remaining to be paid on invoice
|
97
|
+
attr_accessor :amount_due
|
98
|
+
|
99
|
+
# Sum of payments received for invoice
|
100
|
+
attr_accessor :amount_paid
|
101
|
+
|
102
|
+
# The date the invoice was fully paid. Only returned on fully paid invoices
|
103
|
+
attr_accessor :fully_paid_on_date
|
104
|
+
|
105
|
+
# Sum of all credit notes, over-payments and pre-payments applied to invoice
|
106
|
+
attr_accessor :amount_credited
|
107
|
+
|
108
|
+
# Last modified date UTC format
|
109
|
+
attr_accessor :updated_date_utc
|
110
|
+
|
111
|
+
# Details of credit notes that have been applied to an invoice
|
112
|
+
attr_accessor :credit_notes
|
113
|
+
|
114
|
+
# Displays array of attachments from the API
|
115
|
+
attr_accessor :attachments
|
116
|
+
|
117
|
+
# A boolean to indicate if a invoice has an validation errors
|
118
|
+
attr_accessor :has_errors
|
119
|
+
|
120
|
+
# A string to indicate if a invoice status
|
121
|
+
attr_accessor :status_attribute_string
|
122
|
+
|
123
|
+
# Displays array of validation error messages from the API
|
124
|
+
attr_accessor :validation_errors
|
125
|
+
|
126
|
+
class EnumAttributeValidator
|
127
|
+
attr_reader :datatype
|
128
|
+
attr_reader :allowable_values
|
129
|
+
|
130
|
+
def initialize(datatype, allowable_values)
|
131
|
+
@allowable_values = allowable_values.map do |value|
|
132
|
+
case datatype.to_s
|
133
|
+
when /Integer/i
|
134
|
+
value.to_i
|
135
|
+
when /Float/i
|
136
|
+
value.to_f
|
137
|
+
else
|
138
|
+
value
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def valid?(value)
|
144
|
+
!value || allowable_values.include?(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
149
|
+
def self.attribute_map
|
150
|
+
{
|
151
|
+
:'type' => :'Type',
|
152
|
+
:'contact' => :'Contact',
|
153
|
+
:'line_items' => :'LineItems',
|
154
|
+
:'date' => :'Date',
|
155
|
+
:'due_date' => :'DueDate',
|
156
|
+
:'line_amount_types' => :'LineAmountTypes',
|
157
|
+
:'invoice_number' => :'InvoiceNumber',
|
158
|
+
:'reference' => :'Reference',
|
159
|
+
:'branding_theme_id' => :'BrandingThemeID',
|
160
|
+
:'url' => :'Url',
|
161
|
+
:'currency_code' => :'CurrencyCode',
|
162
|
+
:'currency_rate' => :'CurrencyRate',
|
163
|
+
:'status' => :'Status',
|
164
|
+
:'sent_to_contact' => :'SentToContact',
|
165
|
+
:'expected_payment_date' => :'ExpectedPaymentDate',
|
166
|
+
:'planned_payment_date' => :'PlannedPaymentDate',
|
167
|
+
:'cis_deduction' => :'CISDeduction',
|
168
|
+
:'sub_total' => :'SubTotal',
|
169
|
+
:'total_tax' => :'TotalTax',
|
170
|
+
:'total' => :'Total',
|
171
|
+
:'total_discount' => :'TotalDiscount',
|
172
|
+
:'invoice_id' => :'InvoiceID',
|
173
|
+
:'has_attachments' => :'HasAttachments',
|
174
|
+
:'is_discounted' => :'IsDiscounted',
|
175
|
+
:'payments' => :'Payments',
|
176
|
+
:'prepayments' => :'Prepayments',
|
177
|
+
:'overpayments' => :'Overpayments',
|
178
|
+
:'amount_due' => :'AmountDue',
|
179
|
+
:'amount_paid' => :'AmountPaid',
|
180
|
+
:'fully_paid_on_date' => :'FullyPaidOnDate',
|
181
|
+
:'amount_credited' => :'AmountCredited',
|
182
|
+
:'updated_date_utc' => :'UpdatedDateUTC',
|
183
|
+
:'credit_notes' => :'CreditNotes',
|
184
|
+
:'attachments' => :'Attachments',
|
185
|
+
:'has_errors' => :'HasErrors',
|
186
|
+
:'status_attribute_string' => :'StatusAttributeString',
|
187
|
+
:'validation_errors' => :'ValidationErrors'
|
188
|
+
}
|
189
|
+
end
|
190
|
+
|
191
|
+
# Attribute type mapping.
|
192
|
+
def self.openapi_types
|
193
|
+
{
|
194
|
+
:'type' => :'String',
|
195
|
+
:'contact' => :'Contact',
|
196
|
+
:'line_items' => :'Array<LineItem>',
|
197
|
+
:'date' => :'Date',
|
198
|
+
:'due_date' => :'Date',
|
199
|
+
:'line_amount_types' => :'LineAmountTypes',
|
200
|
+
:'invoice_number' => :'String',
|
201
|
+
:'reference' => :'String',
|
202
|
+
:'branding_theme_id' => :'String',
|
203
|
+
:'url' => :'String',
|
204
|
+
:'currency_code' => :'CurrencyCode',
|
205
|
+
:'currency_rate' => :'Float',
|
206
|
+
:'status' => :'String',
|
207
|
+
:'sent_to_contact' => :'Boolean',
|
208
|
+
:'expected_payment_date' => :'Date',
|
209
|
+
:'planned_payment_date' => :'Date',
|
210
|
+
:'cis_deduction' => :'Float',
|
211
|
+
:'sub_total' => :'Float',
|
212
|
+
:'total_tax' => :'Float',
|
213
|
+
:'total' => :'Float',
|
214
|
+
:'total_discount' => :'Float',
|
215
|
+
:'invoice_id' => :'String',
|
216
|
+
:'has_attachments' => :'Boolean',
|
217
|
+
:'is_discounted' => :'Boolean',
|
218
|
+
:'payments' => :'Array<Payment>',
|
219
|
+
:'prepayments' => :'Array<Prepayment>',
|
220
|
+
:'overpayments' => :'Array<Overpayment>',
|
221
|
+
:'amount_due' => :'Float',
|
222
|
+
:'amount_paid' => :'Float',
|
223
|
+
:'fully_paid_on_date' => :'Date',
|
224
|
+
:'amount_credited' => :'Float',
|
225
|
+
:'updated_date_utc' => :'DateTime',
|
226
|
+
:'credit_notes' => :'Array<CreditNote>',
|
227
|
+
:'attachments' => :'Array<Attachment>',
|
228
|
+
:'has_errors' => :'Boolean',
|
229
|
+
:'status_attribute_string' => :'String',
|
230
|
+
:'validation_errors' => :'Array<ValidationError>'
|
231
|
+
}
|
232
|
+
end
|
233
|
+
|
234
|
+
# Initializes the object
|
235
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
236
|
+
def initialize(attributes = {})
|
237
|
+
if (!attributes.is_a?(Hash))
|
238
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Invoice` initialize method"
|
239
|
+
end
|
240
|
+
|
241
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
242
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
243
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
244
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
245
|
+
end
|
246
|
+
h[k.to_sym] = v
|
247
|
+
}
|
248
|
+
|
249
|
+
if attributes.key?(:'type')
|
250
|
+
self.type = attributes[:'type']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.key?(:'contact')
|
254
|
+
self.contact = attributes[:'contact']
|
255
|
+
end
|
256
|
+
|
257
|
+
if attributes.key?(:'line_items')
|
258
|
+
if (value = attributes[:'line_items']).is_a?(Array)
|
259
|
+
self.line_items = value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.key?(:'date')
|
264
|
+
self.date = attributes[:'date']
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.key?(:'due_date')
|
268
|
+
self.due_date = attributes[:'due_date']
|
269
|
+
end
|
270
|
+
|
271
|
+
if attributes.key?(:'line_amount_types')
|
272
|
+
self.line_amount_types = attributes[:'line_amount_types']
|
273
|
+
end
|
274
|
+
|
275
|
+
if attributes.key?(:'invoice_number')
|
276
|
+
self.invoice_number = attributes[:'invoice_number']
|
277
|
+
end
|
278
|
+
|
279
|
+
if attributes.key?(:'reference')
|
280
|
+
self.reference = attributes[:'reference']
|
281
|
+
end
|
282
|
+
|
283
|
+
if attributes.key?(:'branding_theme_id')
|
284
|
+
self.branding_theme_id = attributes[:'branding_theme_id']
|
285
|
+
end
|
286
|
+
|
287
|
+
if attributes.key?(:'url')
|
288
|
+
self.url = attributes[:'url']
|
289
|
+
end
|
290
|
+
|
291
|
+
if attributes.key?(:'currency_code')
|
292
|
+
self.currency_code = attributes[:'currency_code']
|
293
|
+
end
|
294
|
+
|
295
|
+
if attributes.key?(:'currency_rate')
|
296
|
+
self.currency_rate = attributes[:'currency_rate']
|
297
|
+
end
|
298
|
+
|
299
|
+
if attributes.key?(:'status')
|
300
|
+
self.status = attributes[:'status']
|
301
|
+
end
|
302
|
+
|
303
|
+
if attributes.key?(:'sent_to_contact')
|
304
|
+
self.sent_to_contact = attributes[:'sent_to_contact']
|
305
|
+
end
|
306
|
+
|
307
|
+
if attributes.key?(:'expected_payment_date')
|
308
|
+
self.expected_payment_date = attributes[:'expected_payment_date']
|
309
|
+
end
|
310
|
+
|
311
|
+
if attributes.key?(:'planned_payment_date')
|
312
|
+
self.planned_payment_date = attributes[:'planned_payment_date']
|
313
|
+
end
|
314
|
+
|
315
|
+
if attributes.key?(:'cis_deduction')
|
316
|
+
self.cis_deduction = attributes[:'cis_deduction']
|
317
|
+
end
|
318
|
+
|
319
|
+
if attributes.key?(:'sub_total')
|
320
|
+
self.sub_total = attributes[:'sub_total']
|
321
|
+
end
|
322
|
+
|
323
|
+
if attributes.key?(:'total_tax')
|
324
|
+
self.total_tax = attributes[:'total_tax']
|
325
|
+
end
|
326
|
+
|
327
|
+
if attributes.key?(:'total')
|
328
|
+
self.total = attributes[:'total']
|
329
|
+
end
|
330
|
+
|
331
|
+
if attributes.key?(:'total_discount')
|
332
|
+
self.total_discount = attributes[:'total_discount']
|
333
|
+
end
|
334
|
+
|
335
|
+
if attributes.key?(:'invoice_id')
|
336
|
+
self.invoice_id = attributes[:'invoice_id']
|
337
|
+
end
|
338
|
+
|
339
|
+
if attributes.key?(:'has_attachments')
|
340
|
+
self.has_attachments = attributes[:'has_attachments']
|
341
|
+
end
|
342
|
+
|
343
|
+
if attributes.key?(:'is_discounted')
|
344
|
+
self.is_discounted = attributes[:'is_discounted']
|
345
|
+
end
|
346
|
+
|
347
|
+
if attributes.key?(:'payments')
|
348
|
+
if (value = attributes[:'payments']).is_a?(Array)
|
349
|
+
self.payments = value
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
if attributes.key?(:'prepayments')
|
354
|
+
if (value = attributes[:'prepayments']).is_a?(Array)
|
355
|
+
self.prepayments = value
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
if attributes.key?(:'overpayments')
|
360
|
+
if (value = attributes[:'overpayments']).is_a?(Array)
|
361
|
+
self.overpayments = value
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
if attributes.key?(:'amount_due')
|
366
|
+
self.amount_due = attributes[:'amount_due']
|
367
|
+
end
|
368
|
+
|
369
|
+
if attributes.key?(:'amount_paid')
|
370
|
+
self.amount_paid = attributes[:'amount_paid']
|
371
|
+
end
|
372
|
+
|
373
|
+
if attributes.key?(:'fully_paid_on_date')
|
374
|
+
self.fully_paid_on_date = attributes[:'fully_paid_on_date']
|
375
|
+
end
|
376
|
+
|
377
|
+
if attributes.key?(:'amount_credited')
|
378
|
+
self.amount_credited = attributes[:'amount_credited']
|
379
|
+
end
|
380
|
+
|
381
|
+
if attributes.key?(:'updated_date_utc')
|
382
|
+
self.updated_date_utc = attributes[:'updated_date_utc']
|
383
|
+
end
|
384
|
+
|
385
|
+
if attributes.key?(:'credit_notes')
|
386
|
+
if (value = attributes[:'credit_notes']).is_a?(Array)
|
387
|
+
self.credit_notes = value
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
if attributes.key?(:'attachments')
|
392
|
+
if (value = attributes[:'attachments']).is_a?(Array)
|
393
|
+
self.attachments = value
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
if attributes.key?(:'has_errors')
|
398
|
+
self.has_errors = attributes[:'has_errors']
|
399
|
+
end
|
400
|
+
|
401
|
+
if attributes.key?(:'status_attribute_string')
|
402
|
+
self.status_attribute_string = attributes[:'status_attribute_string']
|
403
|
+
end
|
404
|
+
|
405
|
+
if attributes.key?(:'validation_errors')
|
406
|
+
if (value = attributes[:'validation_errors']).is_a?(Array)
|
407
|
+
self.validation_errors = value
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
413
|
+
# @return Array for valid properties with the reasons
|
414
|
+
def list_invalid_properties
|
415
|
+
invalid_properties = Array.new
|
416
|
+
if @type.nil?
|
417
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
418
|
+
end
|
419
|
+
|
420
|
+
if @contact.nil?
|
421
|
+
invalid_properties.push('invalid value for "contact", contact cannot be nil.')
|
422
|
+
end
|
423
|
+
|
424
|
+
if @line_items.nil?
|
425
|
+
invalid_properties.push('invalid value for "line_items", line_items cannot be nil.')
|
426
|
+
end
|
427
|
+
|
428
|
+
if !@invoice_number.nil? && @invoice_number.to_s.length > 255
|
429
|
+
invalid_properties.push('invalid value for "invoice_number", the character length must be smaller than or equal to 255.')
|
430
|
+
end
|
431
|
+
|
432
|
+
if !@reference.nil? && @reference.to_s.length > 255
|
433
|
+
invalid_properties.push('invalid value for "reference", the character length must be smaller than or equal to 255.')
|
434
|
+
end
|
435
|
+
|
436
|
+
invalid_properties
|
437
|
+
end
|
438
|
+
|
439
|
+
# Check to see if the all the properties in the model are valid
|
440
|
+
# @return true if the model is valid
|
441
|
+
def valid?
|
442
|
+
return false if @type.nil?
|
443
|
+
type_validator = EnumAttributeValidator.new('String', ["ACCREC", "ACCPAY", "ACCPAYCREDIT", "AROVERPAYMENT"])
|
444
|
+
return false unless type_validator.valid?(@type)
|
445
|
+
return false if @contact.nil?
|
446
|
+
return false if @line_items.nil?
|
447
|
+
return false if !@invoice_number.nil? && @invoice_number.to_s.length > 255
|
448
|
+
return false if !@reference.nil? && @reference.to_s.length > 255
|
449
|
+
status_validator = EnumAttributeValidator.new('String', ["DRAFT", "SUBMITTED", "DELETED", "AUTHORISED", "PAID", "VOIDED"])
|
450
|
+
return false unless status_validator.valid?(@status)
|
451
|
+
true
|
452
|
+
end
|
453
|
+
|
454
|
+
# Custom attribute writer method checking allowed values (enum).
|
455
|
+
# @param [Object] type Object to be assigned
|
456
|
+
def type=(type)
|
457
|
+
validator = EnumAttributeValidator.new('String', ["ACCREC", "ACCPAY", "ACCPAYCREDIT", "AROVERPAYMENT"])
|
458
|
+
unless validator.valid?(type)
|
459
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
460
|
+
end
|
461
|
+
@type = type
|
462
|
+
end
|
463
|
+
|
464
|
+
# Custom attribute writer method with validation
|
465
|
+
# @param [Object] invoice_number Value to be assigned
|
466
|
+
def invoice_number=(invoice_number)
|
467
|
+
if !invoice_number.nil? && invoice_number.to_s.length > 255
|
468
|
+
fail ArgumentError, 'invalid value for "invoice_number", the character length must be smaller than or equal to 255.'
|
469
|
+
end
|
470
|
+
|
471
|
+
@invoice_number = invoice_number
|
472
|
+
end
|
473
|
+
|
474
|
+
# Custom attribute writer method with validation
|
475
|
+
# @param [Object] reference Value to be assigned
|
476
|
+
def reference=(reference)
|
477
|
+
if !reference.nil? && reference.to_s.length > 255
|
478
|
+
fail ArgumentError, 'invalid value for "reference", the character length must be smaller than or equal to 255.'
|
479
|
+
end
|
480
|
+
|
481
|
+
@reference = reference
|
482
|
+
end
|
483
|
+
|
484
|
+
# Custom attribute writer method checking allowed values (enum).
|
485
|
+
# @param [Object] status Object to be assigned
|
486
|
+
def status=(status)
|
487
|
+
validator = EnumAttributeValidator.new('String', ["DRAFT", "SUBMITTED", "DELETED", "AUTHORISED", "PAID", "VOIDED"])
|
488
|
+
unless validator.valid?(status)
|
489
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
490
|
+
end
|
491
|
+
@status = status
|
492
|
+
end
|
493
|
+
|
494
|
+
# Checks equality by comparing each attribute.
|
495
|
+
# @param [Object] Object to be compared
|
496
|
+
def ==(o)
|
497
|
+
return true if self.equal?(o)
|
498
|
+
self.class == o.class &&
|
499
|
+
type == o.type &&
|
500
|
+
contact == o.contact &&
|
501
|
+
line_items == o.line_items &&
|
502
|
+
date == o.date &&
|
503
|
+
due_date == o.due_date &&
|
504
|
+
line_amount_types == o.line_amount_types &&
|
505
|
+
invoice_number == o.invoice_number &&
|
506
|
+
reference == o.reference &&
|
507
|
+
branding_theme_id == o.branding_theme_id &&
|
508
|
+
url == o.url &&
|
509
|
+
currency_code == o.currency_code &&
|
510
|
+
currency_rate == o.currency_rate &&
|
511
|
+
status == o.status &&
|
512
|
+
sent_to_contact == o.sent_to_contact &&
|
513
|
+
expected_payment_date == o.expected_payment_date &&
|
514
|
+
planned_payment_date == o.planned_payment_date &&
|
515
|
+
cis_deduction == o.cis_deduction &&
|
516
|
+
sub_total == o.sub_total &&
|
517
|
+
total_tax == o.total_tax &&
|
518
|
+
total == o.total &&
|
519
|
+
total_discount == o.total_discount &&
|
520
|
+
invoice_id == o.invoice_id &&
|
521
|
+
has_attachments == o.has_attachments &&
|
522
|
+
is_discounted == o.is_discounted &&
|
523
|
+
payments == o.payments &&
|
524
|
+
prepayments == o.prepayments &&
|
525
|
+
overpayments == o.overpayments &&
|
526
|
+
amount_due == o.amount_due &&
|
527
|
+
amount_paid == o.amount_paid &&
|
528
|
+
fully_paid_on_date == o.fully_paid_on_date &&
|
529
|
+
amount_credited == o.amount_credited &&
|
530
|
+
updated_date_utc == o.updated_date_utc &&
|
531
|
+
credit_notes == o.credit_notes &&
|
532
|
+
attachments == o.attachments &&
|
533
|
+
has_errors == o.has_errors &&
|
534
|
+
status_attribute_string == o.status_attribute_string &&
|
535
|
+
validation_errors == o.validation_errors
|
536
|
+
end
|
537
|
+
|
538
|
+
# @see the `==` method
|
539
|
+
# @param [Object] Object to be compared
|
540
|
+
def eql?(o)
|
541
|
+
self == o
|
542
|
+
end
|
543
|
+
|
544
|
+
# Calculates hash code according to all attributes.
|
545
|
+
# @return [Integer] Hash code
|
546
|
+
def hash
|
547
|
+
[type, contact, line_items, date, due_date, line_amount_types, invoice_number, reference, branding_theme_id, url, currency_code, currency_rate, status, sent_to_contact, expected_payment_date, planned_payment_date, cis_deduction, sub_total, total_tax, total, total_discount, invoice_id, has_attachments, is_discounted, payments, prepayments, overpayments, amount_due, amount_paid, fully_paid_on_date, amount_credited, updated_date_utc, credit_notes, attachments, has_errors, status_attribute_string, validation_errors].hash
|
548
|
+
end
|
549
|
+
|
550
|
+
# Builds the object from hash
|
551
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
552
|
+
# @return [Object] Returns the model itself
|
553
|
+
def self.build_from_hash(attributes)
|
554
|
+
new.build_from_hash(attributes)
|
555
|
+
end
|
556
|
+
|
557
|
+
# Builds the object from hash
|
558
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
559
|
+
# @return [Object] Returns the model itself
|
560
|
+
def build_from_hash(attributes)
|
561
|
+
return nil unless attributes.is_a?(Hash)
|
562
|
+
self.class.openapi_types.each_pair do |key, type|
|
563
|
+
if type =~ /\AArray<(.*)>/i
|
564
|
+
# check to ensure the input is an array given that the attribute
|
565
|
+
# is documented as an array but the input is not
|
566
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
567
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
568
|
+
end
|
569
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
570
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
571
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
572
|
+
end
|
573
|
+
|
574
|
+
self
|
575
|
+
end
|
576
|
+
|
577
|
+
# Deserializes the data based on type
|
578
|
+
# @param string type Data type
|
579
|
+
# @param string value Value to be deserialized
|
580
|
+
# @return [Object] Deserialized data
|
581
|
+
def _deserialize(type, value)
|
582
|
+
case type.to_sym
|
583
|
+
when :DateTime
|
584
|
+
DateTime.parse(parse_date(value))
|
585
|
+
when :Date
|
586
|
+
Date._iso8601(parse_date(value))
|
587
|
+
when :String
|
588
|
+
value.to_s
|
589
|
+
when :Integer
|
590
|
+
value.to_i
|
591
|
+
when :Float
|
592
|
+
value.to_f
|
593
|
+
when :Boolean
|
594
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
595
|
+
true
|
596
|
+
else
|
597
|
+
false
|
598
|
+
end
|
599
|
+
when :Object
|
600
|
+
# generic object (usually a Hash), return directly
|
601
|
+
value
|
602
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
603
|
+
inner_type = Regexp.last_match[:inner_type]
|
604
|
+
value.map { |v| _deserialize(inner_type, v) }
|
605
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
606
|
+
k_type = Regexp.last_match[:k_type]
|
607
|
+
v_type = Regexp.last_match[:v_type]
|
608
|
+
{}.tap do |hash|
|
609
|
+
value.each do |k, v|
|
610
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
611
|
+
end
|
612
|
+
end
|
613
|
+
else # model
|
614
|
+
XeroRuby.const_get(type).build_from_hash(value)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# Returns the string representation of the object
|
619
|
+
# @return [String] String presentation of the object
|
620
|
+
def to_s
|
621
|
+
to_hash.to_s
|
622
|
+
end
|
623
|
+
|
624
|
+
# to_body is an alias to to_hash (backward compatibility)
|
625
|
+
# @return [Hash] Returns the object in the form of hash
|
626
|
+
def to_body
|
627
|
+
to_hash
|
628
|
+
end
|
629
|
+
|
630
|
+
# Returns the object in the form of hash
|
631
|
+
# @return [Hash] Returns the object in the form of hash
|
632
|
+
def to_hash
|
633
|
+
hash = {}
|
634
|
+
self.class.attribute_map.each_pair do |attr, param|
|
635
|
+
value = self.send(attr)
|
636
|
+
next if value.nil?
|
637
|
+
hash[param] = _to_hash(value)
|
638
|
+
end
|
639
|
+
hash
|
640
|
+
end
|
641
|
+
|
642
|
+
# Outputs non-array value in the form of hash
|
643
|
+
# For object, use to_hash. Otherwise, just return the value
|
644
|
+
# @param [Object] value Any valid value
|
645
|
+
# @return [Hash] Returns the value in the form of hash
|
646
|
+
def _to_hash(value)
|
647
|
+
if value.is_a?(Array)
|
648
|
+
value.compact.map { |v| _to_hash(v) }
|
649
|
+
elsif value.is_a?(Hash)
|
650
|
+
{}.tap do |hash|
|
651
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
652
|
+
end
|
653
|
+
elsif value.respond_to? :to_hash
|
654
|
+
value.to_hash
|
655
|
+
else
|
656
|
+
value
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
# customized data_parser
|
661
|
+
def parse_date(datestring)
|
662
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
663
|
+
return Time.at(seconds_since_epoch).to_s
|
664
|
+
end
|
665
|
+
end
|
666
|
+
end
|