Skip to content

Commit

Permalink
fix the thread safe issues. seemingly no breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SerKnight committed Apr 19, 2021
1 parent 7b83775 commit 9f8f356
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 32 deletions.
10 changes: 7 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
xero-ruby (2.9.0)
xero-ruby (2.9.1)
faraday (~> 1.0, >= 1.0.1)
json (~> 2.1, >= 2.1.0)

Expand All @@ -12,11 +12,15 @@ GEM
byebug (11.1.3)
coderay (1.1.3)
diff-lcs (1.4.4)
faraday (1.3.0)
faraday (1.4.1)
faraday-excon (~> 1.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ruby2_keywords (>= 0.0.4)
faraday-excon (1.1.0)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0)
jaro_winkler (1.5.4)
json (2.5.1)
method_source (1.0.0)
Expand Down
2 changes: 1 addition & 1 deletion docs/accounting/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5795,7 +5795,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/files/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/payroll_au/DeductionLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**deduction_type_id** | **String** | Xero deduction type identifier |
**calculation_type** | [**DeductionTypeCalculationType**](DeductionTypeCalculationType.md) | |
**calculation_type** | [**DeductionTypeCalculationType**](DeductionTypeCalculationType.md) | | [optional]
**amount** | **BigDecimal** | Deduction type amount | [optional]
**percentage** | **BigDecimal** | The Percentage of the Deduction | [optional]
**number_of_units** | **BigDecimal** | Deduction number of units | [optional]
Expand Down
4 changes: 2 additions & 2 deletions docs/payroll_au/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@
};
defs["DeductionLine"] = {
"title" : "",
"required" : [ "CalculationType", "DeductionTypeID" ],
"required" : [ "DeductionTypeID" ],
"type" : "object",
"properties" : {
"DeductionTypeID" : {
Expand Down Expand Up @@ -3207,7 +3207,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/payroll_nz/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3812,7 +3812,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/payroll_uk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3480,7 +3480,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
2 changes: 1 addition & 1 deletion docs/projects/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@
} else if (location.includes('php')){
sdkLang = 'php'
sdkName = 'xero-php-oauth2'
} else if (location.includes('dotnet')){
} else if (location.includes('xero-netstandard') || location.includes('csharp')){
sdkLang = 'dotnet'
sdkName = 'Xero-NetStandard'
} else if (location.includes('java')){
Expand Down
6 changes: 0 additions & 6 deletions lib/xero-ruby/api/accounting_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7730,9 +7730,6 @@ def get_contact_history_with_http_info(xero_tenant_id, contact_id, options = {})
# @option opts [Boolean] :include_archived e.g. includeArchived&#x3D;true - Contacts with a status of ARCHIVED will be included in the response
# @return [Contacts]
def get_contacts(xero_tenant_id, opts = {})
puts "\n\n\n"
puts "*****************************"
puts "opts #{opts}"
data, _status_code, _headers = get_contacts_with_http_info(xero_tenant_id, opts)
data
end
Expand All @@ -7749,9 +7746,6 @@ def get_contacts(xero_tenant_id, opts = {})
# @return [Array<(Contacts, Integer, Hash)>] Contacts data, response status code and response headers
def get_contacts_with_http_info(xero_tenant_id, options = {})
opts = options.dup

puts "opts == options ?"
puts "#{opts} == #{options} ?"
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: AccountingApi.get_contacts ...'
end
Expand Down
21 changes: 20 additions & 1 deletion lib/xero-ruby/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,26 @@ def call_api(http_method, path, api_client, opts = {})
:client_key => @config.ssl_client_key
}

connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
case api_client
when "AccountingApi"
method_base_url = @config.accounting_url
when "AssetApi"
method_base_url = @config.asset_url
when "FilesApi"
method_base_url = @config.files_url
when "PayrollAuApi"
method_base_url = @config.payroll_au_url
when "PayrollNzApi"
method_base_url = @config.payroll_nz_url
when "PayrollUkApi"
method_base_url = @config.payroll_uk_url
when "ProjectApi"
method_base_url = @config.project_url
else
method_base_url = @config.accounting_url
end

connection = Faraday.new(:url => method_base_url, :ssl => ssl_options) do |conn|
conn.basic_auth(config.username, config.password)
if opts[:header_params]["Content-Type"] == "multipart/form-data"
conn.request :multipart
Expand Down
4 changes: 3 additions & 1 deletion lib/xero-ruby/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class Configuration
# @return [String]
attr_accessor :password

# Defines the access token (Bearer) used with OAuth2.
# Defines the access token (Bearer) used with OAuth2 authorization
attr_accessor :access_token

# Defines OpenID Connect id_token containing Xero user authentication detail
attr_accessor :id_token

# Defines the token set used with OAuth2. May include id/access/refresh token & other meta info.
Expand Down
5 changes: 0 additions & 5 deletions lib/xero-ruby/models/payroll_au/deduction_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,13 @@ def list_invalid_properties
invalid_properties.push('invalid value for "deduction_type_id", deduction_type_id cannot be nil.')
end

if @calculation_type.nil?
invalid_properties.push('invalid value for "calculation_type", calculation_type cannot be nil.')
end

invalid_properties
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @deduction_type_id.nil?
return false if @calculation_type.nil?
true
end

Expand Down
4 changes: 2 additions & 2 deletions lib/xero-ruby/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1

The version of the XeroOpenAPI document: 2.10.4
The version of the XeroOpenAPI document: 2.10.5
=end

module XeroRuby
VERSION = '2.9.0'
VERSION = '2.9.1'
end
14 changes: 9 additions & 5 deletions spec/api_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@
expect(api_client_1.id_token).to eq(nil)
expect(api_client_2.id_token).to eq(nil)

api_client_1.set_id_token("ACCESS_TOKEN_1")
expect(api_client_1.id_token).to eq("ACCESS_TOKEN_1")
api_client_1.set_id_token("id_token_1")
expect(api_client_1.id_token).to eq("id_token_1")
expect(api_client_2.id_token).to eq(nil)

api_client_2.set_id_token("ACCESS_TOKEN_2")
expect(api_client_1.id_token).to eq("ACCESS_TOKEN_1")
expect(api_client_2.id_token).to eq("ACCESS_TOKEN_2")
api_client_2.set_id_token("id_token_2")
expect(api_client_1.id_token).to eq("id_token_1")
expect(api_client_2.id_token).to eq("id_token_2")
end

it 'applies to #set_token_set' do
Expand All @@ -445,6 +445,10 @@
api_client_2.files_api
expect(api_client_1.config.base_url).to eq(api_client_1.config.accounting_url)
expect(api_client_2.config.base_url).to eq(api_client_1.config.files_url)

api_client_2.project_api
expect(api_client_1.config.base_url).to eq(api_client_1.config.accounting_url)
expect(api_client_2.config.base_url).to eq(api_client_1.config.project_url)
end
end
end
Expand Down

0 comments on commit 9f8f356

Please sign in to comment.