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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69084b2a7f479ac63674df3d9886edeb576d6df6
4
- data.tar.gz: b3d8de26ba454bf168fb02a6f1e197508e4501be
3
+ metadata.gz: 85938dc4d00a97503411948e26f2c5ce170424c9
4
+ data.tar.gz: 7bc03a754e2d1d2592b09a1200a8f1a520c97928
5
5
  SHA512:
6
- metadata.gz: 405fa1f5d83f6b484257395ddc63d7df04a66a0651a5d74229bde9768cb12a9ef7cc40529bbc33d396bbf5ba92c5f9c36692b2fc683d02ee859c15adac89e7f7
7
- data.tar.gz: 795ca3666bb1848dbff34671a5b2bc6f15b9c5d1263e48dd04c03c7509c5bab6224e58103999e41e737c046778730918001bf5cd2af4a0ff8295fb60139b28b4
6
+ metadata.gz: 7a9eb9d82234e3a4cac86615581a41c2c6c9990d357cf7b347cfa3c20dc901644be85c37e6cda8df92b0c47df93777aeabe01593b5f2e0ca63307ebf8e4868cf
7
+ data.tar.gz: edb438ea20907c9845a6ac4cb41797564f27c4d25e914018b46b6e80f048292008aa57fbc2a5df368135da8d58bb8de29c1dba6bd17dbf2df9380c54f9d234f2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diplomat (0.1.6)
4
+ diplomat (0.1.7)
5
5
  faraday (~> 0.9)
6
6
 
7
7
  GEM
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 = key
14
- @raw = @conn.get "/v1/kv/#{@key}"
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
- @key = key
25
- @value = value
26
- @raw = @conn.put do |req|
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
- parse_body
31
- return_key
32
- return_value
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 = key
40
- @raw = @conn.delete "/v1/kv/#{@key}"
39
+ @key = key
40
+ @raw = @conn.delete "/v1/kv/#{@key}"
41
41
  return_key
42
42
  return_value
43
43
  end
@@ -1,3 +1,3 @@
1
1
  module Diplomat
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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: json }))
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: json }))
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)
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: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink