skull_island 1.2.9 → 1.2.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f268c820dcd42d72c73df67cb9cda9440704fd4d4ad18bab086497b4eff049f1
4
- data.tar.gz: 9dc739be3c2cd49f6f2babdc88f7156018f3ca5c97c373ede064be3d6a4e4724
3
+ metadata.gz: cc28c229371cd2d9f0cfef962e87ac95f27da4bd38d4a1990d2ba43ff0b9c275
4
+ data.tar.gz: 2d61dbedf12cca6c6d05c4b587a842dd0251d04182db207b14767f6b1aa34f1d
5
5
  SHA512:
6
- metadata.gz: 41be4de3f825f795d9354c3164c27ff2046fbbfb4705fc20dbf218f39590c5aff190d66aa9ec5e2dc45110c1711f011da39631a8e47c2cb4b2133b598f3140c1
7
- data.tar.gz: 1b5172d9079706284c70495a3d69b4b7a0c8875ef03df9e93aae896a98d13007051687da4004fe66f4236e473172e33c9b71c67d8eb74c93f2bc84e43d937e17
6
+ metadata.gz: 100978336f6bbb9b8c7ef129c84ce98cf32139564e44818024ba4026118bbd5e75895a03e1ecd66bea299ef7bc0d9d3f7c424340d1676850e11b6af44bba5a1d
7
+ data.tar.gz: f1b508505ac2dbbfaab2e1091cc4c59f9b7be19337b44ee38de9132bc6ef05c3db5306563d0fe40c7350e3bf3041c93316759f51cacb470812e5163d8c35204b
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- skull_island (1.2.9)
4
+ skull_island (1.2.10)
5
5
  deepsort (~> 0.4)
6
6
  erubi (~> 1.8)
7
7
  json (~> 2.1)
8
8
  linguistics (~> 2.1)
9
- rest-client (~> 2.0)
9
+ rest-client (~> 2.1)
10
10
  thor (~> 0.20)
11
11
  will_paginate (~> 3.1)
12
12
 
@@ -16,6 +16,12 @@ GEM
16
16
  addressable (2.4.0)
17
17
  ast (2.4.0)
18
18
  backports (3.15.0)
19
+ coveralls (0.7.1)
20
+ multi_json (~> 1.3)
21
+ rest-client
22
+ simplecov (>= 0.7)
23
+ term-ansicolor
24
+ thor
19
25
  deepsort (0.4.2)
20
26
  diff-lcs (1.3)
21
27
  docile (1.3.2)
@@ -37,6 +43,7 @@ GEM
37
43
  net-http-persistent (~> 2.9)
38
44
  net-http-pipeline
39
45
  highline (1.7.10)
46
+ http-accept (1.7.0)
40
47
  http-cookie (1.0.3)
41
48
  domain_name (~> 0.5)
42
49
  jaro_winkler (1.5.3)
@@ -46,23 +53,24 @@ GEM
46
53
  linguistics (2.1.0)
47
54
  loggability (~> 0.11)
48
55
  loggability (0.14.0)
49
- mime-types (3.2.2)
56
+ mime-types (3.3)
50
57
  mime-types-data (~> 3.2015)
51
- mime-types-data (3.2019.0331)
58
+ mime-types-data (3.2019.0904)
52
59
  multi_json (1.13.1)
53
60
  multipart-post (2.1.1)
54
61
  net-http-persistent (2.9.4)
55
62
  net-http-pipeline (1.0.1)
56
63
  netrc (0.11.0)
57
64
  parallel (1.17.0)
58
- parser (2.6.3.0)
65
+ parser (2.6.4.0)
59
66
  ast (~> 2.4.0)
60
67
  pusher-client (0.6.2)
61
68
  json
62
69
  websocket (~> 1.0)
63
70
  rainbow (3.0.0)
64
- rake (10.5.0)
65
- rest-client (2.0.2)
71
+ rake (12.3.3)
72
+ rest-client (2.1.0)
73
+ http-accept (>= 1.7.0, < 2.0)
66
74
  http-cookie (>= 1.0.2, < 2.0)
67
75
  mime-types (>= 1.16, < 4.0)
68
76
  netrc (~> 0.8)
@@ -92,7 +100,10 @@ GEM
92
100
  json (>= 1.8, < 3)
93
101
  simplecov-html (~> 0.10.0)
94
102
  simplecov-html (0.10.2)
103
+ term-ansicolor (1.7.1)
104
+ tins (~> 1.0)
95
105
  thor (0.20.3)
106
+ tins (1.21.1)
96
107
  travis (1.8.10)
97
108
  backports
98
109
  faraday (~> 0.9)
@@ -109,7 +120,7 @@ GEM
109
120
  unf_ext (0.0.7.6)
110
121
  unicode-display_width (1.6.0)
111
122
  websocket (1.2.8)
112
- will_paginate (3.1.7)
123
+ will_paginate (3.1.8)
113
124
  yard (0.9.20)
114
125
 
115
126
  PLATFORMS
@@ -117,10 +128,11 @@ PLATFORMS
117
128
 
118
129
  DEPENDENCIES
119
130
  bundler (~> 2.0)
120
- rake (~> 10.0)
131
+ coveralls (~> 0.7)
132
+ rake (~> 12.0)
121
133
  rspec (~> 3.0)
122
134
  rubocop (~> 0.50)
123
- simplecov (~> 0.15)
135
+ simplecov (~> 0.17)
124
136
  skull_island!
125
137
  travis (~> 1.8)
126
138
  yard (~> 0.9.20)
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  A full-featured SDK for [Kong](https://konghq.com/kong/) 1.1.x/1.2.x (with support for migrating from 0.14.x). Note that this is unofficial (meaning this project is in no way officially endorsed, recommended, or related to Kong [as a company](https://konghq.com/) or an [open-source project](https://github.com/Kong/kong)). It is also in no way related to the [pet toy company](https://www.kongcompany.com/) by the same name (but hopefully that was obvious).
4
4
 
5
+ ![Gem](https://img.shields.io/gem/v/skull_island)
6
+ ![Travis (.org)](https://img.shields.io/travis/jgnagy/skull_island)
7
+ ![Depfu](https://img.shields.io/depfu/jgnagy/skull_island)
8
+ ![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/jgnagy/skull_island)
9
+
5
10
  ## Installation
6
11
 
7
12
  ### CLI Tool
@@ -262,9 +267,15 @@ plugins:
262
267
 
263
268
  All top-level keys (other than `version` and `project`) require an Array as a parameter, either by providing a list of entries or an empty Array (`[]`). The above shows how to use the `lookup()` function to refer to another resource. This "looks up" the resource type (`service` in this case) by `name` (`search_api` in this case) and resolves its `id`. This function can also be used to lookup a `route` or `upstream` by its `name`, or a `consumer` by its `username`. Note that Kong itself doesn't _require_ `route` resources to have unique names, so you'll need to enforce that practice yourself for `lookup` to be useful for Routes.
264
269
 
270
+ Note that while this configuration looks a lot like the [DB-less](https://docs.konghq.com/1.1.x/db-less-and-declarative-config/) configuration (and even may, at times, be interchangeable), this is merely a coincidence. **Skull Island doesn't support the DB-less mode for Kong.** This may potentially change in the future, but for now it is not a goal of this project.
271
+
272
+ #### Embedded Ruby
273
+
265
274
  While technically _any_ Ruby is valid, the following are pretty helpful for templating your YAML files:
266
275
 
267
- * `ENV.fetch('VARIABLE_NAME', 'default value')` - This allows looking up the environment variable `VARIABLE_NAME` and using its value, or, if it isn't defined, it uses `default value` as the value. With this we could change `host: api.example.com` to `host: <%= ENV.fetch('API_HOST', 'api.example.com') %>`. With this, if `API_HOST` is provided, it'll use that, otherwise it will default to `api.example.com`.
276
+ * `lookup(:service, 'foo')` - This function resolves the ID of a `service` named `foo`. Lookup supports `:consumer` (looking up the `username` attribute), `:service`, `:route`, or `:upstream` (resolving the `name` attribute).
277
+
278
+ * `ENV.fetch('VARIABLE_NAME', 'default value')` - This allows looking up the environment variable `VARIABLE_NAME` and using its value, or, if it isn't defined, it uses `default value` as the value. With this we could change `host: api.example.com` to `host: <%= ENV.fetch('API_HOST', 'api.example.com') %>`. With this, if `API_HOST` is provided, it'll use that, otherwise it will default to `api.example.com`. This is especially helpful for sensitive information; you can version control the configuration but pass in things like credentials via environment variables at runtime.
268
279
 
269
280
  ## SDK Usage
270
281
 
@@ -31,12 +31,25 @@ module SkullIsland
31
31
 
32
32
  def get(uri, data = nil)
33
33
  client_action do |client|
34
- # TODO: Support the API's pagination through the "next" top-level key
35
- if data
36
- JSON.parse client[uri].get(json_headers.merge(params: data))
37
- else
38
- JSON.parse client[uri].get(json_headers)
34
+ results = nil
35
+ params = {}
36
+ params.merge(data) if data
37
+ # OPTIMIZE: Move to an Enumerable
38
+ loop do
39
+ follow_up = JSON.parse client[uri].get(json_headers.merge(params: params))
40
+
41
+ if results
42
+ results['data'] += follow_up['data']
43
+ else
44
+ results = follow_up.dup
45
+ results.delete('offset')
46
+ results.delete('next')
47
+ end
48
+
49
+ params = params.merge('offset' => follow_up['offset']) if follow_up.key?('offset')
50
+ raise StopIteration unless follow_up.key?('offset')
39
51
  end
52
+ results
40
53
  end
41
54
  end
42
55
 
@@ -70,7 +70,8 @@ module SkullIsland
70
70
  Consumer.new(
71
71
  entity: value,
72
72
  lazy: true,
73
- tainted: false
73
+ tainted: false,
74
+ api_client: api_client
74
75
  )
75
76
  else
76
77
  value
@@ -111,7 +111,8 @@ module SkullIsland
111
111
  Consumer.new(
112
112
  entity: value,
113
113
  lazy: true,
114
- tainted: false
114
+ tainted: false,
115
+ api_client: api_client
115
116
  )
116
117
  else
117
118
  value
@@ -81,7 +81,8 @@ module SkullIsland
81
81
  Consumer.new(
82
82
  entity: value,
83
83
  lazy: true,
84
- tainted: false
84
+ tainted: false,
85
+ api_client: api_client
85
86
  )
86
87
  else
87
88
  value
@@ -70,7 +70,8 @@ module SkullIsland
70
70
  Consumer.new(
71
71
  entity: value,
72
72
  lazy: true,
73
- tainted: false
73
+ tainted: false,
74
+ api_client: api_client
74
75
  )
75
76
  else
76
77
  value
@@ -125,13 +125,15 @@ module SkullIsland
125
125
  Consumer.new(
126
126
  entity: value,
127
127
  lazy: true,
128
- tainted: false
128
+ tainted: false,
129
+ api_client: api_client
129
130
  )
130
131
  elsif value.is_a?(String)
131
132
  Consumer.new(
132
133
  entity: { 'id' => value },
133
134
  lazy: true,
134
- tainted: false
135
+ tainted: false,
136
+ api_client: api_client
135
137
  )
136
138
  else
137
139
  value
@@ -153,13 +155,15 @@ module SkullIsland
153
155
  Route.new(
154
156
  entity: value,
155
157
  lazy: true,
156
- tainted: false
158
+ tainted: false,
159
+ api_client: api_client
157
160
  )
158
161
  elsif value.is_a?(String)
159
162
  Route.new(
160
163
  entity: { 'id' => value },
161
164
  lazy: true,
162
- tainted: false
165
+ tainted: false,
166
+ api_client: api_client
163
167
  )
164
168
  else
165
169
  value
@@ -181,13 +185,15 @@ module SkullIsland
181
185
  Service.new(
182
186
  entity: value,
183
187
  lazy: true,
184
- tainted: false
188
+ tainted: false,
189
+ api_client: api_client
185
190
  )
186
191
  elsif value.is_a?(String)
187
192
  Service.new(
188
193
  entity: { 'id' => value },
189
194
  lazy: true,
190
- tainted: false
195
+ tainted: false,
196
+ api_client: api_client
191
197
  )
192
198
  else
193
199
  value
@@ -111,7 +111,8 @@ module SkullIsland
111
111
  Service.new(
112
112
  entity: value,
113
113
  lazy: true,
114
- tainted: false
114
+ tainted: false,
115
+ api_client: api_client
115
116
  )
116
117
  else
117
118
  value
@@ -89,7 +89,7 @@ module SkullIsland
89
89
  end
90
90
 
91
91
  def target(target_id)
92
- targets.where(id: target_id).first
92
+ targets.where(:id, target_id).first
93
93
  end
94
94
 
95
95
  def targets
@@ -120,7 +120,8 @@ module SkullIsland
120
120
  Upstream.new(
121
121
  entity: value,
122
122
  lazy: true,
123
- tainted: false
123
+ tainted: false,
124
+ api_client: api_client
124
125
  )
125
126
  else
126
127
  value
@@ -4,6 +4,6 @@ module SkullIsland
4
4
  VERSION = [
5
5
  1, # Major
6
6
  2, # Minor
7
- 9 # Patch
7
+ 10 # Patch
8
8
  ].join('.')
9
9
  end
data/skull_island.gemspec CHANGED
@@ -30,15 +30,16 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency 'erubi', '~> 1.8'
31
31
  spec.add_runtime_dependency 'json', '~> 2.1'
32
32
  spec.add_runtime_dependency 'linguistics', '~> 2.1'
33
- spec.add_runtime_dependency 'rest-client', '~> 2.0'
33
+ spec.add_runtime_dependency 'rest-client', '~> 2.1'
34
34
  spec.add_runtime_dependency 'thor', '~> 0.20'
35
35
  spec.add_runtime_dependency 'will_paginate', '~> 3.1'
36
36
 
37
37
  spec.add_development_dependency 'bundler', '~> 2.0'
38
- spec.add_development_dependency 'rake', '~> 10.0'
38
+ spec.add_development_dependency 'coveralls', '~> 0.7'
39
+ spec.add_development_dependency 'rake', '~> 12.0'
39
40
  spec.add_development_dependency 'rspec', '~> 3.0'
40
41
  spec.add_development_dependency 'rubocop', '~> 0.50'
41
- spec.add_development_dependency 'simplecov', '~> 0.15'
42
+ spec.add_development_dependency 'simplecov', '~> 0.17'
42
43
  spec.add_development_dependency 'travis', '~> 1.8'
43
44
  spec.add_development_dependency 'yard', '~> 0.9.20'
44
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skull_island
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-08 00:00:00.000000000 Z
11
+ date: 2019-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deepsort
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '2.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '2.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: thor
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +122,34 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '2.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.7'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rake
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '10.0'
145
+ version: '12.0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '10.0'
152
+ version: '12.0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rspec
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +184,14 @@ dependencies:
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0.15'
187
+ version: '0.17'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0.15'
194
+ version: '0.17'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: travis
183
197
  requirement: !ruby/object:Gem::Requirement