Skip to content

Commit

Permalink
Merge pull request #35 from XeroAPI/regen
Browse files Browse the repository at this point in the history
gem publish 1.1.0
  • Loading branch information
SerKnight authored May 18, 2020
2 parents 890a73a + f913996 commit f5cbc6f
Show file tree
Hide file tree
Showing 269 changed files with 462 additions and 289 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# xero-ruby
Xero Ruby SDK for OAuth 2.0 generated from [Xero API OpenAPI Spec](https://github.com/XeroAPI/Xero-OpenAPI)

[![RubyGem](https://img.shields.io/badge/xero--ruby%20gem-v1.0-brightgree)](https://rubygems.org/gems/xero-ruby)
[![RubyGem](https://img.shields.io/badge/xero--ruby%20gem-v0.2.4-brightgreen)](https://rubygems.org/gems/xero-ruby)

## Current release of SDK with OAuth 2.0 support
Xero Ruby SDK supports Xero's OAuth2.0 authentication (token generation & refresh) and supports the following Xero API sets.
Expand Down
84 changes: 76 additions & 8 deletions docs/accounting/AccountingApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ Method | HTTP request | Description
[**get_branding_theme**](AccountingApi.md#get_branding_theme) | **GET** /BrandingThemes/{BrandingThemeID} | Allows you to retrieve a specific BrandingThemes
[**get_branding_theme_payment_services**](AccountingApi.md#get_branding_theme_payment_services) | **GET** /BrandingThemes/{BrandingThemeID}/PaymentServices | Allows you to retrieve the Payment services for a Branding Theme
[**get_branding_themes**](AccountingApi.md#get_branding_themes) | **GET** /BrandingThemes | Allows you to retrieve all the BrandingThemes
[**get_contact**](AccountingApi.md#get_contact) | **GET** /Contacts/{ContactID} | Allows you to retrieve, add and update contacts in a Xero organisation
[**get_contact**](AccountingApi.md#get_contact) | **GET** /Contacts/{ContactID} | Allows you to retrieve a single contacts in a Xero organisation
[**get_contact_attachment_by_file_name**](AccountingApi.md#get_contact_attachment_by_file_name) | **GET** /Contacts/{ContactID}/Attachments/{FileName} | Allows you to retrieve Attachments on Contacts by file name
[**get_contact_attachment_by_id**](AccountingApi.md#get_contact_attachment_by_id) | **GET** /Contacts/{ContactID}/Attachments/{AttachmentID} | Allows you to retrieve Attachments on Contacts
[**get_contact_attachments**](AccountingApi.md#get_contact_attachments) | **GET** /Contacts/{ContactID}/Attachments | Allows you to retrieve, add and update contacts in a Xero organisation
[**get_contact_cis_settings**](AccountingApi.md#get_contact_cis_settings) | **GET** /Contacts/{ContactID}/CISSettings | Allows you to retrieve CISSettings for a contact in a Xero organisation
[**get_contact_group**](AccountingApi.md#get_contact_group) | **GET** /ContactGroups/{ContactGroupID} | Allows you to retrieve a unique Contact Group by ID
[**get_contact_groups**](AccountingApi.md#get_contact_groups) | **GET** /ContactGroups | Allows you to retrieve the ContactID and Name of all the contacts in a contact group
[**get_contact_history**](AccountingApi.md#get_contact_history) | **GET** /Contacts/{ContactID}/History | Allows you to retrieve a history records of an Contact
[**get_contacts**](AccountingApi.md#get_contacts) | **GET** /Contacts | Allows you to retrieve, add and update contacts in a Xero organisation
[**get_contacts**](AccountingApi.md#get_contacts) | **GET** /Contacts | Allows you to retrieve all contacts in a Xero organisation
[**get_credit_note**](AccountingApi.md#get_credit_note) | **GET** /CreditNotes/{CreditNoteID} | Allows you to retrieve a specific credit note
[**get_credit_note_as_pdf**](AccountingApi.md#get_credit_note_as_pdf) | **GET** /CreditNotes/{CreditNoteID}/pdf | Allows you to retrieve Credit Note as PDF files
[**get_credit_note_attachment_by_file_name**](AccountingApi.md#get_credit_note_attachment_by_file_name) | **GET** /CreditNotes/{CreditNoteID}/Attachments/{FileName} | Allows you to retrieve Attachments on CreditNote by file name
Expand Down Expand Up @@ -141,6 +141,7 @@ Method | HTTP request | Description
[**get_payment_services**](AccountingApi.md#get_payment_services) | **GET** /PaymentServices | Allows you to retrieve payment services
[**get_payments**](AccountingApi.md#get_payments) | **GET** /Payments | Allows you to retrieve payments for invoices and credit notes
[**get_prepayment**](AccountingApi.md#get_prepayment) | **GET** /Prepayments/{PrepaymentID} | Allows you to retrieve a specified prepayments
[**get_prepayment_as_pdf**](AccountingApi.md#get_prepayment_as_pdf) | **GET** /Prepayments/{PrepaymentID}/pdf | Allows you to retrieve prepayments as PDF files
[**get_prepayment_history**](AccountingApi.md#get_prepayment_history) | **GET** /Prepayments/{PrepaymentID}/History | Allows you to retrieve a history records of an Prepayment
[**get_prepayments**](AccountingApi.md#get_prepayments) | **GET** /Prepayments | Allows you to retrieve prepayments
[**get_purchase_order**](AccountingApi.md#get_purchase_order) | **GET** /PurchaseOrders/{PurchaseOrderID} | Allows you to retrieve a specified purchase orders
Expand Down Expand Up @@ -2658,7 +2659,7 @@ Name | Type | Description | Notes

## create_payments

> Payments create_payments(xero_tenant_id, payments)
> Payments create_payments(xero_tenant_id, payments, opts)
Allows you to create multiple payments for invoices or credit notes

Expand Down Expand Up @@ -2687,10 +2688,13 @@ api_instance = xero_client.asset_api

xero_tenant_id = 'YOUR_XERO_TENANT_ID' # String | Xero identifier for Tenant
payments = { payments:[ { invoice:{ invoiceID:"00000000-0000-0000-000-000000000000", lineItems:[], contact: {}, type: Invoice.TypeEnum.ACCPAY }, account:{ code:"970" }, date:"2019-03-12", amount:1.0 } ] } # Payments | Payments array with Payment object in body of request
opts = {
summarize_errors: false # Boolean | If false return 200 OK and mix of successfully created obejcts and any with validation errors
}

begin
#Allows you to create multiple payments for invoices or credit notes
result = api_instance.create_payments(xero_tenant_id, payments)
result = api_instance.create_payments(xero_tenant_id, payments, opts)
p result
rescue XeroRuby::Accounting::ApiError => e
puts "Exception when calling AccountingApi->create_payments: #{e}"
Expand All @@ -2704,6 +2708,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xero_tenant_id** | **String**| Xero identifier for Tenant |
**payments** | [**Payments**](Payments.md)| Payments array with Payment object in body of request |
**summarize_errors** | **Boolean**| If false return 200 OK and mix of successfully created obejcts and any with validation errors | [optional] [default to false]

### Return type

Expand Down Expand Up @@ -5720,7 +5725,7 @@ Name | Type | Description | Notes

> Contacts get_contact(xero_tenant_id, contact_id)
Allows you to retrieve, add and update contacts in a Xero organisation
Allows you to retrieve a single contacts in a Xero organisation

### Example

Expand Down Expand Up @@ -5749,7 +5754,7 @@ xero_tenant_id = 'YOUR_XERO_TENANT_ID' # String | Xero identifier for Tenant
contact_id = '00000000-0000-0000-000-000000000000' # String | Unique identifier for a Contact

begin
#Allows you to retrieve, add and update contacts in a Xero organisation
#Allows you to retrieve a single contacts in a Xero organisation
result = api_instance.get_contact(xero_tenant_id, contact_id)
p result
rescue XeroRuby::Accounting::ApiError => e
Expand Down Expand Up @@ -6236,7 +6241,7 @@ Name | Type | Description | Notes

> Contacts get_contacts(xero_tenant_id, opts)
Allows you to retrieve, add and update contacts in a Xero organisation
Allows you to retrieve all contacts in a Xero organisation

### Example

Expand Down Expand Up @@ -6272,7 +6277,7 @@ opts = {
}

begin
#Allows you to retrieve, add and update contacts in a Xero organisation
#Allows you to retrieve all contacts in a Xero organisation
result = api_instance.get_contacts(xero_tenant_id, opts)
p result
rescue XeroRuby::Accounting::ApiError => e
Expand Down Expand Up @@ -9207,6 +9212,69 @@ Name | Type | Description | Notes
- **Accept**: application/json


## get_prepayment_as_pdf

> File get_prepayment_as_pdf(xero_tenant_id, prepayment_id)
Allows you to retrieve prepayments as PDF files

### Example

```ruby
# load the gem
require 'xero-ruby'

creds = {
client_id: ENV['CLIENT_ID'],
client_secret: ENV['CLIENT_SECRET'],
redirect_uri: ENV['REDIRECT_URI'],
scopes: ENV['SCOPES']
}
xero_client = XeroRuby::ApiClient.new(credentials: creds)

token_set = fetch_valid_token_set(user) # example

xero_client.refresh_token_set(token_set)

# If using the Accounting API
api_instance = xero_client.accounting_api
# Or for methods in the Assets API
api_instance = xero_client.asset_api

xero_tenant_id = 'YOUR_XERO_TENANT_ID' # String | Xero identifier for Tenant
prepayment_id = '00000000-0000-0000-000-000000000000' # String | Unique identifier for a PrePayment

begin
#Allows you to retrieve prepayments as PDF files
result = api_instance.get_prepayment_as_pdf(xero_tenant_id, prepayment_id)
p result
rescue XeroRuby::Accounting::ApiError => e
puts "Exception when calling AccountingApi->get_prepayment_as_pdf: #{e}"
end
```

### Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**xero_tenant_id** | **String**| Xero identifier for Tenant |
**prepayment_id** | [**String**](.md)| Unique identifier for a PrePayment |

### Return type

**File**

### Authorization

[OAuth2](../README.md#OAuth2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/pdf


## get_prepayment_history

> HistoryRecords get_prepayment_history(xero_tenant_id, prepayment_id)
Expand Down
2 changes: 1 addition & 1 deletion docs/accounting/Journal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**journal_id** | **String** | Xero identifier | [optional]
**journal_date** | **Date** | Date the journal was posted | [optional]
**journal_number** | **String** | Xero generated journal number | [optional]
**journal_number** | **Integer** | Xero generated journal number | [optional]
**created_date_utc** | **DateTime** | Created date UTC format | [optional]
**reference** | **String** | reference field for additional indetifying information | [optional]
**source_id** | **String** | The identifier for the source transaction (e.g. InvoiceID) | [optional]
Expand Down
2 changes: 2 additions & 0 deletions docs/accounting/Payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Name | Type | Description | Notes
**details** | **String** | The information to appear on the supplier's bank account | [optional]
**has_account** | **Boolean** | A boolean to indicate if a contact has an validation errors | [optional]
**has_validation_errors** | **Boolean** | A boolean to indicate if a contact has an validation errors | [optional]
**status_attribute_string** | **String** | A string to indicate if a invoice status | [optional]
**validation_errors** | [**Array<ValidationError>**](ValidationError.md) | Displays array of validation error messages from the API | [optional]

## Code Sample
Expand Down Expand Up @@ -55,6 +56,7 @@ instance = XeroRuby::Accounting::Payment.new(invoice: null,
details: null,
has_account: null,
has_validation_errors: null,
status_attribute_string: null,
validation_errors: null)
```

Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
80 changes: 75 additions & 5 deletions lib/xero-ruby/api/accounting_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down Expand Up @@ -2781,6 +2781,7 @@ def create_payment_service_with_http_info(xero_tenant_id, payment_services, opts
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param payments [Payments] Payments array with Payment object in body of request
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created obejcts and any with validation errors (default to false)
# @return [Payments]
def create_payments(xero_tenant_id, payments, opts = {})
data, _status_code, _headers = create_payments_with_http_info(xero_tenant_id, payments, opts)
Expand All @@ -2791,6 +2792,7 @@ def create_payments(xero_tenant_id, payments, opts = {})
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param payments [Payments] Payments array with Payment object in body of request
# @param [Hash] opts the optional parameters
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created obejcts and any with validation errors
# @return [Array<(Payments, Integer, Hash)>] Payments data, response status code and response headers
def create_payments_with_http_info(xero_tenant_id, payments, opts = {})
if @api_client.config.debugging
Expand All @@ -2809,6 +2811,7 @@ def create_payments_with_http_info(xero_tenant_id, payments, opts = {})

# query parameters
query_params = opts[:query_params] || {}
query_params[:'summarizeErrors'] = opts[:'summarize_errors'] if !opts[:'summarize_errors'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand Down Expand Up @@ -6167,7 +6170,7 @@ def get_branding_themes_with_http_info(xero_tenant_id, opts = {})
return data, status_code, headers
end

# Allows you to retrieve, add and update contacts in a Xero organisation
# Allows you to retrieve a single contacts in a Xero organisation
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param contact_id [String] Unique identifier for a Contact
# @param [Hash] opts the optional parameters
Expand All @@ -6177,7 +6180,7 @@ def get_contact(xero_tenant_id, contact_id, opts = {})
data
end

# Allows you to retrieve, add and update contacts in a Xero organisation
# Allows you to retrieve a single contacts in a Xero organisation
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param contact_id [String] Unique identifier for a Contact
# @param [Hash] opts the optional parameters
Expand Down Expand Up @@ -6729,7 +6732,7 @@ def get_contact_history_with_http_info(xero_tenant_id, contact_id, opts = {})
return data, status_code, headers
end

# Allows you to retrieve, add and update contacts in a Xero organisation
# Allows you to retrieve all contacts in a Xero organisation
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :if_modified_since Only records created or modified since this timestamp will be returned
Expand All @@ -6744,7 +6747,7 @@ def get_contacts(xero_tenant_id, opts = {})
data
end

# Allows you to retrieve, add and update contacts in a Xero organisation
# Allows you to retrieve all contacts in a Xero organisation
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param [Hash] opts the optional parameters
# @option opts [DateTime] :if_modified_since Only records created or modified since this timestamp will be returned
Expand Down Expand Up @@ -9906,6 +9909,73 @@ def get_prepayment_with_http_info(xero_tenant_id, prepayment_id, opts = {})
return data, status_code, headers
end

# Allows you to retrieve prepayments as PDF files
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param prepayment_id [String] Unique identifier for a PrePayment
# @param [Hash] opts the optional parameters
# @return [File]
def get_prepayment_as_pdf(xero_tenant_id, prepayment_id, opts = {})
data, _status_code, _headers = get_prepayment_as_pdf_with_http_info(xero_tenant_id, prepayment_id, opts)
data
end

# Allows you to retrieve prepayments as PDF files
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param prepayment_id [String] Unique identifier for a PrePayment
# @param [Hash] opts the optional parameters
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
def get_prepayment_as_pdf_with_http_info(xero_tenant_id, prepayment_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountingApi.get_prepayment_as_pdf ...'
end
# verify the required parameter 'xero_tenant_id' is set
if @api_client.config.client_side_validation && xero_tenant_id.nil?
fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_prepayment_as_pdf"
end
# verify the required parameter 'prepayment_id' is set
if @api_client.config.client_side_validation && prepayment_id.nil?
fail ArgumentError, "Missing the required parameter 'prepayment_id' when calling AccountingApi.get_prepayment_as_pdf"
end
# resource path
local_var_path = '/Prepayments/{PrepaymentID}'.sub('{' + 'PrepaymentID' + '}', prepayment_id.to_s)

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/pdf'])
header_params[:'xero-tenant-id'] = xero_tenant_id

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:body]

# return_type
return_type = opts[:return_type] || 'File'

# auth_names
auth_names = opts[:auth_names] || ['OAuth2']

new_options = opts.merge(
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)

data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AccountingApi#get_prepayment_as_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Allows you to retrieve a history records of an Prepayment
# @param xero_tenant_id [String] Xero identifier for Tenant
# @param prepayment_id [String] Unique identifier for a PrePayment
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/api/asset_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#This is the Xero Assets API
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/api_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/xero-ruby/models/accounting/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.0
The version of the OpenAPI document: 2.1.3
Contact: [email protected]
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
Expand Down
Loading

0 comments on commit f5cbc6f

Please sign in to comment.