kong 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/kong/api.rb +1 -1
- data/lib/kong/consumer.rb +5 -5
- data/lib/kong/version.rb +1 -1
- data/spec/kong/api_spec.rb +1 -1
- data/spec/kong/consumer_spec.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95334acf2c86b53ea81f8610d85d197d855a3b54
|
4
|
+
data.tar.gz: 17f5d4da04aedc931e04dd2a0284ab43013d95e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4fea022884e86468b3157289be49f8f4e3b385edc7b56c598c78ddd01033131fa12d621685ada23a79e02db2089c6fff9505d7809710ebe5837a493d82f29bf
|
7
|
+
data.tar.gz: 0115c5d8cb83547a9ca185f304fae74442f94b73efc098792f27c8792edc825fbe0746f0fbab78df5d123af603e9fbbbbb48b37d3ff39bccf034ff6ec5c57db3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# 0.3.1 (2017-10-02)
|
2
|
+
- Use consumer id to retrieve auth keys and tokens ([#19](https://github.com/kontena/kong-client-ruby/pull/19))
|
3
|
+
- Add methods to kong api base attributes ([#21](https://github.com/kontena/kong-client-ruby/pull/21))
|
1
4
|
# 0.3.0 (2017-07-31)
|
2
5
|
- Add support for Upstream and Target resources ([#15](https://github.com/kontena/kong-client-ruby/pull/15))
|
3
6
|
|
data/README.md
CHANGED
data/lib/kong/api.rb
CHANGED
@@ -6,7 +6,7 @@ module Kong
|
|
6
6
|
id name request_host request_path strip_request_path
|
7
7
|
hosts uris strip_uri preserve_host upstream_url retries
|
8
8
|
upstream_connect_timeout upstream_send_timeout upstream_read_timeout
|
9
|
-
https_only http_if_terminated
|
9
|
+
https_only http_if_terminated methods
|
10
10
|
).freeze
|
11
11
|
API_END_POINT = '/apis/'.freeze
|
12
12
|
|
data/lib/kong/consumer.rb
CHANGED
@@ -24,7 +24,7 @@ module Kong
|
|
24
24
|
# @return [Array<Kong::OAuthApp>]
|
25
25
|
def oauth_apps
|
26
26
|
apps = []
|
27
|
-
response = client.get("#{@api_end_point}#{self.
|
27
|
+
response = client.get("#{@api_end_point}#{self.id}/oauth2") rescue nil
|
28
28
|
if response
|
29
29
|
response['data'].each do |attributes|
|
30
30
|
apps << Kong::OAuthApp.new(attributes)
|
@@ -38,7 +38,7 @@ module Kong
|
|
38
38
|
# @return [Array<Kong::KeyAuth]
|
39
39
|
def basic_auths
|
40
40
|
apps = []
|
41
|
-
response = client.get("#{@api_end_point}#{self.
|
41
|
+
response = client.get("#{@api_end_point}#{self.id}/basic-auth") rescue nil
|
42
42
|
if response
|
43
43
|
response['data'].each do |attributes|
|
44
44
|
apps << Kong::BasicAuth.new(attributes)
|
@@ -52,7 +52,7 @@ module Kong
|
|
52
52
|
# @return [Array<Kong::KeyAuth]
|
53
53
|
def key_auths
|
54
54
|
apps = []
|
55
|
-
response = client.get("#{@api_end_point}#{self.
|
55
|
+
response = client.get("#{@api_end_point}#{self.id}/key-auth") rescue nil
|
56
56
|
if response
|
57
57
|
response['data'].each do |attributes|
|
58
58
|
apps << Kong::KeyAuth.new(attributes)
|
@@ -77,7 +77,7 @@ module Kong
|
|
77
77
|
# @return [Array<Kong::Acl>]
|
78
78
|
def acls
|
79
79
|
acls = []
|
80
|
-
response = client.get("#{@api_end_point}#{self.
|
80
|
+
response = client.get("#{@api_end_point}#{self.id}/acls") rescue nil
|
81
81
|
if response
|
82
82
|
response['data'].each do |attributes|
|
83
83
|
acls << Kong::Acl.new(attributes)
|
@@ -91,7 +91,7 @@ module Kong
|
|
91
91
|
# @return [Array<Kong::JWT>]
|
92
92
|
def jwts
|
93
93
|
apps = []
|
94
|
-
response = client.get("#{@api_end_point}#{self.
|
94
|
+
response = client.get("#{@api_end_point}#{self.id}/jwt") rescue nil
|
95
95
|
if response
|
96
96
|
response['data'].each do |attributes|
|
97
97
|
apps << Kong::JWT.new(attributes)
|
data/lib/kong/version.rb
CHANGED
data/spec/kong/api_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Kong::Api do
|
|
6
6
|
id name request_host request_path strip_request_path
|
7
7
|
hosts uris strip_uri preserve_host upstream_url retries
|
8
8
|
upstream_connect_timeout upstream_send_timeout upstream_read_timeout
|
9
|
-
https_only http_if_terminated
|
9
|
+
https_only http_if_terminated methods
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|
data/spec/kong/consumer_spec.rb
CHANGED
@@ -19,15 +19,15 @@ describe Kong::Consumer do
|
|
19
19
|
|
20
20
|
describe '#oauth_apps' do
|
21
21
|
it 'requests consumer\'s oauth_apps' do
|
22
|
-
subject.
|
23
|
-
expect(Kong::Client.instance).to receive(:get).with("/consumers/:
|
22
|
+
subject.id = ':id'
|
23
|
+
expect(Kong::Client.instance).to receive(:get).with("/consumers/:id/oauth2")
|
24
24
|
.and_return({ 'data' => [{ 'id' => '123456', 'name' => 'my app' }] })
|
25
25
|
subject.oauth_apps
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns list of OAuthApp' do
|
29
|
-
subject.
|
30
|
-
allow(Kong::Client.instance).to receive(:get).with("/consumers/:
|
29
|
+
subject.id = ':id'
|
30
|
+
allow(Kong::Client.instance).to receive(:get).with("/consumers/:id/oauth2")
|
31
31
|
.and_return({ 'data' => [{ 'id' => '123456', 'name' => 'my app' }] })
|
32
32
|
result = subject.oauth_apps
|
33
33
|
expect(result.first.is_a?(Kong::OAuthApp)).to be_truthy
|
@@ -55,15 +55,15 @@ describe Kong::Consumer do
|
|
55
55
|
|
56
56
|
describe '#acls' do
|
57
57
|
it 'requests consumer\'s acls' do
|
58
|
-
subject.
|
59
|
-
expect(Kong::Client.instance).to receive(:get).with("/consumers/:
|
58
|
+
subject.id = ':id'
|
59
|
+
expect(Kong::Client.instance).to receive(:get).with("/consumers/:id/acls")
|
60
60
|
.and_return({ 'data' => [{ 'id' => '123456', 'group' => 'group1' }] })
|
61
61
|
subject.acls
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'returns list of Acls' do
|
65
|
-
subject.
|
66
|
-
allow(Kong::Client.instance).to receive(:get).with("/consumers/:
|
65
|
+
subject.id = ':id'
|
66
|
+
allow(Kong::Client.instance).to receive(:get).with("/consumers/:id/acls")
|
67
67
|
.and_return({ 'data' => [{ 'id' => '123456', 'group' => 'group1' }] })
|
68
68
|
result = subject.acls
|
69
69
|
expect(result.first.is_a?(Kong::Acl)).to be_truthy
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lauri Nevala
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|