diff --git a/Gemfile.lock b/Gemfile.lock index 8192da95..f5871234 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - xero-ruby (2.10.0) + xero-ruby (3.0.0) faraday (~> 1.0, >= 1.0.1) json (~> 2.1, >= 2.1.0) json-jwt (~> 1.5, >= 1.5.2) @@ -9,12 +9,12 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (6.0.3.4) + activesupport (6.1.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) aes_key_wrap (1.1.0) ast (2.4.1) bindata (2.4.9) @@ -31,7 +31,7 @@ GEM faraday-excon (1.1.0) faraday-net_http (1.0.1) faraday-net_http_persistent (1.1.0) - i18n (1.8.7) + i18n (1.8.10) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) json (2.5.1) @@ -40,7 +40,7 @@ GEM aes_key_wrap bindata method_source (1.0.0) - minitest (5.14.3) + minitest (5.14.4) multipart-post (2.1.1) parallel (1.20.1) parser (2.7.2.0) @@ -77,9 +77,8 @@ GEM unicode-display_width (>= 1.4.0, < 1.6) ruby-progressbar (1.10.1) ruby2_keywords (0.0.4) - thread_safe (0.3.6) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unicode-display_width (1.5.0) zeitwerk (2.4.2) diff --git a/README.md b/README.md index 0c7e258b..4a0ea6d7 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,6 @@ We have two sample apps showing SDK usage: * Login to your Xero developer [/myapps](https://developer.xero.com/myapps) dashboard & create an API application * Copy the credentials from your API app and store/access them using a secure ENV variable strategy * Resaearch and include the [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) for your app's functionality as a space-seperated list, ex. "`SCOPES="openid profile email accounting.transactions accounting.settings"`" - - - ## Installation To install this gem to your project: ``` @@ -115,10 +112,10 @@ Both the `id_token` & `access_token` are JWT's, and can be decoded to see additi After the initial user interaction you can simply setup a xero_client by passing the whole token_set to the client. ```ruby xero_client.set_token_set(user.token_set) -# or set it and refresh in same go + xero_client.refresh_token_set(user.token_set) ``` -This sets the access_token on the client returns either the existing, or newly refreshed `token_set`. You should save in your database for the next time you need to connect to Xero's AP and repeat the process. Assuming you keep your connection live at least once per 60 days, you can persist infinite API connection assuming the user does not revoke your API access. +This sets the access_token on the client, and returns a refreshed `token_set` that you should save in your datastore for the next time you need to connect to Xero's API. ## Token Helpers ```ruby xero_client.token_set @@ -228,10 +225,13 @@ accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts invoices = { invoices: [{ type: XeroRuby::Accounting::Invoice::ACCREC, contact: { contact_id: contacts[0].contact_id }, line_items: [{ description: "Big Agency", quantity: BigDecimal("2.0"), unit_amount: BigDecimal("50.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 }]} invoice = xero_client.accounting_api.create_invoices(tenant_id, invoices).invoices.first -# display out all the serialized data as a hash +# display out all the serialized data as a snake_case hash puts invoices.to_attributes => {type: 'ACCREC', line_items: [...]} +puts invoices.to_hash(downcase: false) +=> {'Type': 'ACCREC', 'LineItems': [...]} + # Create History payment = xero_client.accounting_api.get_payments(tenant_id).payments.first history_records = { history_records: [{ details: "This payment now has some History!" }]} diff --git a/docs/accounting/AccountingApi.md b/docs/accounting/AccountingApi.md index fbcfa74b..e1ccf660 100644 --- a/docs/accounting/AccountingApi.md +++ b/docs/accounting/AccountingApi.md @@ -6625,7 +6625,7 @@ opts = { include_archived: true, # Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response - summary_only: false # Boolean | Use summaryOnly=true in GET Contacts endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. + summary_only: false # Boolean | Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. } begin @@ -6649,7 +6649,7 @@ Name | Type | Description | Notes **i_ds** | [**Array<String>**](String.md)| Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. | [optional] **page** | **Integer**| e.g. page=1 - Up to 100 contacts will be returned in a single API call. | [optional] **include_archived** | **Boolean**| e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response | [optional] - **summary_only** | **Boolean**| Use summaryOnly=true in GET Contacts endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. | [optional] [default to false] + **summary_only** | **Boolean**| Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. | [optional] [default to false] ### Return type @@ -8061,6 +8061,8 @@ opts = { created_by_my_app: false, # Boolean | When set to true you'll only retrieve Invoices created by your app + summary_only: false, # Boolean | Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. + unitdp: 4 # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts } @@ -8089,6 +8091,7 @@ Name | Type | Description | Notes **page** | **Integer**| e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice | [optional] **include_archived** | **Boolean**| e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response | [optional] **created_by_my_app** | **Boolean**| When set to true you'll only retrieve Invoices created by your app | [optional] + **summary_only** | **Boolean**| Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient. | [optional] [default to false] **unitdp** | **Integer**| e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts | [optional] ### Return type diff --git a/docs/accounting/Prepayment.md b/docs/accounting/Prepayment.md index 76ee08be..e6bf1c69 100644 --- a/docs/accounting/Prepayment.md +++ b/docs/accounting/Prepayment.md @@ -20,6 +20,7 @@ Name | Type | Description | Notes **currency_rate** | **BigDecimal** | The currency rate for a multicurrency prepayment. If no rate is specified, the XE.com day rate is used | [optional] **remaining_credit** | **BigDecimal** | The remaining credit balance on the prepayment | [optional] **allocations** | [**Array<Allocation>**](Allocation.md) | See Allocations | [optional] +**payments** | [**Array<Payment>**](Payment.md) | See Payments | [optional] **applied_amount** | **Float** | The amount of applied to an invoice | [optional] **has_attachments** | **Boolean** | boolean to indicate if a prepayment has an attachment | [optional] [default to false] **attachments** | [**Array<Attachment>**](Attachment.md) | See Attachments | [optional] @@ -45,6 +46,7 @@ instance = XeroRuby::Accounting::Prepayment.new(type: null, currency_rate: null, remaining_credit: null, allocations: null, + payments: null, applied_amount: 2.0, has_attachments: false, attachments: null) diff --git a/docs/accounting/index.html b/docs/accounting/index.html index 5398fda8..0d0a8ea0 100644 --- a/docs/accounting/index.html +++ b/docs/accounting/index.html @@ -4372,6 +4372,13 @@ "$ref" : "#/components/schemas/Allocation" } }, + "Payments" : { + "type" : "array", + "description" : "See Payments", + "items" : { + "$ref" : "#/components/schemas/Payment" + } + }, "AppliedAmount" : { "type" : "number", "description" : "The amount of applied to an invoice", @@ -5818,7 +5825,7 @@