config_hub-client 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/config_hub/client.rb +19 -4
- data/lib/config_hub/client/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: ded2e7b41345948796f321d899986236a91442a5
|
|
4
|
+
data.tar.gz: da54e4b9442d68c7a5a14d9c04f6ed91056e16b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6e2c168fe099481f055785d554fb8e99739dd62859c458d6399888fe44b4e096286ba51c0bce9c249f41eee7503d4120978289645b404bac3b6a29e92948640
|
|
7
|
+
data.tar.gz: b69dd5553efc2cc33b9c9046b47ecff0971495d38089378c2598037c7a7234579bd1ba10f9884b0d0bb9fe85c50a11ea8590b8bea39334b2ed206ab67fe94cb7
|
data/Gemfile.lock
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
config_hub-client (0.1.
|
|
4
|
+
config_hub-client (0.1.1)
|
|
5
5
|
activerecord (>= 4.2.0)
|
|
6
6
|
faraday (>= 0.12.2)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activemodel (5.1.
|
|
12
|
-
activesupport (= 5.1.
|
|
13
|
-
activerecord (5.1.
|
|
14
|
-
activemodel (= 5.1.
|
|
15
|
-
activesupport (= 5.1.
|
|
11
|
+
activemodel (5.1.3)
|
|
12
|
+
activesupport (= 5.1.3)
|
|
13
|
+
activerecord (5.1.3)
|
|
14
|
+
activemodel (= 5.1.3)
|
|
15
|
+
activesupport (= 5.1.3)
|
|
16
16
|
arel (~> 8.0)
|
|
17
|
-
activesupport (5.1.
|
|
17
|
+
activesupport (5.1.3)
|
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
19
|
i18n (~> 0.7)
|
|
20
20
|
minitest (~> 5.1)
|
|
@@ -57,4 +57,4 @@ DEPENDENCIES
|
|
|
57
57
|
rspec (~> 3.0)
|
|
58
58
|
|
|
59
59
|
BUNDLED WITH
|
|
60
|
-
1.15.
|
|
60
|
+
1.15.4
|
data/lib/config_hub/client.rb
CHANGED
|
@@ -24,11 +24,11 @@ module ConfigHub
|
|
|
24
24
|
|
|
25
25
|
def fetch(key)
|
|
26
26
|
if config_pulled?
|
|
27
|
-
|
|
28
|
-
if
|
|
29
|
-
yield if block_given?
|
|
27
|
+
item = @data['properties'][key.to_s]
|
|
28
|
+
if item.nil?
|
|
29
|
+
yield if block_given?
|
|
30
30
|
else
|
|
31
|
-
val
|
|
31
|
+
cast item['val'], item['type']
|
|
32
32
|
end
|
|
33
33
|
else
|
|
34
34
|
raise ConfigNotPulledError
|
|
@@ -47,6 +47,21 @@ module ConfigHub
|
|
|
47
47
|
|
|
48
48
|
private
|
|
49
49
|
|
|
50
|
+
def cast(val, type)
|
|
51
|
+
case type
|
|
52
|
+
when 'Boolean'
|
|
53
|
+
val == 'true'
|
|
54
|
+
when 'Integer', 'Long'
|
|
55
|
+
val.to_i
|
|
56
|
+
when 'Float', 'Double'
|
|
57
|
+
val.to_f
|
|
58
|
+
when 'JSON'
|
|
59
|
+
JSON.parse(val)
|
|
60
|
+
else
|
|
61
|
+
val
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
50
65
|
def retrieve_remote_config
|
|
51
66
|
res = @conn.get('/rest/pull')
|
|
52
67
|
if res.status == 200
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: config_hub-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Dunn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-09-
|
|
11
|
+
date: 2017-09-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|