xero-apimatic-sdk 1.0.0
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/LICENSE +28 -0
- data/README.md +175 -0
- data/bin/console +15 -0
- data/lib/xero_ap_is/api_helper.rb +10 -0
- data/lib/xero_ap_is/apis/accounting_api.rb +8328 -0
- data/lib/xero_ap_is/apis/asset_api.rb +210 -0
- data/lib/xero_ap_is/apis/bank_feeds_api.rb +268 -0
- data/lib/xero_ap_is/apis/base_api.rb +67 -0
- data/lib/xero_ap_is/apis/identity_api.rb +51 -0
- data/lib/xero_ap_is/apis/oauth_authorization_api.rb +87 -0
- data/lib/xero_ap_is/apis/project_api.rb +662 -0
- data/lib/xero_ap_is/client.rb +110 -0
- data/lib/xero_ap_is/configuration.rb +196 -0
- data/lib/xero_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/xero_ap_is/exceptions/asset_types400_error_exception.rb +72 -0
- data/lib/xero_ap_is/exceptions/assets400_error_exception.rb +72 -0
- data/lib/xero_ap_is/exceptions/error_error1_exception.rb +63 -0
- data/lib/xero_ap_is/exceptions/error_error2_exception.rb +51 -0
- data/lib/xero_ap_is/exceptions/error_exception.rb +72 -0
- data/lib/xero_ap_is/exceptions/feed_connections_error_exception.rb +60 -0
- data/lib/xero_ap_is/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/xero_ap_is/exceptions/statements_error_exception.rb +60 -0
- data/lib/xero_ap_is/http/api_response.rb +19 -0
- data/lib/xero_ap_is/http/auth/basic_auth.rb +62 -0
- data/lib/xero_ap_is/http/auth/oauth_2.rb +161 -0
- data/lib/xero_ap_is/http/http_call_back.rb +10 -0
- data/lib/xero_ap_is/http/http_method_enum.rb +10 -0
- data/lib/xero_ap_is/http/http_request.rb +10 -0
- data/lib/xero_ap_is/http/http_response.rb +10 -0
- data/lib/xero_ap_is/http/proxy_settings.rb +22 -0
- data/lib/xero_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/xero_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/xero_ap_is/models/access_token.rb +116 -0
- data/lib/xero_ap_is/models/account.rb +300 -0
- data/lib/xero_ap_is/models/account_type.rb +100 -0
- data/lib/xero_ap_is/models/account_type1.rb +37 -0
- data/lib/xero_ap_is/models/accounts.rb +84 -0
- data/lib/xero_ap_is/models/accounts_payable.rb +85 -0
- data/lib/xero_ap_is/models/accounts_receivable.rb +85 -0
- data/lib/xero_ap_is/models/action.rb +85 -0
- data/lib/xero_ap_is/models/actions.rb +84 -0
- data/lib/xero_ap_is/models/address.rb +167 -0
- data/lib/xero_ap_is/models/address_for_organisation.rb +167 -0
- data/lib/xero_ap_is/models/address_type.rb +40 -0
- data/lib/xero_ap_is/models/address_type1.rb +36 -0
- data/lib/xero_ap_is/models/allocation.rb +174 -0
- data/lib/xero_ap_is/models/allocations.rb +85 -0
- data/lib/xero_ap_is/models/amount.rb +85 -0
- data/lib/xero_ap_is/models/asset.rb +249 -0
- data/lib/xero_ap_is/models/asset_status.rb +40 -0
- data/lib/xero_ap_is/models/asset_status_query_param.rb +40 -0
- data/lib/xero_ap_is/models/asset_type.rb +154 -0
- data/lib/xero_ap_is/models/assets.rb +94 -0
- data/lib/xero_ap_is/models/attachment.rb +126 -0
- data/lib/xero_ap_is/models/attachments.rb +85 -0
- data/lib/xero_ap_is/models/averaging_method.rb +36 -0
- data/lib/xero_ap_is/models/balance_details.rb +98 -0
- data/lib/xero_ap_is/models/balances.rb +89 -0
- data/lib/xero_ap_is/models/bank_account_type.rb +44 -0
- data/lib/xero_ap_is/models/bank_transaction.rb +319 -0
- data/lib/xero_ap_is/models/bank_transactions.rb +114 -0
- data/lib/xero_ap_is/models/bank_transfer.rb +224 -0
- data/lib/xero_ap_is/models/bank_transfers.rb +85 -0
- data/lib/xero_ap_is/models/base_model.rb +110 -0
- data/lib/xero_ap_is/models/batch_payment.rb +275 -0
- data/lib/xero_ap_is/models/batch_payment_delete.rb +84 -0
- data/lib/xero_ap_is/models/batch_payment_delete_by_url_param.rb +73 -0
- data/lib/xero_ap_is/models/batch_payment_details.rb +128 -0
- data/lib/xero_ap_is/models/batch_payments.rb +85 -0
- data/lib/xero_ap_is/models/bill.rb +85 -0
- data/lib/xero_ap_is/models/book_depreciation_detail.rb +243 -0
- data/lib/xero_ap_is/models/book_depreciation_setting.rb +170 -0
- data/lib/xero_ap_is/models/branding_theme.rb +129 -0
- data/lib/xero_ap_is/models/branding_themes.rb +85 -0
- data/lib/xero_ap_is/models/budget.rb +145 -0
- data/lib/xero_ap_is/models/budget_balance.rb +105 -0
- data/lib/xero_ap_is/models/budget_line.rb +105 -0
- data/lib/xero_ap_is/models/budgets.rb +84 -0
- data/lib/xero_ap_is/models/charge_type.rb +42 -0
- data/lib/xero_ap_is/models/cis_org_setting.rb +105 -0
- data/lib/xero_ap_is/models/cis_org_settings.rb +85 -0
- data/lib/xero_ap_is/models/cis_setting.rb +86 -0
- data/lib/xero_ap_is/models/cis_settings.rb +85 -0
- data/lib/xero_ap_is/models/class1.rb +113 -0
- data/lib/xero_ap_is/models/connection.rb +155 -0
- data/lib/xero_ap_is/models/contact.rb +661 -0
- data/lib/xero_ap_is/models/contact_group.rb +119 -0
- data/lib/xero_ap_is/models/contact_groups.rb +85 -0
- data/lib/xero_ap_is/models/contact_person.rb +108 -0
- data/lib/xero_ap_is/models/contact_status.rb +40 -0
- data/lib/xero_ap_is/models/contacts.rb +113 -0
- data/lib/xero_ap_is/models/conversion_balances.rb +108 -0
- data/lib/xero_ap_is/models/conversion_date.rb +87 -0
- data/lib/xero_ap_is/models/country_code.rb +990 -0
- data/lib/xero_ap_is/models/credit_debit_indicator.rb +37 -0
- data/lib/xero_ap_is/models/credit_note.rb +453 -0
- data/lib/xero_ap_is/models/credit_notes.rb +113 -0
- data/lib/xero_ap_is/models/currencies.rb +85 -0
- data/lib/xero_ap_is/models/currency.rb +85 -0
- data/lib/xero_ap_is/models/currency_code.rb +700 -0
- data/lib/xero_ap_is/models/currency_code1.rb +680 -0
- data/lib/xero_ap_is/models/depreciation_calculation_method.rb +40 -0
- data/lib/xero_ap_is/models/depreciation_method.rb +52 -0
- data/lib/xero_ap_is/models/due_date_type.rb +52 -0
- data/lib/xero_ap_is/models/edition.rb +38 -0
- data/lib/xero_ap_is/models/element.rb +160 -0
- data/lib/xero_ap_is/models/employee.rb +160 -0
- data/lib/xero_ap_is/models/employees.rb +85 -0
- data/lib/xero_ap_is/models/end_balance.rb +89 -0
- data/lib/xero_ap_is/models/error1.rb +138 -0
- data/lib/xero_ap_is/models/error2.rb +106 -0
- data/lib/xero_ap_is/models/error3.rb +85 -0
- data/lib/xero_ap_is/models/expense_claim.rb +209 -0
- data/lib/xero_ap_is/models/expense_claims.rb +85 -0
- data/lib/xero_ap_is/models/external_link.rb +95 -0
- data/lib/xero_ap_is/models/federal_tax_classification.rb +56 -0
- data/lib/xero_ap_is/models/feed_connection.rb +177 -0
- data/lib/xero_ap_is/models/feed_connections.rb +94 -0
- data/lib/xero_ap_is/models/field_validation_errors_element.rb +127 -0
- data/lib/xero_ap_is/models/history_record.rb +105 -0
- data/lib/xero_ap_is/models/history_records.rb +85 -0
- data/lib/xero_ap_is/models/import_summary.rb +87 -0
- data/lib/xero_ap_is/models/import_summary_accounts.rb +154 -0
- data/lib/xero_ap_is/models/import_summary_object.rb +76 -0
- data/lib/xero_ap_is/models/import_summary_organisation.rb +75 -0
- data/lib/xero_ap_is/models/invoice.rb +586 -0
- data/lib/xero_ap_is/models/invoice_address.rb +158 -0
- data/lib/xero_ap_is/models/invoice_address_type.rb +37 -0
- data/lib/xero_ap_is/models/invoice_reminder.rb +75 -0
- data/lib/xero_ap_is/models/invoice_reminders.rb +85 -0
- data/lib/xero_ap_is/models/invoices.rb +113 -0
- data/lib/xero_ap_is/models/item.rb +259 -0
- data/lib/xero_ap_is/models/items.rb +84 -0
- data/lib/xero_ap_is/models/journal.rb +157 -0
- data/lib/xero_ap_is/models/journal_line.rb +201 -0
- data/lib/xero_ap_is/models/journals.rb +103 -0
- data/lib/xero_ap_is/models/line_amount_types.rb +41 -0
- data/lib/xero_ap_is/models/line_item.rb +287 -0
- data/lib/xero_ap_is/models/line_item_item.rb +95 -0
- data/lib/xero_ap_is/models/line_item_tracking.rb +108 -0
- data/lib/xero_ap_is/models/link_type.rb +48 -0
- data/lib/xero_ap_is/models/linked_transaction.rb +215 -0
- data/lib/xero_ap_is/models/linked_transactions.rb +85 -0
- data/lib/xero_ap_is/models/manual_journal.rb +255 -0
- data/lib/xero_ap_is/models/manual_journal_line.rb +156 -0
- data/lib/xero_ap_is/models/manual_journals.rb +114 -0
- data/lib/xero_ap_is/models/mclass.rb +48 -0
- data/lib/xero_ap_is/models/oauth_provider_error.rb +62 -0
- data/lib/xero_ap_is/models/oauth_scope_oauth_2.rb +113 -0
- data/lib/xero_ap_is/models/oauth_token.rb +96 -0
- data/lib/xero_ap_is/models/online_invoice.rb +77 -0
- data/lib/xero_ap_is/models/online_invoices.rb +85 -0
- data/lib/xero_ap_is/models/order_by.rb +56 -0
- data/lib/xero_ap_is/models/organisation.rb +467 -0
- data/lib/xero_ap_is/models/organisation_entity_type.rb +80 -0
- data/lib/xero_ap_is/models/organisation_role.rb +61 -0
- data/lib/xero_ap_is/models/organisation_type.rb +80 -0
- data/lib/xero_ap_is/models/organisations.rb +85 -0
- data/lib/xero_ap_is/models/overpayment.rb +309 -0
- data/lib/xero_ap_is/models/overpayments.rb +113 -0
- data/lib/xero_ap_is/models/pagination.rb +105 -0
- data/lib/xero_ap_is/models/payment.rb +381 -0
- data/lib/xero_ap_is/models/payment_delete.rb +73 -0
- data/lib/xero_ap_is/models/payment_service.rb +143 -0
- data/lib/xero_ap_is/models/payment_services.rb +85 -0
- data/lib/xero_ap_is/models/payment_term.rb +85 -0
- data/lib/xero_ap_is/models/payment_term_type.rb +44 -0
- data/lib/xero_ap_is/models/payment_type.rb +60 -0
- data/lib/xero_ap_is/models/payments.rb +113 -0
- data/lib/xero_ap_is/models/phone.rb +108 -0
- data/lib/xero_ap_is/models/phone_type.rb +48 -0
- data/lib/xero_ap_is/models/prepayment.rb +309 -0
- data/lib/xero_ap_is/models/prepayments.rb +113 -0
- data/lib/xero_ap_is/models/project.rb +328 -0
- data/lib/xero_ap_is/models/project_create_or_update.rb +115 -0
- data/lib/xero_ap_is/models/project_patch.rb +73 -0
- data/lib/xero_ap_is/models/project_status.rb +36 -0
- data/lib/xero_ap_is/models/project_user.rb +95 -0
- data/lib/xero_ap_is/models/project_users.rb +94 -0
- data/lib/xero_ap_is/models/projects.rb +94 -0
- data/lib/xero_ap_is/models/purchase.rb +112 -0
- data/lib/xero_ap_is/models/purchase_order.rb +408 -0
- data/lib/xero_ap_is/models/purchase_orders.rb +114 -0
- data/lib/xero_ap_is/models/purchases_default_line_amount_type.rb +42 -0
- data/lib/xero_ap_is/models/quote.rb +338 -0
- data/lib/xero_ap_is/models/quote_line_amount_types.rb +41 -0
- data/lib/xero_ap_is/models/quote_status_codes.rb +52 -0
- data/lib/xero_ap_is/models/quotes.rb +84 -0
- data/lib/xero_ap_is/models/receipt.rb +287 -0
- data/lib/xero_ap_is/models/receipts.rb +84 -0
- data/lib/xero_ap_is/models/refresh_token.rb +106 -0
- data/lib/xero_ap_is/models/repeating_invoice.rb +290 -0
- data/lib/xero_ap_is/models/repeating_invoices.rb +85 -0
- data/lib/xero_ap_is/models/report.rb +136 -0
- data/lib/xero_ap_is/models/report_attribute.rb +85 -0
- data/lib/xero_ap_is/models/report_cell.rb +94 -0
- data/lib/xero_ap_is/models/report_fields.rb +95 -0
- data/lib/xero_ap_is/models/report_row.rb +104 -0
- data/lib/xero_ap_is/models/report_rows.rb +123 -0
- data/lib/xero_ap_is/models/report_tax_type.rb +424 -0
- data/lib/xero_ap_is/models/report_type.rb +26 -0
- data/lib/xero_ap_is/models/report_with_row.rb +176 -0
- data/lib/xero_ap_is/models/report_with_rows.rb +84 -0
- data/lib/xero_ap_is/models/reports.rb +84 -0
- data/lib/xero_ap_is/models/request_empty.rb +75 -0
- data/lib/xero_ap_is/models/resource_validation_errors_element.rb +116 -0
- data/lib/xero_ap_is/models/row_type.rb +44 -0
- data/lib/xero_ap_is/models/sales_default_line_amount_type.rb +42 -0
- data/lib/xero_ap_is/models/sales_tax_basis.rb +60 -0
- data/lib/xero_ap_is/models/sales_tax_period.rb +88 -0
- data/lib/xero_ap_is/models/sales_tracking_category.rb +89 -0
- data/lib/xero_ap_is/models/schedule.rb +140 -0
- data/lib/xero_ap_is/models/setting.rb +175 -0
- data/lib/xero_ap_is/models/setup.rb +117 -0
- data/lib/xero_ap_is/models/sort_direction.rb +36 -0
- data/lib/xero_ap_is/models/source_transaction_type_code.rb +38 -0
- data/lib/xero_ap_is/models/source_type.rb +128 -0
- data/lib/xero_ap_is/models/start_balance.rb +88 -0
- data/lib/xero_ap_is/models/statement.rb +194 -0
- data/lib/xero_ap_is/models/statement_line.rb +162 -0
- data/lib/xero_ap_is/models/statements.rb +94 -0
- data/lib/xero_ap_is/models/status.rb +41 -0
- data/lib/xero_ap_is/models/status1.rb +38 -0
- data/lib/xero_ap_is/models/status10.rb +40 -0
- data/lib/xero_ap_is/models/status11.rb +44 -0
- data/lib/xero_ap_is/models/status110.rb +40 -0
- data/lib/xero_ap_is/models/status111.rb +43 -0
- data/lib/xero_ap_is/models/status12.rb +48 -0
- data/lib/xero_ap_is/models/status13.rb +48 -0
- data/lib/xero_ap_is/models/status14.rb +52 -0
- data/lib/xero_ap_is/models/status15.rb +48 -0
- data/lib/xero_ap_is/models/status16.rb +36 -0
- data/lib/xero_ap_is/models/status17.rb +48 -0
- data/lib/xero_ap_is/models/status18.rb +40 -0
- data/lib/xero_ap_is/models/status19.rb +44 -0
- data/lib/xero_ap_is/models/status2.rb +40 -0
- data/lib/xero_ap_is/models/status20.rb +48 -0
- data/lib/xero_ap_is/models/status21.rb +36 -0
- data/lib/xero_ap_is/models/status22.rb +44 -0
- data/lib/xero_ap_is/models/status3.rb +52 -0
- data/lib/xero_ap_is/models/status4.rb +40 -0
- data/lib/xero_ap_is/models/status5.rb +40 -0
- data/lib/xero_ap_is/models/status6.rb +52 -0
- data/lib/xero_ap_is/models/status7.rb +36 -0
- data/lib/xero_ap_is/models/status8.rb +37 -0
- data/lib/xero_ap_is/models/status9.rb +40 -0
- data/lib/xero_ap_is/models/system_account.rb +110 -0
- data/lib/xero_ap_is/models/task.rb +234 -0
- data/lib/xero_ap_is/models/task_create_or_update.rb +105 -0
- data/lib/xero_ap_is/models/tasks.rb +94 -0
- data/lib/xero_ap_is/models/tax_breakdown_component.rb +172 -0
- data/lib/xero_ap_is/models/tax_component.rb +108 -0
- data/lib/xero_ap_is/models/tax_number_type.rb +45 -0
- data/lib/xero_ap_is/models/tax_rate.rb +213 -0
- data/lib/xero_ap_is/models/tax_rates.rb +85 -0
- data/lib/xero_ap_is/models/tax_type.rb +520 -0
- data/lib/xero_ap_is/models/taxability.rb +48 -0
- data/lib/xero_ap_is/models/ten_ninety_nine_contact.rb +318 -0
- data/lib/xero_ap_is/models/time_entries.rb +94 -0
- data/lib/xero_ap_is/models/time_entry.rb +179 -0
- data/lib/xero_ap_is/models/time_entry_create_or_update.rb +120 -0
- data/lib/xero_ap_is/models/time_zone.rb +592 -0
- data/lib/xero_ap_is/models/timeframe.rb +40 -0
- data/lib/xero_ap_is/models/tracking_categories.rb +85 -0
- data/lib/xero_ap_is/models/tracking_category.rb +140 -0
- data/lib/xero_ap_is/models/tracking_option.rb +109 -0
- data/lib/xero_ap_is/models/tracking_options.rb +84 -0
- data/lib/xero_ap_is/models/type.rb +60 -0
- data/lib/xero_ap_is/models/type1.rb +26 -0
- data/lib/xero_ap_is/models/type10.rb +36 -0
- data/lib/xero_ap_is/models/type11.rb +114 -0
- data/lib/xero_ap_is/models/type2.rb +48 -0
- data/lib/xero_ap_is/models/type3.rb +60 -0
- data/lib/xero_ap_is/models/type4.rb +44 -0
- data/lib/xero_ap_is/models/type5.rb +40 -0
- data/lib/xero_ap_is/models/type6.rb +36 -0
- data/lib/xero_ap_is/models/type7.rb +37 -0
- data/lib/xero_ap_is/models/type8.rb +36 -0
- data/lib/xero_ap_is/models/type9.rb +26 -0
- data/lib/xero_ap_is/models/unit.rb +36 -0
- data/lib/xero_ap_is/models/user.rb +139 -0
- data/lib/xero_ap_is/models/users.rb +84 -0
- data/lib/xero_ap_is/models/validation_error.rb +75 -0
- data/lib/xero_ap_is/models/version.rb +68 -0
- data/lib/xero_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/xero_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/xero_ap_is.rb +309 -0
- metadata +372 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# xero_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module XeroApIs
|
|
7
|
+
# JournalLine Model.
|
|
8
|
+
class JournalLine < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Xero identifier for Journal
|
|
13
|
+
# @return [UUID | String]
|
|
14
|
+
attr_accessor :journal_line_id
|
|
15
|
+
|
|
16
|
+
# See Accounts
|
|
17
|
+
# @return [UUID | String]
|
|
18
|
+
attr_accessor :account_id
|
|
19
|
+
|
|
20
|
+
# See Accounts
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :account_code
|
|
23
|
+
|
|
24
|
+
# See Account Types
|
|
25
|
+
# @return [AccountType]
|
|
26
|
+
attr_accessor :account_type
|
|
27
|
+
|
|
28
|
+
# See AccountCodes
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :account_name
|
|
31
|
+
|
|
32
|
+
# The description from the source transaction line item. Only returned if
|
|
33
|
+
# populated.
|
|
34
|
+
# @return [String]
|
|
35
|
+
attr_accessor :description
|
|
36
|
+
|
|
37
|
+
# Net amount of journal line. This will be a positive value for a debit and
|
|
38
|
+
# negative for a credit
|
|
39
|
+
# @return [Float]
|
|
40
|
+
attr_accessor :net_amount
|
|
41
|
+
|
|
42
|
+
# Gross amount of journal line (NetAmount + TaxAmount).
|
|
43
|
+
# @return [Float]
|
|
44
|
+
attr_accessor :gross_amount
|
|
45
|
+
|
|
46
|
+
# Total tax on a journal line
|
|
47
|
+
# @return [Float]
|
|
48
|
+
attr_accessor :tax_amount
|
|
49
|
+
|
|
50
|
+
# The tax type from taxRates
|
|
51
|
+
# @return [String]
|
|
52
|
+
attr_accessor :tax_type
|
|
53
|
+
|
|
54
|
+
# see TaxRates
|
|
55
|
+
# @return [String]
|
|
56
|
+
attr_accessor :tax_name
|
|
57
|
+
|
|
58
|
+
# Optional Tracking Category – see Tracking. Any JournalLine can have a
|
|
59
|
+
# maximum of 2 <TrackingCategory> elements.
|
|
60
|
+
# @return [Array[TrackingCategory]]
|
|
61
|
+
attr_accessor :tracking_categories
|
|
62
|
+
|
|
63
|
+
# A mapping from model property names to API property names.
|
|
64
|
+
def self.names
|
|
65
|
+
@_hash = {} if @_hash.nil?
|
|
66
|
+
@_hash['journal_line_id'] = 'JournalLineID'
|
|
67
|
+
@_hash['account_id'] = 'AccountID'
|
|
68
|
+
@_hash['account_code'] = 'AccountCode'
|
|
69
|
+
@_hash['account_type'] = 'AccountType'
|
|
70
|
+
@_hash['account_name'] = 'AccountName'
|
|
71
|
+
@_hash['description'] = 'Description'
|
|
72
|
+
@_hash['net_amount'] = 'NetAmount'
|
|
73
|
+
@_hash['gross_amount'] = 'GrossAmount'
|
|
74
|
+
@_hash['tax_amount'] = 'TaxAmount'
|
|
75
|
+
@_hash['tax_type'] = 'TaxType'
|
|
76
|
+
@_hash['tax_name'] = 'TaxName'
|
|
77
|
+
@_hash['tracking_categories'] = 'TrackingCategories'
|
|
78
|
+
@_hash
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# An array for optional fields
|
|
82
|
+
def self.optionals
|
|
83
|
+
%w[
|
|
84
|
+
journal_line_id
|
|
85
|
+
account_id
|
|
86
|
+
account_code
|
|
87
|
+
account_type
|
|
88
|
+
account_name
|
|
89
|
+
description
|
|
90
|
+
net_amount
|
|
91
|
+
gross_amount
|
|
92
|
+
tax_amount
|
|
93
|
+
tax_type
|
|
94
|
+
tax_name
|
|
95
|
+
tracking_categories
|
|
96
|
+
]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# An array for nullable fields
|
|
100
|
+
def self.nullables
|
|
101
|
+
[]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def initialize(journal_line_id: SKIP, account_id: SKIP, account_code: SKIP,
|
|
105
|
+
account_type: SKIP, account_name: SKIP, description: SKIP,
|
|
106
|
+
net_amount: SKIP, gross_amount: SKIP, tax_amount: SKIP,
|
|
107
|
+
tax_type: SKIP, tax_name: SKIP, tracking_categories: SKIP,
|
|
108
|
+
additional_properties: nil)
|
|
109
|
+
# Add additional model properties to the instance
|
|
110
|
+
additional_properties = {} if additional_properties.nil?
|
|
111
|
+
|
|
112
|
+
@journal_line_id = journal_line_id unless journal_line_id == SKIP
|
|
113
|
+
@account_id = account_id unless account_id == SKIP
|
|
114
|
+
@account_code = account_code unless account_code == SKIP
|
|
115
|
+
@account_type = account_type unless account_type == SKIP
|
|
116
|
+
@account_name = account_name unless account_name == SKIP
|
|
117
|
+
@description = description unless description == SKIP
|
|
118
|
+
@net_amount = net_amount unless net_amount == SKIP
|
|
119
|
+
@gross_amount = gross_amount unless gross_amount == SKIP
|
|
120
|
+
@tax_amount = tax_amount unless tax_amount == SKIP
|
|
121
|
+
@tax_type = tax_type unless tax_type == SKIP
|
|
122
|
+
@tax_name = tax_name unless tax_name == SKIP
|
|
123
|
+
@tracking_categories = tracking_categories unless tracking_categories == SKIP
|
|
124
|
+
@additional_properties = additional_properties
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Creates an instance of the object from a hash.
|
|
128
|
+
def self.from_hash(hash)
|
|
129
|
+
return nil unless hash
|
|
130
|
+
|
|
131
|
+
# Extract variables from the hash.
|
|
132
|
+
journal_line_id =
|
|
133
|
+
hash.key?('JournalLineID') ? hash['JournalLineID'] : SKIP
|
|
134
|
+
account_id = hash.key?('AccountID') ? hash['AccountID'] : SKIP
|
|
135
|
+
account_code = hash.key?('AccountCode') ? hash['AccountCode'] : SKIP
|
|
136
|
+
account_type = hash.key?('AccountType') ? hash['AccountType'] : SKIP
|
|
137
|
+
account_name = hash.key?('AccountName') ? hash['AccountName'] : SKIP
|
|
138
|
+
description = hash.key?('Description') ? hash['Description'] : SKIP
|
|
139
|
+
net_amount = hash.key?('NetAmount') ? hash['NetAmount'] : SKIP
|
|
140
|
+
gross_amount = hash.key?('GrossAmount') ? hash['GrossAmount'] : SKIP
|
|
141
|
+
tax_amount = hash.key?('TaxAmount') ? hash['TaxAmount'] : SKIP
|
|
142
|
+
tax_type = hash.key?('TaxType') ? hash['TaxType'] : SKIP
|
|
143
|
+
tax_name = hash.key?('TaxName') ? hash['TaxName'] : SKIP
|
|
144
|
+
# Parameter is an array, so we need to iterate through it
|
|
145
|
+
tracking_categories = nil
|
|
146
|
+
unless hash['TrackingCategories'].nil?
|
|
147
|
+
tracking_categories = []
|
|
148
|
+
hash['TrackingCategories'].each do |structure|
|
|
149
|
+
tracking_categories << (TrackingCategory.from_hash(structure) if structure)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
tracking_categories = SKIP unless hash.key?('TrackingCategories')
|
|
154
|
+
|
|
155
|
+
# Create a new hash for additional properties, removing known properties.
|
|
156
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
157
|
+
|
|
158
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
159
|
+
new_hash, proc { |value| value }
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# Create object from extracted values.
|
|
163
|
+
JournalLine.new(journal_line_id: journal_line_id,
|
|
164
|
+
account_id: account_id,
|
|
165
|
+
account_code: account_code,
|
|
166
|
+
account_type: account_type,
|
|
167
|
+
account_name: account_name,
|
|
168
|
+
description: description,
|
|
169
|
+
net_amount: net_amount,
|
|
170
|
+
gross_amount: gross_amount,
|
|
171
|
+
tax_amount: tax_amount,
|
|
172
|
+
tax_type: tax_type,
|
|
173
|
+
tax_name: tax_name,
|
|
174
|
+
tracking_categories: tracking_categories,
|
|
175
|
+
additional_properties: additional_properties)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Provides a human-readable string representation of the object.
|
|
179
|
+
def to_s
|
|
180
|
+
class_name = self.class.name.split('::').last
|
|
181
|
+
"<#{class_name} journal_line_id: #{@journal_line_id}, account_id: #{@account_id},"\
|
|
182
|
+
" account_code: #{@account_code}, account_type: #{@account_type}, account_name:"\
|
|
183
|
+
" #{@account_name}, description: #{@description}, net_amount: #{@net_amount}, gross_amount:"\
|
|
184
|
+
" #{@gross_amount}, tax_amount: #{@tax_amount}, tax_type: #{@tax_type}, tax_name:"\
|
|
185
|
+
" #{@tax_name}, tracking_categories: #{@tracking_categories}, additional_properties:"\
|
|
186
|
+
" #{@additional_properties}>"
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
190
|
+
def inspect
|
|
191
|
+
class_name = self.class.name.split('::').last
|
|
192
|
+
"<#{class_name} journal_line_id: #{@journal_line_id.inspect}, account_id:"\
|
|
193
|
+
" #{@account_id.inspect}, account_code: #{@account_code.inspect}, account_type:"\
|
|
194
|
+
" #{@account_type.inspect}, account_name: #{@account_name.inspect}, description:"\
|
|
195
|
+
" #{@description.inspect}, net_amount: #{@net_amount.inspect}, gross_amount:"\
|
|
196
|
+
" #{@gross_amount.inspect}, tax_amount: #{@tax_amount.inspect}, tax_type:"\
|
|
197
|
+
" #{@tax_type.inspect}, tax_name: #{@tax_name.inspect}, tracking_categories:"\
|
|
198
|
+
" #{@tracking_categories.inspect}, additional_properties: #{@additional_properties}>"
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# xero_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module XeroApIs
|
|
7
|
+
# Journals Model.
|
|
8
|
+
class Journals < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Displays array of warning messages from the API
|
|
13
|
+
# @return [Array[ValidationError]]
|
|
14
|
+
attr_accessor :warnings
|
|
15
|
+
|
|
16
|
+
# Displays array of warning messages from the API
|
|
17
|
+
# @return [Array[Journal]]
|
|
18
|
+
attr_accessor :journals
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['warnings'] = 'Warnings'
|
|
24
|
+
@_hash['journals'] = 'Journals'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
warnings
|
|
32
|
+
journals
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(warnings: SKIP, journals: SKIP, additional_properties: nil)
|
|
42
|
+
# Add additional model properties to the instance
|
|
43
|
+
additional_properties = {} if additional_properties.nil?
|
|
44
|
+
|
|
45
|
+
@warnings = warnings unless warnings == SKIP
|
|
46
|
+
@journals = journals unless journals == SKIP
|
|
47
|
+
@additional_properties = additional_properties
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Creates an instance of the object from a hash.
|
|
51
|
+
def self.from_hash(hash)
|
|
52
|
+
return nil unless hash
|
|
53
|
+
|
|
54
|
+
# Extract variables from the hash.
|
|
55
|
+
# Parameter is an array, so we need to iterate through it
|
|
56
|
+
warnings = nil
|
|
57
|
+
unless hash['Warnings'].nil?
|
|
58
|
+
warnings = []
|
|
59
|
+
hash['Warnings'].each do |structure|
|
|
60
|
+
warnings << (ValidationError.from_hash(structure) if structure)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
warnings = SKIP unless hash.key?('Warnings')
|
|
65
|
+
# Parameter is an array, so we need to iterate through it
|
|
66
|
+
journals = nil
|
|
67
|
+
unless hash['Journals'].nil?
|
|
68
|
+
journals = []
|
|
69
|
+
hash['Journals'].each do |structure|
|
|
70
|
+
journals << (Journal.from_hash(structure) if structure)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
journals = SKIP unless hash.key?('Journals')
|
|
75
|
+
|
|
76
|
+
# Create a new hash for additional properties, removing known properties.
|
|
77
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
78
|
+
|
|
79
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
80
|
+
new_hash, proc { |value| value }
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Create object from extracted values.
|
|
84
|
+
Journals.new(warnings: warnings,
|
|
85
|
+
journals: journals,
|
|
86
|
+
additional_properties: additional_properties)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Provides a human-readable string representation of the object.
|
|
90
|
+
def to_s
|
|
91
|
+
class_name = self.class.name.split('::').last
|
|
92
|
+
"<#{class_name} warnings: #{@warnings}, journals: #{@journals}, additional_properties:"\
|
|
93
|
+
" #{@additional_properties}>"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
97
|
+
def inspect
|
|
98
|
+
class_name = self.class.name.split('::').last
|
|
99
|
+
"<#{class_name} warnings: #{@warnings.inspect}, journals: #{@journals.inspect},"\
|
|
100
|
+
" additional_properties: #{@additional_properties}>"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# xero_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module XeroApIs
|
|
7
|
+
# Line amounts are exclusive of tax by default if you don’t specify this
|
|
8
|
+
# element. See Line Amount Types
|
|
9
|
+
class LineAmountTypes
|
|
10
|
+
LINE_AMOUNT_TYPES = [
|
|
11
|
+
# TODO: Write general description for EXCLUSIVE
|
|
12
|
+
EXCLUSIVE = 'Exclusive'.freeze,
|
|
13
|
+
|
|
14
|
+
# TODO: Write general description for INCLUSIVE
|
|
15
|
+
INCLUSIVE = 'Inclusive'.freeze,
|
|
16
|
+
|
|
17
|
+
# TODO: Write general description for NOTAX
|
|
18
|
+
NOTAX = 'NoTax'.freeze
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
def self.validate(value)
|
|
22
|
+
return false if value.nil?
|
|
23
|
+
|
|
24
|
+
LINE_AMOUNT_TYPES.include?(value)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.from_value(value, default_value = EXCLUSIVE)
|
|
28
|
+
return default_value if value.nil?
|
|
29
|
+
|
|
30
|
+
str = value.to_s.strip
|
|
31
|
+
|
|
32
|
+
case str.downcase
|
|
33
|
+
when 'exclusive' then EXCLUSIVE
|
|
34
|
+
when 'inclusive' then INCLUSIVE
|
|
35
|
+
when 'notax' then NOTAX
|
|
36
|
+
else
|
|
37
|
+
default_value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# xero_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module XeroApIs
|
|
7
|
+
# LineItem Model.
|
|
8
|
+
class LineItem < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# LineItem unique ID
|
|
13
|
+
# @return [UUID | String]
|
|
14
|
+
attr_accessor :line_item_id
|
|
15
|
+
|
|
16
|
+
# Description needs to be at least 1 char long. A line item with just a
|
|
17
|
+
# description (i.e no unit amount or quantity) can be created by specifying
|
|
18
|
+
# just a <Description> element that contains at least 1 character
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :description
|
|
21
|
+
|
|
22
|
+
# LineItem Quantity
|
|
23
|
+
# @return [Float]
|
|
24
|
+
attr_accessor :quantity
|
|
25
|
+
|
|
26
|
+
# LineItem Unit Amount
|
|
27
|
+
# @return [Float]
|
|
28
|
+
attr_accessor :unit_amount
|
|
29
|
+
|
|
30
|
+
# See Items
|
|
31
|
+
# @return [String]
|
|
32
|
+
attr_accessor :item_code
|
|
33
|
+
|
|
34
|
+
# See Accounts
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :account_code
|
|
37
|
+
|
|
38
|
+
# The associated account ID related to this line item
|
|
39
|
+
# @return [UUID | String]
|
|
40
|
+
attr_accessor :account_id
|
|
41
|
+
|
|
42
|
+
# The tax type from TaxRates
|
|
43
|
+
# @return [String]
|
|
44
|
+
attr_accessor :tax_type
|
|
45
|
+
|
|
46
|
+
# The tax amount is auto calculated as a percentage of the line amount (see
|
|
47
|
+
# below) based on the tax rate. This value can be overriden if the
|
|
48
|
+
# calculated <TaxAmount> is not correct.
|
|
49
|
+
# @return [Float]
|
|
50
|
+
attr_accessor :tax_amount
|
|
51
|
+
|
|
52
|
+
# The tax amount is auto calculated as a percentage of the line amount (see
|
|
53
|
+
# below) based on the tax rate. This value can be overriden if the
|
|
54
|
+
# calculated <TaxAmount> is not correct.
|
|
55
|
+
# @return [LineItemItem]
|
|
56
|
+
attr_accessor :item
|
|
57
|
+
|
|
58
|
+
# If you wish to omit either the Quantity or UnitAmount you can provide a
|
|
59
|
+
# LineAmount and Xero will calculate the missing amount for you. The line
|
|
60
|
+
# amount reflects the discounted price if either a DiscountRate or
|
|
61
|
+
# DiscountAmount has been used i.e. LineAmount = Quantity * Unit Amount *
|
|
62
|
+
# ((100 - DiscountRate)/100) or LineAmount = (Quantity * UnitAmount) -
|
|
63
|
+
# DiscountAmount
|
|
64
|
+
# @return [Float]
|
|
65
|
+
attr_accessor :line_amount
|
|
66
|
+
|
|
67
|
+
# Optional Tracking Category – see Tracking. Any LineItem can have a
|
|
68
|
+
# maximum of 2 <TrackingCategory> elements.
|
|
69
|
+
# @return [Array[LineItemTracking]]
|
|
70
|
+
attr_accessor :tracking
|
|
71
|
+
|
|
72
|
+
# Percentage discount being applied to a line item (only supported on
|
|
73
|
+
# ACCREC invoices – ACC PAY invoices and credit notes in Xero do not support
|
|
74
|
+
# discounts
|
|
75
|
+
# @return [Float]
|
|
76
|
+
attr_accessor :discount_rate
|
|
77
|
+
|
|
78
|
+
# Discount amount being applied to a line item. Only supported on ACCREC
|
|
79
|
+
# invoices and quotes. ACCPAY invoices and credit notes in Xero do not
|
|
80
|
+
# support discounts.
|
|
81
|
+
# @return [Float]
|
|
82
|
+
attr_accessor :discount_amount
|
|
83
|
+
|
|
84
|
+
# The Xero identifier for a Repeating Invoice
|
|
85
|
+
# @return [UUID | String]
|
|
86
|
+
attr_accessor :repeating_invoice_id
|
|
87
|
+
|
|
88
|
+
# The type of taxability
|
|
89
|
+
# @return [Taxability]
|
|
90
|
+
attr_accessor :taxability
|
|
91
|
+
|
|
92
|
+
# The ID of the sales tax code
|
|
93
|
+
# @return [Float]
|
|
94
|
+
attr_accessor :sales_tax_code_id
|
|
95
|
+
|
|
96
|
+
# An array of tax components defined for this line item
|
|
97
|
+
# @return [Array[TaxBreakdownComponent]]
|
|
98
|
+
attr_accessor :tax_breakdown
|
|
99
|
+
|
|
100
|
+
# A mapping from model property names to API property names.
|
|
101
|
+
def self.names
|
|
102
|
+
@_hash = {} if @_hash.nil?
|
|
103
|
+
@_hash['line_item_id'] = 'LineItemID'
|
|
104
|
+
@_hash['description'] = 'Description'
|
|
105
|
+
@_hash['quantity'] = 'Quantity'
|
|
106
|
+
@_hash['unit_amount'] = 'UnitAmount'
|
|
107
|
+
@_hash['item_code'] = 'ItemCode'
|
|
108
|
+
@_hash['account_code'] = 'AccountCode'
|
|
109
|
+
@_hash['account_id'] = 'AccountID'
|
|
110
|
+
@_hash['tax_type'] = 'TaxType'
|
|
111
|
+
@_hash['tax_amount'] = 'TaxAmount'
|
|
112
|
+
@_hash['item'] = 'Item'
|
|
113
|
+
@_hash['line_amount'] = 'LineAmount'
|
|
114
|
+
@_hash['tracking'] = 'Tracking'
|
|
115
|
+
@_hash['discount_rate'] = 'DiscountRate'
|
|
116
|
+
@_hash['discount_amount'] = 'DiscountAmount'
|
|
117
|
+
@_hash['repeating_invoice_id'] = 'RepeatingInvoiceID'
|
|
118
|
+
@_hash['taxability'] = 'Taxability'
|
|
119
|
+
@_hash['sales_tax_code_id'] = 'SalesTaxCodeId'
|
|
120
|
+
@_hash['tax_breakdown'] = 'TaxBreakdown'
|
|
121
|
+
@_hash
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# An array for optional fields
|
|
125
|
+
def self.optionals
|
|
126
|
+
%w[
|
|
127
|
+
line_item_id
|
|
128
|
+
description
|
|
129
|
+
quantity
|
|
130
|
+
unit_amount
|
|
131
|
+
item_code
|
|
132
|
+
account_code
|
|
133
|
+
account_id
|
|
134
|
+
tax_type
|
|
135
|
+
tax_amount
|
|
136
|
+
item
|
|
137
|
+
line_amount
|
|
138
|
+
tracking
|
|
139
|
+
discount_rate
|
|
140
|
+
discount_amount
|
|
141
|
+
repeating_invoice_id
|
|
142
|
+
taxability
|
|
143
|
+
sales_tax_code_id
|
|
144
|
+
tax_breakdown
|
|
145
|
+
]
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# An array for nullable fields
|
|
149
|
+
def self.nullables
|
|
150
|
+
[]
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def initialize(line_item_id: SKIP, description: SKIP, quantity: SKIP,
|
|
154
|
+
unit_amount: SKIP, item_code: SKIP, account_code: SKIP,
|
|
155
|
+
account_id: SKIP, tax_type: SKIP, tax_amount: SKIP,
|
|
156
|
+
item: SKIP, line_amount: SKIP, tracking: SKIP,
|
|
157
|
+
discount_rate: SKIP, discount_amount: SKIP,
|
|
158
|
+
repeating_invoice_id: SKIP, taxability: SKIP,
|
|
159
|
+
sales_tax_code_id: SKIP, tax_breakdown: SKIP,
|
|
160
|
+
additional_properties: nil)
|
|
161
|
+
# Add additional model properties to the instance
|
|
162
|
+
additional_properties = {} if additional_properties.nil?
|
|
163
|
+
|
|
164
|
+
@line_item_id = line_item_id unless line_item_id == SKIP
|
|
165
|
+
@description = description unless description == SKIP
|
|
166
|
+
@quantity = quantity unless quantity == SKIP
|
|
167
|
+
@unit_amount = unit_amount unless unit_amount == SKIP
|
|
168
|
+
@item_code = item_code unless item_code == SKIP
|
|
169
|
+
@account_code = account_code unless account_code == SKIP
|
|
170
|
+
@account_id = account_id unless account_id == SKIP
|
|
171
|
+
@tax_type = tax_type unless tax_type == SKIP
|
|
172
|
+
@tax_amount = tax_amount unless tax_amount == SKIP
|
|
173
|
+
@item = item unless item == SKIP
|
|
174
|
+
@line_amount = line_amount unless line_amount == SKIP
|
|
175
|
+
@tracking = tracking unless tracking == SKIP
|
|
176
|
+
@discount_rate = discount_rate unless discount_rate == SKIP
|
|
177
|
+
@discount_amount = discount_amount unless discount_amount == SKIP
|
|
178
|
+
@repeating_invoice_id = repeating_invoice_id unless repeating_invoice_id == SKIP
|
|
179
|
+
@taxability = taxability unless taxability == SKIP
|
|
180
|
+
@sales_tax_code_id = sales_tax_code_id unless sales_tax_code_id == SKIP
|
|
181
|
+
@tax_breakdown = tax_breakdown unless tax_breakdown == SKIP
|
|
182
|
+
@additional_properties = additional_properties
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Creates an instance of the object from a hash.
|
|
186
|
+
def self.from_hash(hash)
|
|
187
|
+
return nil unless hash
|
|
188
|
+
|
|
189
|
+
# Extract variables from the hash.
|
|
190
|
+
line_item_id = hash.key?('LineItemID') ? hash['LineItemID'] : SKIP
|
|
191
|
+
description = hash.key?('Description') ? hash['Description'] : SKIP
|
|
192
|
+
quantity = hash.key?('Quantity') ? hash['Quantity'] : SKIP
|
|
193
|
+
unit_amount = hash.key?('UnitAmount') ? hash['UnitAmount'] : SKIP
|
|
194
|
+
item_code = hash.key?('ItemCode') ? hash['ItemCode'] : SKIP
|
|
195
|
+
account_code = hash.key?('AccountCode') ? hash['AccountCode'] : SKIP
|
|
196
|
+
account_id = hash.key?('AccountID') ? hash['AccountID'] : SKIP
|
|
197
|
+
tax_type = hash.key?('TaxType') ? hash['TaxType'] : SKIP
|
|
198
|
+
tax_amount = hash.key?('TaxAmount') ? hash['TaxAmount'] : SKIP
|
|
199
|
+
item = LineItemItem.from_hash(hash['Item']) if hash['Item']
|
|
200
|
+
line_amount = hash.key?('LineAmount') ? hash['LineAmount'] : SKIP
|
|
201
|
+
# Parameter is an array, so we need to iterate through it
|
|
202
|
+
tracking = nil
|
|
203
|
+
unless hash['Tracking'].nil?
|
|
204
|
+
tracking = []
|
|
205
|
+
hash['Tracking'].each do |structure|
|
|
206
|
+
tracking << (LineItemTracking.from_hash(structure) if structure)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
tracking = SKIP unless hash.key?('Tracking')
|
|
211
|
+
discount_rate = hash.key?('DiscountRate') ? hash['DiscountRate'] : SKIP
|
|
212
|
+
discount_amount =
|
|
213
|
+
hash.key?('DiscountAmount') ? hash['DiscountAmount'] : SKIP
|
|
214
|
+
repeating_invoice_id =
|
|
215
|
+
hash.key?('RepeatingInvoiceID') ? hash['RepeatingInvoiceID'] : SKIP
|
|
216
|
+
taxability = hash.key?('Taxability') ? hash['Taxability'] : SKIP
|
|
217
|
+
sales_tax_code_id =
|
|
218
|
+
hash.key?('SalesTaxCodeId') ? hash['SalesTaxCodeId'] : SKIP
|
|
219
|
+
# Parameter is an array, so we need to iterate through it
|
|
220
|
+
tax_breakdown = nil
|
|
221
|
+
unless hash['TaxBreakdown'].nil?
|
|
222
|
+
tax_breakdown = []
|
|
223
|
+
hash['TaxBreakdown'].each do |structure|
|
|
224
|
+
tax_breakdown << (TaxBreakdownComponent.from_hash(structure) if structure)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
tax_breakdown = SKIP unless hash.key?('TaxBreakdown')
|
|
229
|
+
|
|
230
|
+
# Create a new hash for additional properties, removing known properties.
|
|
231
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
232
|
+
|
|
233
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
234
|
+
new_hash, proc { |value| value }
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
# Create object from extracted values.
|
|
238
|
+
LineItem.new(line_item_id: line_item_id,
|
|
239
|
+
description: description,
|
|
240
|
+
quantity: quantity,
|
|
241
|
+
unit_amount: unit_amount,
|
|
242
|
+
item_code: item_code,
|
|
243
|
+
account_code: account_code,
|
|
244
|
+
account_id: account_id,
|
|
245
|
+
tax_type: tax_type,
|
|
246
|
+
tax_amount: tax_amount,
|
|
247
|
+
item: item,
|
|
248
|
+
line_amount: line_amount,
|
|
249
|
+
tracking: tracking,
|
|
250
|
+
discount_rate: discount_rate,
|
|
251
|
+
discount_amount: discount_amount,
|
|
252
|
+
repeating_invoice_id: repeating_invoice_id,
|
|
253
|
+
taxability: taxability,
|
|
254
|
+
sales_tax_code_id: sales_tax_code_id,
|
|
255
|
+
tax_breakdown: tax_breakdown,
|
|
256
|
+
additional_properties: additional_properties)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Provides a human-readable string representation of the object.
|
|
260
|
+
def to_s
|
|
261
|
+
class_name = self.class.name.split('::').last
|
|
262
|
+
"<#{class_name} line_item_id: #{@line_item_id}, description: #{@description}, quantity:"\
|
|
263
|
+
" #{@quantity}, unit_amount: #{@unit_amount}, item_code: #{@item_code}, account_code:"\
|
|
264
|
+
" #{@account_code}, account_id: #{@account_id}, tax_type: #{@tax_type}, tax_amount:"\
|
|
265
|
+
" #{@tax_amount}, item: #{@item}, line_amount: #{@line_amount}, tracking: #{@tracking},"\
|
|
266
|
+
" discount_rate: #{@discount_rate}, discount_amount: #{@discount_amount},"\
|
|
267
|
+
" repeating_invoice_id: #{@repeating_invoice_id}, taxability: #{@taxability},"\
|
|
268
|
+
" sales_tax_code_id: #{@sales_tax_code_id}, tax_breakdown: #{@tax_breakdown},"\
|
|
269
|
+
" additional_properties: #{@additional_properties}>"
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
273
|
+
def inspect
|
|
274
|
+
class_name = self.class.name.split('::').last
|
|
275
|
+
"<#{class_name} line_item_id: #{@line_item_id.inspect}, description:"\
|
|
276
|
+
" #{@description.inspect}, quantity: #{@quantity.inspect}, unit_amount:"\
|
|
277
|
+
" #{@unit_amount.inspect}, item_code: #{@item_code.inspect}, account_code:"\
|
|
278
|
+
" #{@account_code.inspect}, account_id: #{@account_id.inspect}, tax_type:"\
|
|
279
|
+
" #{@tax_type.inspect}, tax_amount: #{@tax_amount.inspect}, item: #{@item.inspect},"\
|
|
280
|
+
" line_amount: #{@line_amount.inspect}, tracking: #{@tracking.inspect}, discount_rate:"\
|
|
281
|
+
" #{@discount_rate.inspect}, discount_amount: #{@discount_amount.inspect},"\
|
|
282
|
+
" repeating_invoice_id: #{@repeating_invoice_id.inspect}, taxability:"\
|
|
283
|
+
" #{@taxability.inspect}, sales_tax_code_id: #{@sales_tax_code_id.inspect}, tax_breakdown:"\
|
|
284
|
+
" #{@tax_breakdown.inspect}, additional_properties: #{@additional_properties}>"
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|