diplomat 0.9.2 → 0.10.2

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: c86918ac0488a4893ddb36d9b7fded084db7a962
4
- data.tar.gz: afcf30a9587a7d46a384bd36272c230b86202da7
3
+ metadata.gz: 1eb927df5c75548886b88a45edf78761bbdcadd4
4
+ data.tar.gz: 238e8ccd42b9c2992df940a69138d266c80d2bfd
5
5
  SHA512:
6
- metadata.gz: 1f6955ee0739dbdda54fa2b70bc755249aea41d8e6c468b733371acaa9537d152d3f753862f50cf97d37a79aa778d38239e87bb68b3272f507cc58e463a6d457
7
- data.tar.gz: 3de54e87489fad955155ba578fe8f1f587d3a0b70e4ca4811f062f91fe30ac67fe48e4208544877cd0433334580b7414e8b91c59c2f227c595782451a27a8810
6
+ metadata.gz: c7e286e9d62286885cac0494de1200f1b72977b52ca18158b4dccbd89da9ba01177c6876ee8930f11a52937a3932b6720a46b60eabddbc2ac433855ea246d67c
7
+ data.tar.gz: 16d0a2274eab52d10bd2fa6a2c4f805a541274fa17fccafe0de6b67344b7c8af2178007a2981f61c1f8567e95e2f782da02a5032d8f52a4f8788865f7ef570f0
data/README.md CHANGED
@@ -47,24 +47,35 @@ Here's a few examples of how diplomat works:
47
47
 
48
48
  ### Key Values
49
49
 
50
- #### Getting
50
+ #### Setting
51
51
 
52
- Getting the value of a key in the key-value store is as simple as using one of the following:
52
+ Setting the value of a key is easy as pie:
53
53
 
54
54
  ```ruby
55
- foo = Diplomat::Kv.get('foo')
55
+ foo = Diplomat::Kv.put('foo', 'bar')
56
56
  # => "bar"
57
57
  ```
58
58
 
59
- #### Setting
59
+ #### Getting
60
60
 
61
- Setting the value of a key is just as easy:
61
+ Getting the value of a key is just as simple:
62
62
 
63
63
  ```ruby
64
- foo = Diplomat::Kv.put('foo', 'bar')
64
+ foo = Diplomat::Kv.get('foo')
65
65
  # => "bar"
66
66
  ```
67
67
 
68
+ You can also retrieve values recursively:
69
+
70
+ ```ruby
71
+ Diplomat::Kv.put('foo/a', 'lorem')
72
+ Diplomat::Kv.put('foo/b', 'ipsum')
73
+ Diplomat::Kv.put('foo/c', 'dolor')
74
+
75
+ Diplomat::Kv.get('foo/', recurse: true)
76
+ # => [{:key=>"foo/a", :value=>"lorem"}, {:key=>"foo/b", :value=>"ipsum"}, {:key=>"foo/c", :value=>"dolor"}]
77
+ ```
78
+
68
79
  ### Services
69
80
 
70
81
  #### Getting
@@ -161,6 +172,8 @@ Diplomat.configure do |config|
161
172
  config.url = "localhost:8888"
162
173
  # Set up a custom Faraday Middleware
163
174
  config.middleware = MyCustomMiddleware
175
+ # Connect into consul with custom access token (ACL)
176
+ config.acl_token = "xxxxxxxx-yyyy-zzzz-1111-222222222222"
164
177
  end
165
178
  ```
166
179
 
@@ -36,6 +36,7 @@ module Diplomat
36
36
  @options = options
37
37
 
38
38
  url = ["/v1/kv/#{@key}"]
39
+ url += recurse_get(@options)
39
40
  url += check_acl_token
40
41
  url += use_consistency(@options)
41
42
 
@@ -120,5 +121,9 @@ module Diplomat
120
121
  def use_consistency(options)
121
122
  if options && options[:consistency] then ["#{options[:consistency]}"] else [] end
122
123
  end
124
+
125
+ def recurse_get(options)
126
+ if options && options[:recurse] then ['recurse'] else [] end
127
+ end
123
128
  end
124
129
  end
@@ -1,3 +1,3 @@
1
1
  module Diplomat
2
- VERSION = "0.9.2"
2
+ VERSION = "0.10.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler