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 +4 -4
- data/README.md +1 -1
- data/lib/xero-ruby/api_client.rb +11 -3
- data/lib/xero-ruby/version.rb +1 -1
- data/spec/api_client_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc8e88d077eb5b42f9a9c8a206ce6c7fb62589e7179932764a70cc28c3f821a
|
4
|
+
data.tar.gz: 8c25945749aaca49892462186f749701255022d05ea498645a3b1e59c10a5e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 [`
|
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
|
data/lib/xero-ruby/api_client.rb
CHANGED
@@ -57,9 +57,17 @@ module XeroRuby
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def authorization_url
|
60
|
-
url =
|
61
|
-
url
|
62
|
-
|
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
|
data/lib/xero-ruby/version.rb
CHANGED
data/spec/api_client_spec.rb
CHANGED
@@ -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
|
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
|
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.
|
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-
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|