diplomat 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/diplomat/acl.rb +2 -2
- data/lib/diplomat/kv.rb +3 -2
- data/lib/diplomat/node.rb +2 -2
- data/lib/diplomat/query.rb +1 -1
- data/lib/diplomat/rest_client.rb +9 -2
- data/lib/diplomat/service.rb +2 -2
- data/lib/diplomat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c437150fe2670860ab730944e2ff4fd3327e09a4a9632ef97b7f535d4b23966a
|
4
|
+
data.tar.gz: e52f850967bf6dd29e4e11a48e893e06f9f4552f3045ad8e2892592a38e26307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd3a079a14e539c70260f602ff29b2a9004ca306ae0e158b0316ef8d787daafa4a91991221fbfc9d987495f5e8b1b2650fc8772c9e32348f3ed2da12e93ecb6
|
7
|
+
data.tar.gz: f0e510ec423c65a22e10671a3b4744f696700d8745ff43da81fb7b549b3081ee2c4ee50bf7c8c1905bceaca49046965e1383a599b38cc168da1e82b24388cc9c
|
data/lib/diplomat/acl.rb
CHANGED
@@ -54,7 +54,7 @@ module Diplomat
|
|
54
54
|
raise Diplomat::IdParameterRequired unless value['ID'] || value[:ID]
|
55
55
|
|
56
56
|
custom_params = use_cas(@options)
|
57
|
-
@raw = send_put_request(@conn, ['/v1/acl/update'], options, value
|
57
|
+
@raw = send_put_request(@conn, ['/v1/acl/update'], options, value, custom_params)
|
58
58
|
parse_body
|
59
59
|
end
|
60
60
|
|
@@ -64,7 +64,7 @@ module Diplomat
|
|
64
64
|
# @return [Hash] The result Acl
|
65
65
|
def create(value, options = {})
|
66
66
|
custom_params = use_cas(@options)
|
67
|
-
@raw = send_put_request(@conn, ['/v1/acl/create'], options, value
|
67
|
+
@raw = send_put_request(@conn, ['/v1/acl/create'], options, value, custom_params)
|
68
68
|
parse_body
|
69
69
|
end
|
70
70
|
|
data/lib/diplomat/kv.rb
CHANGED
@@ -116,7 +116,8 @@ module Diplomat
|
|
116
116
|
custom_params << use_cas(@options)
|
117
117
|
custom_params << dc(@options)
|
118
118
|
custom_params << acquire(@options)
|
119
|
-
@raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, value, custom_params
|
119
|
+
@raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, value, custom_params,
|
120
|
+
'application/x-www-form-urlencoded')
|
120
121
|
if @raw.body.chomp == 'true'
|
121
122
|
@key = key
|
122
123
|
@value = value
|
@@ -167,7 +168,7 @@ module Diplomat
|
|
167
168
|
custom_params = []
|
168
169
|
custom_params << dc(options)
|
169
170
|
custom_params << transaction_consistency(options)
|
170
|
-
raw = send_put_request(@conn_no_err, ['/v1/txn'], options,
|
171
|
+
raw = send_put_request(@conn_no_err, ['/v1/txn'], options, value, custom_params)
|
171
172
|
transaction_return JSON.parse(raw.body), options
|
172
173
|
end
|
173
174
|
|
data/lib/diplomat/node.rb
CHANGED
@@ -27,7 +27,7 @@ module Diplomat
|
|
27
27
|
# @param options [Hash] options parameter hash
|
28
28
|
# @return [Boolean]
|
29
29
|
def register(definition, options = {})
|
30
|
-
register = send_put_request(@conn, ['/v1/catalog/register'], options,
|
30
|
+
register = send_put_request(@conn, ['/v1/catalog/register'], options, definition)
|
31
31
|
register.status == 200
|
32
32
|
end
|
33
33
|
|
@@ -36,7 +36,7 @@ module Diplomat
|
|
36
36
|
# @param options [Hash] options parameter hash
|
37
37
|
# @return [Boolean]
|
38
38
|
def deregister(definition, options = {})
|
39
|
-
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options,
|
39
|
+
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
|
40
40
|
deregister.status == 200
|
41
41
|
end
|
42
42
|
end
|
data/lib/diplomat/query.rb
CHANGED
@@ -51,7 +51,7 @@ module Diplomat
|
|
51
51
|
# @return [Boolean]
|
52
52
|
def update(key, definition, options = {})
|
53
53
|
custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil
|
54
|
-
ret = send_put_request(@conn, ["/v1/query/#{key}"], options,
|
54
|
+
ret = send_put_request(@conn, ["/v1/query/#{key}"], options, definition, custom_params)
|
55
55
|
ret.status == 200
|
56
56
|
end
|
57
57
|
|
data/lib/diplomat/rest_client.rb
CHANGED
@@ -207,14 +207,21 @@ module Diplomat
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
def send_put_request(connection, url, options, data, custom_params = nil)
|
210
|
+
def send_put_request(connection, url, options, data, custom_params = nil, mime = 'application/json')
|
211
211
|
rest_options = parse_options(options)
|
212
212
|
url += rest_options[:query_params]
|
213
213
|
url += custom_params unless custom_params.nil?
|
214
214
|
connection.put do |req|
|
215
215
|
req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
|
216
216
|
rest_options[:headers].map { |k, v| req.headers[k.to_sym] = v } unless rest_options[:headers].nil?
|
217
|
-
|
217
|
+
unless data.nil?
|
218
|
+
(req.headers || {})['Content-Type'] = mime
|
219
|
+
req.body = if mime == 'application/json' && !data.is_a?(String)
|
220
|
+
data.to_json
|
221
|
+
else
|
222
|
+
data
|
223
|
+
end
|
224
|
+
end
|
218
225
|
end
|
219
226
|
end
|
220
227
|
|
data/lib/diplomat/service.rb
CHANGED
@@ -47,7 +47,7 @@ module Diplomat
|
|
47
47
|
# @return [Boolean]
|
48
48
|
def register(definition, options = {})
|
49
49
|
url = options[:path] || ['/v1/agent/service/register']
|
50
|
-
register = send_put_request(@conn, url, options,
|
50
|
+
register = send_put_request(@conn, url, options, definition)
|
51
51
|
register.status == 200
|
52
52
|
end
|
53
53
|
|
@@ -74,7 +74,7 @@ module Diplomat
|
|
74
74
|
# @param options [Hash] options parameter hash
|
75
75
|
# @return [Boolean]
|
76
76
|
def deregister_external(definition, options = {})
|
77
|
-
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options,
|
77
|
+
deregister = send_put_request(@conn, ['/v1/catalog/deregister'], options, definition)
|
78
78
|
deregister.status == 200
|
79
79
|
end
|
80
80
|
|
data/lib/diplomat/version.rb
CHANGED
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.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hamelink
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-03-
|
12
|
+
date: 2019-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|