diplomat 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/diplomat/kv.rb +12 -12
- data/lib/diplomat/version.rb +1 -1
- data/spec/kv_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85938dc4d00a97503411948e26f2c5ce170424c9
|
4
|
+
data.tar.gz: 7bc03a754e2d1d2592b09a1200a8f1a520c97928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9eb9d82234e3a4cac86615581a41c2c6c9990d357cf7b347cfa3c20dc901644be85c37e6cda8df92b0c47df93777aeabe01593b5f2e0ca63307ebf8e4868cf
|
7
|
+
data.tar.gz: edb438ea20907c9845a6ac4cb41797564f27c4d25e914018b46b6e80f048292008aa57fbc2a5df368135da8d58bb8de29c1dba6bd17dbf2df9380c54f9d234f2
|
data/Gemfile.lock
CHANGED
data/lib/diplomat/kv.rb
CHANGED
@@ -10,8 +10,8 @@ module Diplomat
|
|
10
10
|
# @param key [String] the key
|
11
11
|
# @return [String] The base64-decoded value associated with the key
|
12
12
|
def get key
|
13
|
-
@key
|
14
|
-
@raw
|
13
|
+
@key = key
|
14
|
+
@raw = @conn.get "/v1/kv/#{@key}"
|
15
15
|
parse_body
|
16
16
|
return_value
|
17
17
|
end
|
@@ -21,23 +21,23 @@ module Diplomat
|
|
21
21
|
# @param value [String] the value
|
22
22
|
# @return [String] The base64-decoded value associated with the key
|
23
23
|
def put key, value
|
24
|
-
@
|
25
|
-
|
26
|
-
|
27
|
-
req.url "/v1/kv/#{@key}"
|
28
|
-
req.body = @value
|
24
|
+
@raw = @conn.put do |req|
|
25
|
+
req.url "/v1/kv/#{key}"
|
26
|
+
req.body = value
|
29
27
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
if @raw.body == "true"
|
29
|
+
@key = key
|
30
|
+
@value = value
|
31
|
+
end
|
32
|
+
return @value
|
33
33
|
end
|
34
34
|
|
35
35
|
# Delete a value by it's key
|
36
36
|
# @param key [String] the key
|
37
37
|
# @return [nil]
|
38
38
|
def delete key
|
39
|
-
@key
|
40
|
-
@raw
|
39
|
+
@key = key
|
40
|
+
@raw = @conn.delete "/v1/kv/#{@key}"
|
41
41
|
return_key
|
42
42
|
return_value
|
43
43
|
end
|
data/lib/diplomat/version.rb
CHANGED
data/spec/kv_spec.rb
CHANGED
@@ -34,7 +34,7 @@ describe Diplomat::Kv do
|
|
34
34
|
}])
|
35
35
|
|
36
36
|
faraday.stub(:get).and_return(OpenStruct.new({ body: json }))
|
37
|
-
faraday.stub(:put).and_return(OpenStruct.new({ body:
|
37
|
+
faraday.stub(:put).and_return(OpenStruct.new({ body: "true"}))
|
38
38
|
kv = Diplomat::Kv.new(faraday)
|
39
39
|
|
40
40
|
expect(kv.put(key, key_params)).to eq(key_params)
|
@@ -48,7 +48,7 @@ describe Diplomat::Kv do
|
|
48
48
|
}])
|
49
49
|
|
50
50
|
faraday.stub(:get).and_return(OpenStruct.new({ body: json }))
|
51
|
-
faraday.stub(:put).and_return(OpenStruct.new({ body:
|
51
|
+
faraday.stub(:put).and_return(OpenStruct.new({ body: "true"}))
|
52
52
|
kv = Diplomat::Kv.new(faraday)
|
53
53
|
|
54
54
|
expect(kv.put("toast/#{key}", key_params)).to eq(key_params)
|