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 +4 -4
- data/README.md +19 -6
- data/lib/diplomat/kv.rb +5 -0
- data/lib/diplomat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb927df5c75548886b88a45edf78761bbdcadd4
|
4
|
+
data.tar.gz: 238e8ccd42b9c2992df940a69138d266c80d2bfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
####
|
50
|
+
#### Setting
|
51
51
|
|
52
|
-
|
52
|
+
Setting the value of a key is easy as pie:
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
foo = Diplomat::Kv.
|
55
|
+
foo = Diplomat::Kv.put('foo', 'bar')
|
56
56
|
# => "bar"
|
57
57
|
```
|
58
58
|
|
59
|
-
####
|
59
|
+
#### Getting
|
60
60
|
|
61
|
-
|
61
|
+
Getting the value of a key is just as simple:
|
62
62
|
|
63
63
|
```ruby
|
64
|
-
foo = Diplomat::Kv.
|
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
|
|
data/lib/diplomat/kv.rb
CHANGED
@@ -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
|
data/lib/diplomat/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|