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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65344f942e47dd8c8607a2c59df13230abeff63d
4
- data.tar.gz: b0e5d1f544da750dc29e73fe64162185e87435e3
3
+ metadata.gz: 95334acf2c86b53ea81f8610d85d197d855a3b54
4
+ data.tar.gz: 17f5d4da04aedc931e04dd2a0284ab43013d95e3
5
5
  SHA512:
6
- metadata.gz: e0e3bb31a1d6b3236e56f449f6ee98cd05492081dcf5504a7b3715ec72cfe24d5b0da360a07925ec5bd5befdbf6af2826bffd4fc913159024bbd6a2e2f691ac8
7
- data.tar.gz: b51843df1c0d1962d7db7928cb042a286a3d6ad897a658341c59e9f0bb605e38283e06d10626a5fadcaa989ddaae4e121f5c01485d00fc05a247a546f5dea588
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
@@ -132,7 +132,7 @@ plugin.delete
132
132
 
133
133
  #### Upstream and Targets (for load-balanced APIs)
134
134
 
135
- ```
135
+ ```ruby
136
136
  Kong::Upstream.list(filters)
137
137
  Kong::Upstream.all()
138
138
  Kong::Upstream.find(id)
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.username}/oauth2") rescue nil
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.username}/basic-auth") rescue nil
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.username}/key-auth") rescue nil
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.username}/acls") rescue nil
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.username}/jwt") rescue nil
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
@@ -1,3 +1,3 @@
1
1
  module Kong
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
@@ -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
 
@@ -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.username = ':username'
23
- expect(Kong::Client.instance).to receive(:get).with("/consumers/:username/oauth2")
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.username = ':username'
30
- allow(Kong::Client.instance).to receive(:get).with("/consumers/:username/oauth2")
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.username = ':username'
59
- expect(Kong::Client.instance).to receive(:get).with("/consumers/:username/acls")
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.username = ':username'
66
- allow(Kong::Client.instance).to receive(:get).with("/consumers/:username/acls")
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.0
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-07-31 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler