xero-ruby 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -1
- data/build_notes.md +17 -0
- data/docs/accounting/AccountingApi.md +23 -11
- data/docs/accounting/ManualJournalLine.md +2 -0
- data/docs/accounting/Organisation.md +1 -1
- data/docs/accounting/Report.md +1 -1
- data/docs/accounting/{TenNinteyNineContact.md → TenNinetyNineContact.md} +2 -2
- data/lib/xero-ruby.rb +2 -2
- data/lib/xero-ruby/api/accounting_api.rb +21 -7
- data/lib/xero-ruby/api/asset_api.rb +1 -1
- data/lib/xero-ruby/api/project_api.rb +1 -1
- data/lib/xero-ruby/api_client.rb +66 -31
- data/lib/xero-ruby/api_error.rb +1 -1
- data/lib/xero-ruby/configuration.rb +1 -4
- data/lib/xero-ruby/models/accounting/account.rb +7 -2
- data/lib/xero-ruby/models/accounting/account_type.rb +1 -1
- data/lib/xero-ruby/models/accounting/accounts.rb +5 -1
- data/lib/xero-ruby/models/accounting/accounts_payable.rb +7 -3
- data/lib/xero-ruby/models/accounting/accounts_receivable.rb +7 -3
- data/lib/xero-ruby/models/accounting/address.rb +5 -1
- data/lib/xero-ruby/models/accounting/allocation.rb +6 -2
- data/lib/xero-ruby/models/accounting/allocations.rb +5 -1
- data/lib/xero-ruby/models/accounting/attachment.rb +5 -1
- data/lib/xero-ruby/models/accounting/attachments.rb +5 -1
- data/lib/xero-ruby/models/accounting/balances.rb +5 -1
- data/lib/xero-ruby/models/accounting/bank_transaction.rb +9 -5
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +5 -1
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +7 -3
- data/lib/xero-ruby/models/accounting/bank_transfers.rb +5 -1
- data/lib/xero-ruby/models/accounting/batch_payment.rb +6 -2
- data/lib/xero-ruby/models/accounting/batch_payment_details.rb +5 -1
- data/lib/xero-ruby/models/accounting/batch_payments.rb +5 -1
- data/lib/xero-ruby/models/accounting/bill.rb +5 -1
- data/lib/xero-ruby/models/accounting/branding_theme.rb +5 -1
- data/lib/xero-ruby/models/accounting/branding_themes.rb +5 -1
- data/lib/xero-ruby/models/accounting/cis_org_setting.rb +5 -1
- data/lib/xero-ruby/models/accounting/cis_setting.rb +5 -1
- data/lib/xero-ruby/models/accounting/cis_settings.rb +5 -1
- data/lib/xero-ruby/models/accounting/contact.rb +6 -2
- data/lib/xero-ruby/models/accounting/contact_group.rb +5 -1
- data/lib/xero-ruby/models/accounting/contact_groups.rb +5 -1
- data/lib/xero-ruby/models/accounting/contact_person.rb +5 -1
- data/lib/xero-ruby/models/accounting/contacts.rb +5 -1
- data/lib/xero-ruby/models/accounting/country_code.rb +1 -1
- data/lib/xero-ruby/models/accounting/credit_note.rb +10 -6
- data/lib/xero-ruby/models/accounting/credit_notes.rb +5 -1
- data/lib/xero-ruby/models/accounting/currencies.rb +5 -1
- data/lib/xero-ruby/models/accounting/currency.rb +5 -1
- data/lib/xero-ruby/models/accounting/currency_code.rb +1 -1
- data/lib/xero-ruby/models/accounting/element.rb +5 -1
- data/lib/xero-ruby/models/accounting/employee.rb +5 -1
- data/lib/xero-ruby/models/accounting/employees.rb +5 -1
- data/lib/xero-ruby/models/accounting/error.rb +5 -1
- data/lib/xero-ruby/models/accounting/expense_claim.rb +8 -4
- data/lib/xero-ruby/models/accounting/expense_claims.rb +5 -1
- data/lib/xero-ruby/models/accounting/external_link.rb +5 -1
- data/lib/xero-ruby/models/accounting/history_record.rb +5 -1
- data/lib/xero-ruby/models/accounting/history_records.rb +5 -1
- data/lib/xero-ruby/models/accounting/invoice.rb +14 -10
- data/lib/xero-ruby/models/accounting/invoice_reminder.rb +5 -1
- data/lib/xero-ruby/models/accounting/invoice_reminders.rb +5 -1
- data/lib/xero-ruby/models/accounting/invoices.rb +5 -1
- data/lib/xero-ruby/models/accounting/item.rb +7 -3
- data/lib/xero-ruby/models/accounting/items.rb +5 -1
- data/lib/xero-ruby/models/accounting/journal.rb +5 -1
- data/lib/xero-ruby/models/accounting/journal_line.rb +8 -4
- data/lib/xero-ruby/models/accounting/journals.rb +5 -1
- data/lib/xero-ruby/models/accounting/line_amount_types.rb +1 -1
- data/lib/xero-ruby/models/accounting/line_item.rb +11 -7
- data/lib/xero-ruby/models/accounting/line_item_tracking.rb +5 -1
- data/lib/xero-ruby/models/accounting/linked_transaction.rb +5 -1
- data/lib/xero-ruby/models/accounting/linked_transactions.rb +5 -1
- data/lib/xero-ruby/models/accounting/manual_journal.rb +5 -1
- data/lib/xero-ruby/models/accounting/manual_journal_line.rb +18 -4
- data/lib/xero-ruby/models/accounting/manual_journals.rb +5 -1
- data/lib/xero-ruby/models/accounting/online_invoice.rb +5 -1
- data/lib/xero-ruby/models/accounting/online_invoices.rb +5 -1
- data/lib/xero-ruby/models/accounting/organisation.rb +33 -3
- data/lib/xero-ruby/models/accounting/organisations.rb +5 -1
- data/lib/xero-ruby/models/accounting/overpayment.rb +10 -6
- data/lib/xero-ruby/models/accounting/overpayments.rb +5 -1
- data/lib/xero-ruby/models/accounting/payment.rb +7 -3
- data/lib/xero-ruby/models/accounting/payment_delete.rb +5 -1
- data/lib/xero-ruby/models/accounting/payment_service.rb +5 -1
- data/lib/xero-ruby/models/accounting/payment_services.rb +5 -1
- data/lib/xero-ruby/models/accounting/payment_term.rb +5 -1
- data/lib/xero-ruby/models/accounting/payment_term_type.rb +1 -1
- data/lib/xero-ruby/models/accounting/payments.rb +5 -1
- data/lib/xero-ruby/models/accounting/phone.rb +5 -1
- data/lib/xero-ruby/models/accounting/prepayment.rb +10 -6
- data/lib/xero-ruby/models/accounting/prepayments.rb +5 -1
- data/lib/xero-ruby/models/accounting/purchase.rb +6 -2
- data/lib/xero-ruby/models/accounting/purchase_order.rb +10 -6
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +5 -1
- data/lib/xero-ruby/models/accounting/quote.rb +9 -5
- data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +1 -1
- data/lib/xero-ruby/models/accounting/quote_status_codes.rb +2 -1
- data/lib/xero-ruby/models/accounting/quotes.rb +5 -1
- data/lib/xero-ruby/models/accounting/receipt.rb +8 -4
- data/lib/xero-ruby/models/accounting/receipts.rb +5 -1
- data/lib/xero-ruby/models/accounting/repeating_invoice.rb +8 -4
- data/lib/xero-ruby/models/accounting/repeating_invoices.rb +5 -1
- data/lib/xero-ruby/models/accounting/report.rb +6 -2
- data/lib/xero-ruby/models/accounting/report_attribute.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_cell.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_fields.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_row.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_rows.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_with_row.rb +5 -1
- data/lib/xero-ruby/models/accounting/report_with_rows.rb +5 -1
- data/lib/xero-ruby/models/accounting/reports.rb +5 -1
- data/lib/xero-ruby/models/accounting/request_empty.rb +5 -1
- data/lib/xero-ruby/models/accounting/row_type.rb +1 -1
- data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +5 -1
- data/lib/xero-ruby/models/accounting/schedule.rb +5 -1
- data/lib/xero-ruby/models/accounting/tax_component.rb +6 -2
- data/lib/xero-ruby/models/accounting/tax_rate.rb +7 -3
- data/lib/xero-ruby/models/accounting/tax_rates.rb +5 -1
- data/lib/xero-ruby/models/accounting/tax_type.rb +1 -1
- data/lib/xero-ruby/models/accounting/{ten_nintey_nine_contact.rb → ten_ninety_nine_contact.rb} +21 -17
- data/lib/xero-ruby/models/accounting/time_zone.rb +1 -1
- data/lib/xero-ruby/models/accounting/tracking_categories.rb +5 -1
- data/lib/xero-ruby/models/accounting/tracking_category.rb +5 -1
- data/lib/xero-ruby/models/accounting/tracking_option.rb +5 -1
- data/lib/xero-ruby/models/accounting/tracking_options.rb +5 -1
- data/lib/xero-ruby/models/accounting/user.rb +5 -1
- data/lib/xero-ruby/models/accounting/users.rb +5 -1
- data/lib/xero-ruby/models/accounting/validation_error.rb +5 -1
- data/lib/xero-ruby/models/assets/asset.rb +8 -4
- data/lib/xero-ruby/models/assets/asset_status.rb +1 -1
- data/lib/xero-ruby/models/assets/asset_status_query_param.rb +1 -1
- data/lib/xero-ruby/models/assets/asset_type.rb +5 -1
- data/lib/xero-ruby/models/assets/assets.rb +5 -1
- data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +11 -7
- data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +6 -2
- data/lib/xero-ruby/models/assets/error.rb +5 -1
- data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +5 -1
- data/lib/xero-ruby/models/assets/pagination.rb +5 -1
- data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +5 -1
- data/lib/xero-ruby/models/assets/setting.rb +5 -1
- data/lib/xero-ruby/models/projects/amount.rb +6 -2
- data/lib/xero-ruby/models/projects/charge_type.rb +1 -1
- data/lib/xero-ruby/models/projects/currency_code.rb +1 -1
- data/lib/xero-ruby/models/projects/error.rb +5 -1
- data/lib/xero-ruby/models/projects/pagination.rb +5 -1
- data/lib/xero-ruby/models/projects/project.rb +5 -1
- data/lib/xero-ruby/models/projects/project_create_or_update.rb +6 -2
- data/lib/xero-ruby/models/projects/project_patch.rb +5 -1
- data/lib/xero-ruby/models/projects/project_status.rb +1 -1
- data/lib/xero-ruby/models/projects/project_user.rb +5 -1
- data/lib/xero-ruby/models/projects/project_users.rb +5 -1
- data/lib/xero-ruby/models/projects/projects.rb +5 -1
- data/lib/xero-ruby/models/projects/task.rb +5 -1
- data/lib/xero-ruby/models/projects/task_create_or_update.rb +5 -1
- data/lib/xero-ruby/models/projects/tasks.rb +5 -1
- data/lib/xero-ruby/models/projects/time_entries.rb +5 -1
- data/lib/xero-ruby/models/projects/time_entry.rb +5 -1
- data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +5 -1
- data/lib/xero-ruby/version.rb +2 -2
- data/spec/accounting/models/ten_nintey_nine_contact_spec.rb +6 -6
- data/spec/api_client_spec.rb +8 -10
- data/xero-ruby.gemspec +1 -2
- metadata +5 -5
- data/xero-ruby.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c469455936635d16067b4269ad96bda3ae65b7d8f9a34399532b380a7f34d72b
|
4
|
+
data.tar.gz: '039093400b943441b6f987a279cc981c23052e6575047f301ba9527192b26d34'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc87f93d7203239d688b12e4d0f7496953fb1563cd4d3865384f3d9a51342d18b44029c8c2af4670d55e71c27e0561df1c4e24d05bea7afd64da1ac679d0610
|
7
|
+
data.tar.gz: 9362cfe1d6822dc0caedad0213ec31c35172503bf8da0af3c145e80c5794dbed5122fc739d02ed7ce4234db8d9e159d7458cea082efe42152a31be4106a7b377
|
data/README.md
CHANGED
@@ -7,13 +7,13 @@ Xero Ruby SDK for OAuth 2.0 generated from [Xero API OpenAPI Spec](https://githu
|
|
7
7
|
Xero Ruby SDK supports Xero's OAuth2.0 authentication (token generation & refresh) and supports the following Xero API sets.
|
8
8
|
* [accounting](https://developer.xero.com/documentation/api/api-overview)
|
9
9
|
* [assets](https://developer.xero.com/documentation/assets-api/overview)
|
10
|
+
* [projects](https://developer.xero.com/documentation/projects/overview-projects)
|
10
11
|
|
11
12
|
Coming soon
|
12
13
|
* bank feeds
|
13
14
|
* payroll (AU))
|
14
15
|
* payroll (NZ/UK)
|
15
16
|
* files
|
16
|
-
* projects
|
17
17
|
* xero hq
|
18
18
|
|
19
19
|
## Looking for OAuth 1.0a support?
|
@@ -119,6 +119,10 @@ token_set = xero_client.token_set
|
|
119
119
|
```
|
120
120
|
|
121
121
|
## API Usage
|
122
|
+
> Comprehensive xero-ruby API usage is showcased here: https://github.com/XeroAPI/xero-ruby-oauth2-app
|
123
|
+
|
124
|
+
Here is the basic workflow of using SDK once you have a valid `access_token` (and `token_set`) stored on an instance of the `xero_client`
|
125
|
+
|
122
126
|
```ruby
|
123
127
|
require 'xero-ruby'
|
124
128
|
|
@@ -126,10 +130,28 @@ token_set = xero_client.token_set
|
|
126
130
|
xero_client.refresh_token_set(user.token_set)
|
127
131
|
|
128
132
|
# Accounting API set (https://github.com/XeroAPI/xero-ruby/blob/master/accounting/lib/xero-ruby/api/accounting_api.rb)
|
133
|
+
|
134
|
+
# Examples
|
129
135
|
invoices = xero_client.accounting_api.get_invoices(user.active_tenant_id).invoices
|
130
136
|
accounts = xero_client.accounting_api.get_accounts(user.active_tenant_id).accounts
|
131
137
|
contacts = xero_client.accounting_api.get_contacts(user.active_tenant_id).contacts
|
132
138
|
|
139
|
+
contacts = xero_client.accounting_api.get_contacts(current_user.active_tenant_id).contacts
|
140
|
+
invoices = { invoices: [{ type: XeroRuby::Accounting::Invoice::ACCREC, contact: { contact_id: contacts[0].contact_id }, line_items: [{ description: "Acme Tires", quantity: BigDecimal("2.0"), unit_amount: BigDecimal("20.99"), account_code: "600", tax_type: XeroRuby::Accounting::TaxType::NONE }], date: "2019-03-11", due_date: "2018-12-10", reference: "Website Design", status: XeroRuby::Accounting::Invoice::DRAFT }]}
|
141
|
+
invoice = xero_client.accounting_api.create_invoices(current_user.active_tenant_id, invoices).invoices.first
|
142
|
+
|
143
|
+
payment = xero_client.accounting_api.get_payments(current_user.active_tenant_id).payments.first
|
144
|
+
history_records = { history_records:[ { details: "This payment now has some History #{rand(10000)}" } ]}
|
145
|
+
payment_history = xero_client.accounting_api.create_payment_history(user.active_tenant_id, payment.payment_id, history_records)
|
146
|
+
|
147
|
+
account = xero_client.accounting_api.get_accounts(current_user.active_tenant_id).accounts.first
|
148
|
+
file_name = "an-account-filename.png"
|
149
|
+
opts = {
|
150
|
+
include_online: true # Boolean | Allows an attachment to be seen by the end customer within their online invoice
|
151
|
+
}
|
152
|
+
file = File.read(Rails.root.join('app/assets/images/xero-api.png'))
|
153
|
+
attachment = xero_client.accounting_api.create_account_attachment_by_file_name(current_user.active_tenant_id, @account.account_id, file_name, file, opts)
|
154
|
+
|
133
155
|
# Asset API set (https://github.com/XeroAPI/xero-ruby/blob/master/accounting/lib/xero-ruby/api/asset_api.rb)
|
134
156
|
asset = {
|
135
157
|
"assetName": "AssetName: #{rand(10000)}",
|
@@ -137,6 +159,9 @@ token_set = xero_client.token_set
|
|
137
159
|
"assetStatus": "DRAFT"
|
138
160
|
}
|
139
161
|
asset = xero_client.asset_api.create_asset(current_user.active_tenant_id, asset)
|
162
|
+
|
163
|
+
# Project API set (https://github.com/XeroAPI/xero-ruby/blob/master/docs/projects/ProjectApi.md)
|
164
|
+
projects = xero_client.project_api.get_projects(current_user.active_tenant_id).items
|
140
165
|
```
|
141
166
|
|
142
167
|
If you have use cases outside of these examples or this readmy, please let us know!
|
data/build_notes.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Developing gem locally
|
2
|
+
|
3
|
+
> xero-ruby
|
4
|
+
```bash
|
5
|
+
gem build
|
6
|
+
mv xero-ruby-<vsn>.gem xero-ruby.gem
|
7
|
+
```
|
8
|
+
|
9
|
+
> xero-ruby-oauth2-app
|
10
|
+
|
11
|
+
Replace gem file with local path:
|
12
|
+
`gem 'xero-ruby', path: '/Users/chris.knight/code/sdks/xero-ruby/'`
|
13
|
+
```bash
|
14
|
+
bundle install
|
15
|
+
```
|
16
|
+
|
17
|
+
Deploying to Rubygems
|
@@ -6,7 +6,7 @@ Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
7
7
|
[**create_account**](AccountingApi.md#create_account) | **PUT** /Accounts | Allows you to create a new chart of accounts
|
8
8
|
[**create_account_attachment_by_file_name**](AccountingApi.md#create_account_attachment_by_file_name) | **PUT** /Accounts/{AccountID}/Attachments/{FileName} | Allows you to create Attachment on Account
|
9
|
-
[**create_bank_transaction_attachment_by_file_name**](AccountingApi.md#create_bank_transaction_attachment_by_file_name) | **PUT** /BankTransactions/{BankTransactionID}/Attachments/{FileName} | Allows you to
|
9
|
+
[**create_bank_transaction_attachment_by_file_name**](AccountingApi.md#create_bank_transaction_attachment_by_file_name) | **PUT** /BankTransactions/{BankTransactionID}/Attachments/{FileName} | Allows you to create an Attachment on BankTransaction by Filename
|
10
10
|
[**create_bank_transaction_history_record**](AccountingApi.md#create_bank_transaction_history_record) | **PUT** /BankTransactions/{BankTransactionID}/History | Allows you to create history record for a bank transactions
|
11
11
|
[**create_bank_transactions**](AccountingApi.md#create_bank_transactions) | **PUT** /BankTransactions | Allows you to create one or more spend or receive money transaction
|
12
12
|
[**create_bank_transfer**](AccountingApi.md#create_bank_transfer) | **PUT** /BankTransfers | Allows you to create a bank transfers
|
@@ -186,7 +186,7 @@ Method | HTTP request | Description
|
|
186
186
|
[**get_users**](AccountingApi.md#get_users) | **GET** /Users | Allows you to retrieve users
|
187
187
|
[**update_account**](AccountingApi.md#update_account) | **POST** /Accounts/{AccountID} | Allows you to update a chart of accounts
|
188
188
|
[**update_account_attachment_by_file_name**](AccountingApi.md#update_account_attachment_by_file_name) | **POST** /Accounts/{AccountID}/Attachments/{FileName} | Allows you to update Attachment on Account by Filename
|
189
|
-
[**update_bank_transaction**](AccountingApi.md#update_bank_transaction) | **POST** /BankTransactions/{BankTransactionID} |
|
189
|
+
[**update_bank_transaction**](AccountingApi.md#update_bank_transaction) | **POST** /BankTransactions/{BankTransactionID} | Allows you to update a single spend or receive money transaction
|
190
190
|
[**update_bank_transaction_attachment_by_file_name**](AccountingApi.md#update_bank_transaction_attachment_by_file_name) | **POST** /BankTransactions/{BankTransactionID}/Attachments/{FileName} | Allows you to update an Attachment on BankTransaction by Filename
|
191
191
|
[**update_bank_transfer_attachment_by_file_name**](AccountingApi.md#update_bank_transfer_attachment_by_file_name) | **POST** /BankTransfers/{BankTransferID}/Attachments/{FileName} |
|
192
192
|
[**update_contact**](AccountingApi.md#update_contact) | **POST** /Contacts/{ContactID} |
|
@@ -360,7 +360,7 @@ Name | Type | Description | Notes
|
|
360
360
|
|
361
361
|
> Attachments create_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, body)
|
362
362
|
|
363
|
-
Allows you to
|
363
|
+
Allows you to create an Attachment on BankTransaction by Filename
|
364
364
|
|
365
365
|
### Example
|
366
366
|
|
@@ -394,7 +394,7 @@ bank_transaction_id = '00000000-0000-0000-000-000000000000' # String | Xero gene
|
|
394
394
|
file_name = 'xero-dev.jpg' # String | The name of the file being attached
|
395
395
|
body = 'body_example' # String | Byte array of file in body of request
|
396
396
|
begin
|
397
|
-
#Allows you to
|
397
|
+
#Allows you to create an Attachment on BankTransaction by Filename
|
398
398
|
result = api_instance.create_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, body)
|
399
399
|
p result
|
400
400
|
rescue XeroRuby::Accounting::ApiError => e
|
@@ -1132,7 +1132,7 @@ api_instance = xero_client.accounting_api
|
|
1132
1132
|
api_instance = xero_client.asset_api
|
1133
1133
|
# :projects_api
|
1134
1134
|
api_instance = xero_client.projects_api
|
1135
|
-
contacts = { contacts: [{
|
1135
|
+
contacts = { contacts: [{ contact_id: "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { contact_id: "4e1753b9-018a-4775-b6aa-1bc7871cfee3" }]}
|
1136
1136
|
|
1137
1137
|
begin
|
1138
1138
|
#Allows you to add Contacts to a Contact Group
|
@@ -1305,7 +1305,7 @@ Name | Type | Description | Notes
|
|
1305
1305
|
|
1306
1306
|
## create_credit_note_allocation
|
1307
1307
|
|
1308
|
-
> Allocations create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations)
|
1308
|
+
> Allocations create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations, opts)
|
1309
1309
|
|
1310
1310
|
Allows you to create Allocation on CreditNote
|
1311
1311
|
|
@@ -1336,9 +1336,13 @@ api_instance = xero_client.asset_api
|
|
1336
1336
|
api_instance = xero_client.projects_api
|
1337
1337
|
allocations = { allocations: [{ amount: 1.0, date: "2019-03-05", invoice: { invoice_id: "c45720a1-ade3-4a38-a064-d15489be6841", line_items: [], type: XeroRuby::Accounting::Invoice::ACCPAY, contact: {} }}]}
|
1338
1338
|
|
1339
|
+
opts = {
|
1340
|
+
summarize_errors: false # Boolean | If false return 200 OK and mix of successfully created obejcts and any with validation errors
|
1341
|
+
}
|
1342
|
+
|
1339
1343
|
begin
|
1340
1344
|
#Allows you to create Allocation on CreditNote
|
1341
|
-
result = api_instance.create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations)
|
1345
|
+
result = api_instance.create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations, opts)
|
1342
1346
|
p result
|
1343
1347
|
rescue XeroRuby::Accounting::ApiError => e
|
1344
1348
|
puts "Exception when calling AccountingApi->create_credit_note_allocation: #{e}"
|
@@ -1353,6 +1357,7 @@ Name | Type | Description | Notes
|
|
1353
1357
|
**xero_tenant_id** | **String**| Xero identifier for Tenant |
|
1354
1358
|
**credit_note_id** | [**String**](.md)| Unique identifier for a Credit Note |
|
1355
1359
|
**allocations** | [**Allocations**](Allocations.md)| Allocations with array of Allocation object in body of request. |
|
1360
|
+
**summarize_errors** | **Boolean**| If false return 200 OK and mix of successfully created obejcts and any with validation errors | [optional] [default to false]
|
1356
1361
|
|
1357
1362
|
### Return type
|
1358
1363
|
|
@@ -12874,9 +12879,9 @@ Name | Type | Description | Notes
|
|
12874
12879
|
|
12875
12880
|
## update_bank_transaction
|
12876
12881
|
|
12877
|
-
> BankTransactions update_bank_transaction(xero_tenant_id, bank_transactions)
|
12878
|
-
|
12882
|
+
> BankTransactions update_bank_transaction(xero_tenant_id, bank_transaction_id, bank_transactions, opts)
|
12879
12883
|
|
12884
|
+
Allows you to update a single spend or receive money transaction
|
12880
12885
|
|
12881
12886
|
### Example
|
12882
12887
|
|
@@ -12903,10 +12908,15 @@ api_instance = xero_client.accounting_api
|
|
12903
12908
|
api_instance = xero_client.asset_api
|
12904
12909
|
# :projects_api
|
12905
12910
|
api_instance = xero_client.projects_api
|
12906
|
-
{ bank_transactions: [{ type: XeroRuby::Accounting::BankTransaction::SPEND, date: "2019-02-25", reference: "You just updated", status: XeroRuby::Accounting::BankTransaction::AUTHORISED, bank_transaction_id: "00000000-0000-0000-000-000000000000", line_items: [], contact: {}, bank_account: { account_id: "00000000-0000-0000-000-000000000000" }}]}
|
12911
|
+
{ bank_transactions: [{ type: XeroRuby::Accounting::BankTransaction::SPEND, date: "2019-02-25", reference: "You just updated", status: XeroRuby::Accounting::BankTransaction::AUTHORISED, bank_transaction_id: "00000000-0000-0000-000-000000000000", line_items: [], contact: {}, bank_account: { account_id: "00000000-0000-0000-000-000000000000" }}]}
|
12912
|
+
|
12913
|
+
opts = {
|
12914
|
+
unitdp: 4 # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
|
12915
|
+
}
|
12907
12916
|
|
12908
12917
|
begin
|
12909
|
-
|
12918
|
+
#Allows you to update a single spend or receive money transaction
|
12919
|
+
result = api_instance.update_bank_transaction(xero_tenant_id, bank_transaction_id, bank_transactions, opts)
|
12910
12920
|
p result
|
12911
12921
|
rescue XeroRuby::Accounting::ApiError => e
|
12912
12922
|
puts "Exception when calling AccountingApi->update_bank_transaction: #{e}"
|
@@ -12919,7 +12929,9 @@ end
|
|
12919
12929
|
Name | Type | Description | Notes
|
12920
12930
|
------------- | ------------- | ------------- | -------------
|
12921
12931
|
**xero_tenant_id** | **String**| Xero identifier for Tenant |
|
12932
|
+
**bank_transaction_id** | [**String**](.md)| Xero generated unique identifier for a bank transaction |
|
12922
12933
|
**bank_transactions** | [**BankTransactions**](BankTransactions.md)| |
|
12934
|
+
**unitdp** | **Integer**| e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts | [optional]
|
12923
12935
|
|
12924
12936
|
### Return type
|
12925
12937
|
|
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
|
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**line_amount** | **Float** | total for line. Debits are positive, credits are negative value | [optional]
|
8
8
|
**account_code** | **String** | See Accounts | [optional]
|
9
|
+
**account_id** | **String** | See Accounts | [optional]
|
9
10
|
**description** | **String** | Description for journal line | [optional]
|
10
11
|
**tax_type** | **String** | The tax type from TaxRates | [optional]
|
11
12
|
**tracking** | [**Array<TrackingCategory>**](TrackingCategory.md) | Optional Tracking Category – see Tracking. Any JournalLine can have a maximum of 2 <TrackingCategory> elements. | [optional]
|
@@ -19,6 +20,7 @@ require 'XeroRuby::Accounting'
|
|
19
20
|
|
20
21
|
instance = XeroRuby::Accounting::ManualJournalLine.new(line_amount: -2569.0,
|
21
22
|
account_code: 720,
|
23
|
+
account_id: null,
|
22
24
|
description: Coded incorrectly Office Equipment should be Computer Equipment,
|
23
25
|
tax_type: null,
|
24
26
|
tracking: null,
|
@@ -28,7 +28,7 @@ Name | Type | Description | Notes
|
|
28
28
|
**end_of_year_lock_date** | **Date** | Shown if set. See lock dates | [optional]
|
29
29
|
**created_date_utc** | **DateTime** | Timestamp when the organisation was created in Xero | [optional]
|
30
30
|
**timezone** | [**TimeZone**](TimeZone.md) | | [optional]
|
31
|
-
**organisation_entity_type** | **String** | Organisation Type | [optional]
|
31
|
+
**organisation_entity_type** | **String** | Organisation Entity Type | [optional]
|
32
32
|
**short_code** | **String** | A unique identifier for the organisation. Potential uses. | [optional]
|
33
33
|
**_class** | **String** | Organisation Classes describe which plan the Xero organisation is on (e.g. DEMO, TRIAL, PREMIUM) | [optional]
|
34
34
|
**edition** | **String** | BUSINESS or PARTNER. Partner edition organisations are sold exclusively through accounting partners and have restricted functionality (e.g. no access to invoicing) | [optional]
|
data/docs/accounting/Report.md
CHANGED
@@ -10,7 +10,7 @@ Name | Type | Description | Notes
|
|
10
10
|
**report_title** | **String** | See Prepayment Types | [optional]
|
11
11
|
**report_date** | **String** | Date of report | [optional]
|
12
12
|
**updated_date_utc** | **DateTime** | Updated Date | [optional]
|
13
|
-
**contacts** | [**Array<
|
13
|
+
**contacts** | [**Array<TenNinetyNineContact>**](TenNinetyNineContact.md) | | [optional]
|
14
14
|
|
15
15
|
## Code Sample
|
16
16
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# XeroRuby::Accounting::
|
1
|
+
# XeroRuby::Accounting::TenNinetyNineContact
|
2
2
|
|
3
3
|
## Properties
|
4
4
|
|
@@ -32,7 +32,7 @@ Name | Type | Description | Notes
|
|
32
32
|
```ruby
|
33
33
|
require 'XeroRuby::Accounting'
|
34
34
|
|
35
|
-
instance = XeroRuby::Accounting::
|
35
|
+
instance = XeroRuby::Accounting::TenNinetyNineContact.new(box1: null,
|
36
36
|
box2: null,
|
37
37
|
box3: null,
|
38
38
|
box4: null,
|
data/lib/xero-ruby.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.2.
|
6
|
+
The version of the OpenAPI document: 2.2.11
|
7
7
|
Contact: api@xero.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 4.3.1
|
@@ -152,7 +152,7 @@ require 'xero-ruby/models/accounting/tax_component'
|
|
152
152
|
require 'xero-ruby/models/accounting/tax_rate'
|
153
153
|
require 'xero-ruby/models/accounting/tax_rates'
|
154
154
|
require 'xero-ruby/models/accounting/tax_type'
|
155
|
-
require 'xero-ruby/models/accounting/
|
155
|
+
require 'xero-ruby/models/accounting/ten_ninety_nine_contact'
|
156
156
|
require 'xero-ruby/models/accounting/time_zone'
|
157
157
|
require 'xero-ruby/models/accounting/tracking_categories'
|
158
158
|
require 'xero-ruby/models/accounting/tracking_category'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.2.
|
6
|
+
The version of the OpenAPI document: 2.2.11
|
7
7
|
Contact: api@xero.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 4.3.1
|
@@ -169,7 +169,7 @@ module XeroRuby
|
|
169
169
|
return data, status_code, headers
|
170
170
|
end
|
171
171
|
|
172
|
-
# Allows you to
|
172
|
+
# Allows you to create an Attachment on BankTransaction by Filename
|
173
173
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
174
174
|
# @param bank_transaction_id [String] Xero generated unique identifier for a bank transaction
|
175
175
|
# @param file_name [String] The name of the file being attached
|
@@ -181,7 +181,7 @@ module XeroRuby
|
|
181
181
|
data
|
182
182
|
end
|
183
183
|
|
184
|
-
# Allows you to
|
184
|
+
# Allows you to create an Attachment on BankTransaction by Filename
|
185
185
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
186
186
|
# @param bank_transaction_id [String] Xero generated unique identifier for a bank transaction
|
187
187
|
# @param file_name [String] The name of the file being attached
|
@@ -1218,6 +1218,7 @@ module XeroRuby
|
|
1218
1218
|
# @param credit_note_id [String] Unique identifier for a Credit Note
|
1219
1219
|
# @param allocations [Allocations] Allocations with array of Allocation object in body of request.
|
1220
1220
|
# @param [Hash] opts the optional parameters
|
1221
|
+
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created obejcts and any with validation errors (default to false)
|
1221
1222
|
# @return [Allocations]
|
1222
1223
|
def create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations, opts = {})
|
1223
1224
|
data, _status_code, _headers = create_credit_note_allocation_with_http_info(xero_tenant_id, credit_note_id, allocations, opts)
|
@@ -1229,6 +1230,7 @@ module XeroRuby
|
|
1229
1230
|
# @param credit_note_id [String] Unique identifier for a Credit Note
|
1230
1231
|
# @param allocations [Allocations] Allocations with array of Allocation object in body of request.
|
1231
1232
|
# @param [Hash] opts the optional parameters
|
1233
|
+
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created obejcts and any with validation errors
|
1232
1234
|
# @return [Array<(Allocations, Integer, Hash)>] Allocations data, response status code and response headers
|
1233
1235
|
def create_credit_note_allocation_with_http_info(xero_tenant_id, credit_note_id, allocations, opts = {})
|
1234
1236
|
if @api_client.config.debugging
|
@@ -1251,6 +1253,7 @@ module XeroRuby
|
|
1251
1253
|
|
1252
1254
|
# query parameters
|
1253
1255
|
query_params = opts[:query_params] || {}
|
1256
|
+
query_params[:'summarizeErrors'] = opts[:'summarize_errors'] if !opts[:'summarize_errors'].nil?
|
1254
1257
|
|
1255
1258
|
# header parameters
|
1256
1259
|
header_params = opts[:header_params] || {}
|
@@ -13149,20 +13152,26 @@ module XeroRuby
|
|
13149
13152
|
return data, status_code, headers
|
13150
13153
|
end
|
13151
13154
|
|
13155
|
+
# Allows you to update a single spend or receive money transaction
|
13152
13156
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
13157
|
+
# @param bank_transaction_id [String] Xero generated unique identifier for a bank transaction
|
13153
13158
|
# @param bank_transactions [BankTransactions]
|
13154
13159
|
# @param [Hash] opts the optional parameters
|
13160
|
+
# @option opts [Integer] :unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
|
13155
13161
|
# @return [BankTransactions]
|
13156
|
-
def update_bank_transaction(xero_tenant_id, bank_transactions, opts = {})
|
13157
|
-
data, _status_code, _headers = update_bank_transaction_with_http_info(xero_tenant_id, bank_transactions, opts)
|
13162
|
+
def update_bank_transaction(xero_tenant_id, bank_transaction_id, bank_transactions, opts = {})
|
13163
|
+
data, _status_code, _headers = update_bank_transaction_with_http_info(xero_tenant_id, bank_transaction_id, bank_transactions, opts)
|
13158
13164
|
data
|
13159
13165
|
end
|
13160
13166
|
|
13167
|
+
# Allows you to update a single spend or receive money transaction
|
13161
13168
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
13169
|
+
# @param bank_transaction_id [String] Xero generated unique identifier for a bank transaction
|
13162
13170
|
# @param bank_transactions [BankTransactions]
|
13163
13171
|
# @param [Hash] opts the optional parameters
|
13172
|
+
# @option opts [Integer] :unitdp e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
|
13164
13173
|
# @return [Array<(BankTransactions, Integer, Hash)>] BankTransactions data, response status code and response headers
|
13165
|
-
def update_bank_transaction_with_http_info(xero_tenant_id, bank_transactions, opts = {})
|
13174
|
+
def update_bank_transaction_with_http_info(xero_tenant_id, bank_transaction_id, bank_transactions, opts = {})
|
13166
13175
|
if @api_client.config.debugging
|
13167
13176
|
@api_client.config.logger.debug 'Calling API: AccountingApi.update_bank_transaction ...'
|
13168
13177
|
end
|
@@ -13170,15 +13179,20 @@ module XeroRuby
|
|
13170
13179
|
if @api_client.config.client_side_validation && xero_tenant_id.nil?
|
13171
13180
|
fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.update_bank_transaction"
|
13172
13181
|
end
|
13182
|
+
# verify the required parameter 'bank_transaction_id' is set
|
13183
|
+
if @api_client.config.client_side_validation && bank_transaction_id.nil?
|
13184
|
+
fail ArgumentError, "Missing the required parameter 'bank_transaction_id' when calling AccountingApi.update_bank_transaction"
|
13185
|
+
end
|
13173
13186
|
# verify the required parameter 'bank_transactions' is set
|
13174
13187
|
if @api_client.config.client_side_validation && bank_transactions.nil?
|
13175
13188
|
fail ArgumentError, "Missing the required parameter 'bank_transactions' when calling AccountingApi.update_bank_transaction"
|
13176
13189
|
end
|
13177
13190
|
# resource path
|
13178
|
-
local_var_path = '/BankTransactions/{BankTransactionID}'
|
13191
|
+
local_var_path = '/BankTransactions/{BankTransactionID}'.sub('{' + 'BankTransactionID' + '}', bank_transaction_id.to_s)
|
13179
13192
|
|
13180
13193
|
# query parameters
|
13181
13194
|
query_params = opts[:query_params] || {}
|
13195
|
+
query_params[:'unitdp'] = opts[:'unitdp'] if !opts[:'unitdp'].nil?
|
13182
13196
|
|
13183
13197
|
# header parameters
|
13184
13198
|
header_params = opts[:header_params] || {}
|
data/lib/xero-ruby/api_client.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.2.
|
6
|
+
The version of the OpenAPI document: 2.2.11
|
7
7
|
Contact: api@xero.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 4.3.1
|
@@ -176,6 +176,7 @@ module XeroRuby
|
|
176
176
|
end
|
177
177
|
|
178
178
|
if opts[:return_type]
|
179
|
+
prepare_file(response) if opts[:return_type] == 'File'
|
179
180
|
data = deserialize(response, opts[:return_type])
|
180
181
|
else
|
181
182
|
data = nil
|
@@ -222,7 +223,6 @@ module XeroRuby
|
|
222
223
|
request.body = req_body
|
223
224
|
request.url url
|
224
225
|
request.params = query_params
|
225
|
-
download_file(request) if opts[:return_type] == 'File'
|
226
226
|
request
|
227
227
|
end
|
228
228
|
|
@@ -376,33 +376,24 @@ module XeroRuby
|
|
376
376
|
# process can use.
|
377
377
|
#
|
378
378
|
# @see Configuration#temp_folder_path
|
379
|
-
def
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
prefix = sanitize_filename(filename)
|
387
|
-
else
|
388
|
-
prefix = 'download-'
|
389
|
-
end
|
390
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
391
|
-
encoding = response.body.encoding
|
392
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
393
|
-
@tempfile = tempfile
|
394
|
-
end
|
395
|
-
request.on_body do |chunk|
|
396
|
-
chunk.force_encoding(encoding)
|
397
|
-
tempfile.write(chunk)
|
398
|
-
end
|
399
|
-
request.on_complete do |response|
|
400
|
-
tempfile.close if tempfile
|
401
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
402
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
403
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
404
|
-
"explicitly with `tempfile.delete`"
|
379
|
+
def prepare_file(response)
|
380
|
+
content_disposition = response.headers['Content-Disposition']
|
381
|
+
if content_disposition && content_disposition =~ /filename=/i
|
382
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
383
|
+
prefix = sanitize_filename(filename)
|
384
|
+
else
|
385
|
+
prefix = 'download-'
|
405
386
|
end
|
387
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
388
|
+
encoding = response.body.encoding
|
389
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
390
|
+
@tempfile = tempfile
|
391
|
+
tempfile.write(response.body)
|
392
|
+
tempfile.close if tempfile
|
393
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
394
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
395
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
396
|
+
"explicitly with `tempfile.delete`"
|
406
397
|
end
|
407
398
|
|
408
399
|
# Sanitize filename by removing path.
|
@@ -485,11 +476,55 @@ module XeroRuby
|
|
485
476
|
# @return [String] JSON string representation of the object
|
486
477
|
def object_to_hash(obj)
|
487
478
|
if obj.respond_to?(:to_hash)
|
488
|
-
obj.to_hash
|
479
|
+
to_camel_keys(obj).to_hash
|
480
|
+
else
|
481
|
+
to_camel_keys(obj)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
# START - Re-serializes snake_cased params to PascalCase required by XeroAPI
|
486
|
+
def to_camel_keys(value = self)
|
487
|
+
case value
|
488
|
+
when Array
|
489
|
+
value.map { |v| to_camel_keys(v) }
|
490
|
+
when Hash
|
491
|
+
Hash[value.map { |k, v| [camelize_key(k), to_camel_keys(v)] }]
|
492
|
+
else
|
493
|
+
value
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
def camelize_key(key, first_upper = true)
|
498
|
+
if key.is_a? Symbol
|
499
|
+
camelize(key.to_s, first_upper).to_sym
|
500
|
+
elsif key.is_a? String
|
501
|
+
camelize(key, first_upper)
|
502
|
+
else
|
503
|
+
key # Awrence can't camelize anything except strings and symbols
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
def camelize(snake_word, first_upper = true)
|
508
|
+
if first_upper
|
509
|
+
str = snake_word.to_s
|
510
|
+
str = gsubbed(str, /(?:^|_)([^_\s]+)/)
|
511
|
+
str = gsubbed(str, %r{/([^/]*)}, "::")
|
512
|
+
str
|
489
513
|
else
|
490
|
-
|
514
|
+
parts = snake_word.split("_", 2)
|
515
|
+
parts[0] << camelize(parts[1]) if parts.size > 1
|
516
|
+
parts[0] || ""
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
def gsubbed(str, pattern, extra = "")
|
521
|
+
key_map_scronyms = { "id" => "ID" }
|
522
|
+
str = str.gsub(pattern) do
|
523
|
+
extra + (key_map_scronyms[Regexp.last_match(1)] || Regexp.last_match(1).capitalize)
|
491
524
|
end
|
525
|
+
str
|
492
526
|
end
|
527
|
+
# END - Re-serializes snake_cased params to PascalCase required by XeroAPI
|
493
528
|
|
494
529
|
# Build parameter value according to the given collection format.
|
495
530
|
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
@@ -504,7 +539,7 @@ module XeroRuby
|
|
504
539
|
when :pipes
|
505
540
|
param.join('|')
|
506
541
|
when :multi
|
507
|
-
# return the array directly as
|
542
|
+
# return the array directly as http client will handle it as expected
|
508
543
|
param
|
509
544
|
else
|
510
545
|
fail "unknown collection format: #{collection_format.inspect}"
|