diplomat 2.4.1 → 2.5.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
  SHA256:
3
- metadata.gz: 1f1cb3ae2d7bea15d702357e477052934432379e9b3fdc485626ede61a2f6581
4
- data.tar.gz: e06c391b4399377276712b66d85fca0318e7a8a5a693cfa58e0ad2a11bd1ae3c
3
+ metadata.gz: 37d27cdf582386605a038f4bc076015706d23987826ae5ba5aef9ff4703a12dc
4
+ data.tar.gz: ab5a5a143db7fa3f81f1fe206fb53ddb9cad5d9c8728e17c1a540320e5befa40
5
5
  SHA512:
6
- metadata.gz: 1c29f9052f83dc86b2eeb7606e50188972b9ce47f2161ff9b246f4b6d888089662fd08842975d54e50387656abb6aa11f4302de5a52a0d531de19ec21141617f
7
- data.tar.gz: 898502913bc50f5ccea0f50f972312c92fad4c0d1ad972e23c183368460f48e74d60b1ad660db42eec6351ea5e13a119b30b9e250350340c2623913b72dbc34b
6
+ metadata.gz: 6280f5bfbf670477180997708238033f2864a9c98c0cb0fa6ffadc98f3bd8c82164398a024c1a20d48e5fb4571f8288dfd7ecdfe57e8f485171c2f0bf42e1a14
7
+ data.tar.gz: 1f803aa87fd29265d4d2434663e0c2847a73231458072d9a1e0b69a67d328fa759a0eab14fc8f2be4a476ce3e2753e4270eaf11b0e3f80998eda7b5ed4f70942
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Diplomat
2
- [![Gem Version](https://badge.fury.io/rb/diplomat.svg)](https://rubygems.org/gems/diplomat) [![Gem](https://img.shields.io/gem/dt/diplomat.svg)](https://rubygems.org/gems/diplomat) [![Build Status](https://travis-ci.org/WeAreFarmGeek/diplomat.svg?branch=master)](https://travis-ci.org/WeAreFarmGeek/diplomat) [![Code Climate](https://codeclimate.com/github/johnhamelink/diplomat.svg)](https://codeclimate.com/github/WeAreFarmGeek/diplomat) [![Inline docs](http://inch-ci.org/github/wearefarmgeek/diplomat.svg?branch=master)](http://inch-ci.org/github/wearefarmgeek/diplomat)
2
+ [![Build Status](https://github.com/WeAreFarmGeek/diplomat/workflows/Ruby/badge.svg?branch=master)](https://github.com/WeAreFarmGeek/diplomat/actions?query=branch%3Amaster)
3
+ [![Gem Version](https://badge.fury.io/rb/diplomat.svg)](https://rubygems.org/gems/diplomat) [![Gem](https://img.shields.io/gem/dt/diplomat.svg)](https://rubygems.org/gems/diplomat) [![Code Climate](https://codeclimate.com/github/johnhamelink/diplomat.svg)](https://codeclimate.com/github/WeAreFarmGeek/diplomat) [![Inline docs](http://inch-ci.org/github/wearefarmgeek/diplomat.svg?branch=master)](http://inch-ci.org/github/wearefarmgeek/diplomat)
3
4
  ### A HTTP Ruby API for [Consul](http://www.consul.io/)
4
5
 
5
6
  ![Diplomacy Board Game](http://i.imgur.com/Nkuy4b7.jpg)
@@ -41,7 +42,7 @@ production:
41
42
 
42
43
  ### Which versions of Ruby does Diplomat support? Where did my ruby 1.9 compatibility go?
43
44
 
44
- Check out [Travis](https://travis-ci.org/WeAreFarmGeek/diplomat) to see which versions of ruby we currently test when we're making builds.
45
+ Check out [GitHub Actions](https://github.com/WeAreFarmGeek/diplomat/blob/master/.github/workflows/ruby.yml) to see which versions of ruby we currently test when we're making builds.
45
46
 
46
47
  We've dropped ruby 1.9 support. You can still depend on Diplomat by directly using the `ruby-1.9-compatible` branch on github, although be advised it's not actively maintained anymore.
47
48
 
@@ -39,12 +39,14 @@ module Diplomat
39
39
  custom_params = []
40
40
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
41
41
  custom_params << ['passing'] if options[:passing]
42
- custom_params << use_named_parameter('tag', options[:tag]) if options[:tag]
42
+ custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
43
43
  custom_params << use_named_parameter('near', options[:near]) if options[:near]
44
+ custom_params << use_named_parameter('node-meta', options[:node_meta]) if options[:node_meta]
44
45
 
45
46
  ret = send_get_request(@conn, ["/v1/health/service/#{s}"], options, custom_params)
46
47
  JSON.parse(ret.body).map { |service| OpenStruct.new service }
47
48
  end
49
+
48
50
  # rubocop:enable Metrics/PerceivedComplexity
49
51
 
50
52
  # Get service health
@@ -140,7 +140,15 @@ module Diplomat
140
140
  faraday.request :url_encoded
141
141
  faraday.response :raise_error unless raise_error
142
142
 
143
- faraday.adapter Faraday.default_adapter
143
+ # We have to provide a custom params encoder here because Faraday - by default - assumes that
144
+ # list keys have [] as part of their name. This is however does not match the expectation of
145
+ # the Consul API, which assumes the same query param to simply be repeated
146
+ #
147
+ # So faraday reduces this: http://localhost:8500?a=1&a=2 to http://localhost:8500?a=2 unless you
148
+ # explicitly tell it not to.
149
+ faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
150
+
151
+ faraday.adapter Faraday.default_adapter
144
152
  end
145
153
  end
146
154
 
@@ -229,6 +237,8 @@ module Diplomat
229
237
  consistency = 'consistent' if options[:consistent]
230
238
  query_params << consistency
231
239
 
240
+ query_params << 'cached' if options[:cached]
241
+
232
242
  # Parse url host
233
243
  url_prefix = options[:http_addr] if options[:http_addr]
234
244
  { query_params: query_params, headers: headers, url_prefix: url_prefix }
@@ -17,21 +17,7 @@ module Diplomat
17
17
  custom_params << use_named_parameter('wait', options[:wait]) if options[:wait]
18
18
  custom_params << use_named_parameter('index', options[:index]) if options[:index]
19
19
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
20
- if options[:tag]
21
- # tag can be either a String, or an array of strings
22
- # by splatting it is guaranteed to be an array of strings
23
- [*options[:tag]].each do |value|
24
- custom_params << use_named_parameter('tag', value)
25
- end
26
- end
27
-
28
- # We have to provide a custom params encoder here because Faraday - by default - assumes that
29
- # list keys have [] as part of their name. This is however not the case for consul tags, which
30
- # just use repeated occurences of the same key.
31
- #
32
- # So faraday reduces this: http://localhost:8500?a=1&a=2 to http://localhost:8500?a=2 unless you
33
- # explicitly tell it not to.
34
- options[:params_encoder] = Faraday::FlatParamsEncoder
20
+ custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
35
21
 
36
22
  ret = send_get_request(@conn, ["/v1/catalog/service/#{key}"], options, custom_params)
37
23
  if meta && ret.headers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diplomat
4
- VERSION = '2.4.1'
4
+ VERSION = '2.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-08-16 00:00:00.000000000 Z
13
+ date: 2021-02-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -18,48 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '2.0'
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 2.0.1
21
+ version: '2.2'
25
22
  type: :development
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
26
  - - "~>"
30
27
  - !ruby/object:Gem::Version
31
- version: '2.0'
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.0.1
35
- - !ruby/object:Gem::Dependency
36
- name: codeclimate-test-reporter
37
- requirement: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: 0.4.0
42
- type: :development
43
- prerelease: false
44
- version_requirements: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: 0.4.0
28
+ version: '2.2'
49
29
  - !ruby/object:Gem::Dependency
50
30
  name: cucumber
51
31
  requirement: !ruby/object:Gem::Requirement
52
32
  requirements:
53
33
  - - "~>"
54
34
  - !ruby/object:Gem::Version
55
- version: '2.0'
35
+ version: '5.3'
56
36
  type: :development
57
37
  prerelease: false
58
38
  version_requirements: !ruby/object:Gem::Requirement
59
39
  requirements:
60
40
  - - "~>"
61
41
  - !ruby/object:Gem::Version
62
- version: '2.0'
42
+ version: '5.3'
63
43
  - !ruby/object:Gem::Dependency
64
44
  name: fakes-rspec
65
45
  requirement: !ruby/object:Gem::Requirement
@@ -94,70 +74,84 @@ dependencies:
94
74
  requirements:
95
75
  - - "~>"
96
76
  - !ruby/object:Gem::Version
97
- version: '0.7'
77
+ version: '2.2'
98
78
  type: :development
99
79
  prerelease: false
100
80
  version_requirements: !ruby/object:Gem::Requirement
101
81
  requirements:
102
82
  - - "~>"
103
83
  - !ruby/object:Gem::Version
104
- version: '0.7'
84
+ version: '2.2'
105
85
  - !ruby/object:Gem::Dependency
106
86
  name: pry
107
87
  requirement: !ruby/object:Gem::Requirement
108
88
  requirements:
109
89
  - - "~>"
110
90
  - !ruby/object:Gem::Version
111
- version: '0.9'
91
+ version: '0.14'
112
92
  type: :development
113
93
  prerelease: false
114
94
  version_requirements: !ruby/object:Gem::Requirement
115
95
  requirements:
116
96
  - - "~>"
117
97
  - !ruby/object:Gem::Version
118
- version: '0.9'
98
+ version: '0.14'
119
99
  - !ruby/object:Gem::Dependency
120
100
  name: rake
121
101
  requirement: !ruby/object:Gem::Requirement
122
102
  requirements:
123
103
  - - "~>"
124
104
  - !ruby/object:Gem::Version
125
- version: 12.3.3
105
+ version: 13.0.3
126
106
  type: :development
127
107
  prerelease: false
128
108
  version_requirements: !ruby/object:Gem::Requirement
129
109
  requirements:
130
110
  - - "~>"
131
111
  - !ruby/object:Gem::Version
132
- version: 12.3.3
112
+ version: 13.0.3
133
113
  - !ruby/object:Gem::Dependency
134
114
  name: rspec
135
115
  requirement: !ruby/object:Gem::Requirement
136
116
  requirements:
137
117
  - - "~>"
138
118
  - !ruby/object:Gem::Version
139
- version: '3.2'
119
+ version: '3.10'
140
120
  type: :development
141
121
  prerelease: false
142
122
  version_requirements: !ruby/object:Gem::Requirement
143
123
  requirements:
144
124
  - - "~>"
145
125
  - !ruby/object:Gem::Version
146
- version: '3.2'
126
+ version: '3.10'
147
127
  - !ruby/object:Gem::Dependency
148
128
  name: rubocop
149
129
  requirement: !ruby/object:Gem::Requirement
150
130
  requirements:
151
131
  - - "~>"
152
132
  - !ruby/object:Gem::Version
153
- version: 0.80.0
133
+ version: 0.93.1
154
134
  type: :development
155
135
  prerelease: false
156
136
  version_requirements: !ruby/object:Gem::Requirement
157
137
  requirements:
158
138
  - - "~>"
159
139
  - !ruby/object:Gem::Version
160
- version: 0.80.0
140
+ version: 0.93.1
141
+ - !ruby/object:Gem::Dependency
142
+ name: simplecov
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: 0.21.2
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: 0.21.2
161
155
  - !ruby/object:Gem::Dependency
162
156
  name: webmock
163
157
  requirement: !ruby/object:Gem::Requirement
@@ -178,20 +172,14 @@ dependencies:
178
172
  requirements:
179
173
  - - "~>"
180
174
  - !ruby/object:Gem::Version
181
- version: '1.0'
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- version: 1.0.1
175
+ version: '1.2'
185
176
  type: :runtime
186
177
  prerelease: false
187
178
  version_requirements: !ruby/object:Gem::Requirement
188
179
  requirements:
189
180
  - - "~>"
190
181
  - !ruby/object:Gem::Version
191
- version: '1.0'
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: 1.0.1
182
+ version: '1.2'
195
183
  - !ruby/object:Gem::Dependency
196
184
  name: faraday
197
185
  requirement: !ruby/object:Gem::Requirement
@@ -199,9 +187,6 @@ dependencies:
199
187
  - - ">="
200
188
  - !ruby/object:Gem::Version
201
189
  version: '0.9'
202
- - - "<"
203
- - !ruby/object:Gem::Version
204
- version: 2.0.0
205
190
  type: :runtime
206
191
  prerelease: false
207
192
  version_requirements: !ruby/object:Gem::Requirement
@@ -209,9 +194,6 @@ dependencies:
209
194
  - - ">="
210
195
  - !ruby/object:Gem::Version
211
196
  version: '0.9'
212
- - - "<"
213
- - !ruby/object:Gem::Version
214
- version: 2.0.0
215
197
  description: Diplomat is a simple wrapper for Consul
216
198
  email:
217
199
  - john@johnhamelink.com
@@ -263,14 +245,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
245
  requirements:
264
246
  - - ">="
265
247
  - !ruby/object:Gem::Version
266
- version: '2.0'
248
+ version: '2.5'
267
249
  required_rubygems_version: !ruby/object:Gem::Requirement
268
250
  requirements:
269
251
  - - ">="
270
252
  - !ruby/object:Gem::Version
271
253
  version: '0'
272
254
  requirements: []
273
- rubygems_version: 3.0.8
255
+ rubygems_version: 3.1.4
274
256
  signing_key:
275
257
  specification_version: 4
276
258
  summary: Diplomat is a simple wrapper for Consul