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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8bb4deec2ec0ae1e5fd29fee2f2f8c5746574aa
4
- data.tar.gz: e1c775e547f0c6280d4432633c14662fc3f62e93
3
+ metadata.gz: ded2e7b41345948796f321d899986236a91442a5
4
+ data.tar.gz: da54e4b9442d68c7a5a14d9c04f6ed91056e16b2
5
5
  SHA512:
6
- metadata.gz: 7b300a680240fbd60a2e26bf27e39a5d4aedb59447cecb0d350645f0e2ae474c0f0756ef551f144fc097b4cf7324c692ab1c9ddc09addc0a62871c670b8c6f42
7
- data.tar.gz: e599bdb53f2ad349e9329ca5cf7af4249a7f6a171b58aa31256ad7867f73d0c24b934655df9aef0d711cba5b81c9b310ea0a39e5df5b3d85d6f7532c706e4c8c
6
+ metadata.gz: b6e2c168fe099481f055785d554fb8e99739dd62859c458d6399888fe44b4e096286ba51c0bce9c249f41eee7503d4120978289645b404bac3b6a29e92948640
7
+ data.tar.gz: b69dd5553efc2cc33b9c9046b47ecff0971495d38089378c2598037c7a7234579bd1ba10f9884b0d0bb9fe85c50a11ea8590b8bea39334b2ed206ab67fe94cb7
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- config_hub-client (0.1.0)
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.2)
12
- activesupport (= 5.1.2)
13
- activerecord (5.1.2)
14
- activemodel (= 5.1.2)
15
- activesupport (= 5.1.2)
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.2)
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.3
60
+ 1.15.4
@@ -24,11 +24,11 @@ module ConfigHub
24
24
 
25
25
  def fetch(key)
26
26
  if config_pulled?
27
- val = @data.dig('properties', key.to_s, 'val')
28
- if val.nil?
29
- yield if block_given? && !@data['properties'].key?(key.to_s)
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
@@ -1,5 +1,5 @@
1
1
  module ConfigHub
2
2
  class Client
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
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.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-18 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday