xero-ruby 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4faab59f0f75f9a905fac48b7ee80cfbf6414d44ceb49c16db0b5ac192471198
4
- data.tar.gz: 6bbbff00712fd9bf777671e4d13162eafbe29c49fc18c6d880207f547e2f8b06
3
+ metadata.gz: fcc8e88d077eb5b42f9a9c8a206ce6c7fb62589e7179932764a70cc28c3f821a
4
+ data.tar.gz: 8c25945749aaca49892462186f749701255022d05ea498645a3b1e59c10a5e52
5
5
  SHA512:
6
- metadata.gz: efdf971ecd85feb2bbfcc2275de9152f44849be576da7ef062d05003f0888511e043b8aa0d8d83feb7c05195937dafc8d06d3de18b739a18d737ee51089bfbf9
7
- data.tar.gz: 586107ae9a1c2593e7b729ae4624bb47adbc9d835d86245c0c32b55b0504f5e62e41dd07c0fd45479f79591e099dcd03605b355777cd3e63c34e2e356ca65e22
6
+ metadata.gz: 4196ec14ceaa6179bbbedb856b447e7af947ba96e4af24ab8130835af5660a8e6787fbf3261c3f6c5c605d0f81436559bd37e1e0a7252bab42feb752f4634d31
7
+ data.tar.gz: c99e89b1f45563b72023ad5d5ceb3632fe5661068ad5ee89d672194fca72ddccbb1967d9f9796098d12ff9b649f03dfa5b26d3eb08b3daf756bef0e3a7f3fe5f
data/README.md CHANGED
@@ -132,7 +132,7 @@ Example Token Set JSON:
132
132
  ---
133
133
  ## Custom Connections
134
134
 
135
- Custom Connections are a Xero [premium option](https://developer.xero.com/documentation/oauth2/custom-connections) used for building M2M integrations to a single organisation. A custom connection uses OAuth2.0's [`client_credentis`](https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/) grant which eliminates the step of exchanging the temporary code for a token set.
135
+ Custom Connections are a Xero [premium option](https://developer.xero.com/documentation/oauth2/custom-connections) used for building M2M integrations to a single organisation. A custom connection uses OAuth2.0's [`client_credentials`](https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/) grant which eliminates the step of exchanging the temporary code for a token set.
136
136
 
137
137
  To use this SDK with a Custom Connections:
138
138
  ```ruby
@@ -57,9 +57,17 @@ module XeroRuby
57
57
  end
58
58
 
59
59
  def authorization_url
60
- url = "#{@config.login_url}?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{CGI.escape(@scopes)}"
61
- url << "&state=#{@state}" if @state
62
- return url
60
+ url = URI.parse @config.login_url
61
+ url.query = URI.encode_www_form(
62
+ {
63
+ response_type: 'code',
64
+ client_id: @client_id,
65
+ redirect_uri: @redirect_uri,
66
+ scope: @scopes,
67
+ state: @state
68
+ }.compact
69
+ )
70
+ url.to_s
63
71
  end
64
72
 
65
73
  def accounting_api
@@ -11,5 +11,5 @@ The version of the XeroOpenAPI document: 2.13.2
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '3.2.0'
14
+ VERSION = '3.2.1'
15
15
  end
@@ -47,7 +47,7 @@ describe XeroRuby::ApiClient do
47
47
  state: 'i-am-customer-state'
48
48
  }
49
49
  api_client = XeroRuby::ApiClient.new(credentials: creds)
50
- expect(api_client.authorization_url).to eq('https://login.xero.com/identity/connect/authorize?response_type=code&client_id=abc&redirect_uri=https://mydomain.com/callback&scope=openid+profile+email+accounting.transactions+accounting.settings&state=i-am-customer-state')
50
+ expect(api_client.authorization_url).to eq('https://login.xero.com/identity/connect/authorize?response_type=code&client_id=abc&redirect_uri=https%3A%2F%2Fmydomain.com%2Fcallback&scope=openid+profile+email+accounting.transactions+accounting.settings&state=i-am-customer-state')
51
51
  end
52
52
 
53
53
  it "Does not append state if it is not provided" do
@@ -58,7 +58,7 @@ describe XeroRuby::ApiClient do
58
58
  scopes: 'openid profile email accounting.transactions accounting.settings'
59
59
  }
60
60
  api_client = XeroRuby::ApiClient.new(credentials: creds)
61
- expect(api_client.authorization_url).to eq('https://login.xero.com/identity/connect/authorize?response_type=code&client_id=abc&redirect_uri=https://mydomain.com/callback&scope=openid+profile+email+accounting.transactions+accounting.settings')
61
+ expect(api_client.authorization_url).to eq('https://login.xero.com/identity/connect/authorize?response_type=code&client_id=abc&redirect_uri=https%3A%2F%2Fmydomain.com%2Fcallback&scope=openid+profile+email+accounting.transactions+accounting.settings')
62
62
  end
63
63
 
64
64
  it "Validates state on callback matches @config.state" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xero-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xero API Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-02 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday