kong_schema 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +14 -2
- data/lib/kong_schema/adapter.rb +4 -4
- data/lib/kong_schema/cli.rb +2 -0
- data/lib/kong_schema/functional.rb +7 -0
- data/lib/kong_schema/resource/api.rb +17 -2
- data/lib/kong_schema/resource/upstream.rb +1 -1
- data/lib/kong_schema/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ccf080d9311fc62088bf690a8d86af06fae4a97
|
4
|
+
data.tar.gz: fcba834c6e444a18c805e08487504a42186abe67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 932e679e8c807a03e75e73ebdfe510a4374442ba6fcec7b43c7312532ef38d189c14005ad26cdbc7f2222faf12f75e21d53543ab3700e125f67dbeb8bd7270e3
|
7
|
+
data.tar.gz: dc34b51e197f958ab0708cd5a1bc6be8607fa7769780324a5f7b4e7f6ce5724da45593cfcd3e645d185e6f379a9ee2dcc52135f8e7c38bf5f04dc46c46790704
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
-
|
1
|
+
## 1.1.1
|
2
|
+
|
3
|
+
- Fixed an issue assigning the "methods" attribute of Kong::Api objects
|
4
|
+
- Empty array values (like "hosts" and "methods") will no longer display
|
5
|
+
as having changed if their API value is "null"
|
6
|
+
- CLI command `kong_schema up` will now print an error message if the required
|
7
|
+
argument was not passed
|
8
|
+
|
9
|
+
## 1.1.0
|
10
|
+
|
11
|
+
- Added a CLI binary: `kong_schema`
|
12
|
+
|
13
|
+
## 1.0.1
|
2
14
|
|
3
15
|
- Fixed a bug where an empty array of "hosts", "uris", or "methods" in "apis"
|
4
16
|
would raise an exception.
|
5
17
|
- An error will now be raised if `admin_host` is not defined in config (and a
|
6
18
|
connection to Kong admin can not be established)
|
7
19
|
|
8
|
-
|
20
|
+
## 1.0.0
|
9
21
|
|
10
22
|
Initial release with support for the following Kong objects:
|
11
23
|
|
data/lib/kong_schema/adapter.rb
CHANGED
@@ -14,15 +14,15 @@ module KongSchema
|
|
14
14
|
@model.create(params)
|
15
15
|
end
|
16
16
|
|
17
|
-
def changed?(
|
18
|
-
|
19
|
-
!
|
17
|
+
def changed?(current_attributes, next_attributes)
|
18
|
+
next_attributes.keys.any? do |key|
|
19
|
+
!current_attributes[key].eql?(next_attributes[key])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def update(record, params)
|
24
24
|
params.keys.each do |key|
|
25
|
-
record.
|
25
|
+
record.attributes[key] = params[key]
|
26
26
|
end
|
27
27
|
|
28
28
|
record.save
|
data/lib/kong_schema/cli.rb
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'kong'
|
4
4
|
require_relative '../adapter'
|
5
|
+
require_relative '../functional'
|
5
6
|
|
6
7
|
module KongSchema
|
7
8
|
module Resource
|
8
9
|
module Api
|
9
10
|
extend self
|
11
|
+
extend Functional
|
10
12
|
|
11
13
|
def identify(record)
|
12
14
|
case record
|
@@ -26,7 +28,20 @@ module KongSchema
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def changed?(record, attributes)
|
29
|
-
|
31
|
+
current = record.attributes.keys.reduce({}) do |map, key|
|
32
|
+
value = record.attributes[key]
|
33
|
+
|
34
|
+
case key
|
35
|
+
when 'hosts', 'methods', 'uris'
|
36
|
+
map[key] = blank?(value) ? nil : Array(value)
|
37
|
+
else
|
38
|
+
map[key] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
map
|
42
|
+
end
|
43
|
+
|
44
|
+
Adapter.for(Kong::Api).changed?(current, attributes)
|
30
45
|
end
|
31
46
|
|
32
47
|
def update(record, partial_attributes)
|
@@ -43,7 +58,7 @@ module KongSchema
|
|
43
58
|
def serialize_outbound(attributes)
|
44
59
|
attributes.keys.reduce({}) do |map, key|
|
45
60
|
case key
|
46
|
-
when 'hosts', '
|
61
|
+
when 'hosts', 'methods', 'uris'
|
47
62
|
map[key] = Array(attributes[key]).join(',')
|
48
63
|
else
|
49
64
|
map[key] = attributes[key]
|
data/lib/kong_schema/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kong_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmad Amireh
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/kong_schema/adapter.rb
|
162
162
|
- lib/kong_schema/cli.rb
|
163
163
|
- lib/kong_schema/client.rb
|
164
|
+
- lib/kong_schema/functional.rb
|
164
165
|
- lib/kong_schema/reporter.rb
|
165
166
|
- lib/kong_schema/resource.rb
|
166
167
|
- lib/kong_schema/resource/api.rb
|