remote_dwsregistry 0.2.5 → 0.2.6

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: f26f361e119ab8e1207bb92f8d44012176350fd0
4
- data.tar.gz: 76a4f12ad93dc132e0125f2bddf3ca55f429c009
3
+ metadata.gz: db8dfc24ca0b60b9bab93cce22c033e89700b6ec
4
+ data.tar.gz: a9d35b5e627a554bfaecf503845f99cb1e39ed6c
5
5
  SHA512:
6
- metadata.gz: 05027753419368c05ffa2f7790d8eba11d1e3d1e12961f67d328cdf204917b0e1a5a0ceb633878b6253f1c4ac191f1a15cd268c65a1076f1777289762026dfee
7
- data.tar.gz: 60085381d1b8e78f412aea9c87533b99efd4a7a254c3b8bf1cafa99c541e63a651736a4458119aad68a77faa6dc506e07fddd7fc9f2952e969d960e1e9572c50
6
+ metadata.gz: 9af1f264652b9eba0ea816b190d8ae7d8152451410c11b9170f1101fd426024dca22f18f9f9d9fb06278df4fbafdc91e8bc0c75766512231f5f395384b1845c0
7
+ data.tar.gz: 3b6536c17e8348b6c9d189bf691378cee69269e84d47afc9459969ebe00c627a49604361470a92eb700ff58e04d98e68770a610eb19da39a0c761039c0ae4b3d
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- >�d|h��C�F��rځ�mrtm�>P�p=�-DKYT�McSU^ �B��[B>�u0����dl��Y��E�G�-��j�]�x}i~�g��k�S���׆(6����4�2^섆"�#����9��[���Ϟ�NH;^��g���h���sgp 晨��]�ҋ�տ�ڧ�: gJ Q�U������b򤴗V�dz�A�w<?��cU*b��[cF��z�.���Fcr�N5�ֆ��3��m�%)�f_���x8
1
+ câ8����;+��uo�>�|�8`PH��TMѯ�A��>B�+]��C�Ƙ�i��tX�x'#�)�����w���Y2��n�̗��1�%x���)�b޷��K)c�6FߋU���~
2
+ (X�)|� ���>��S���N��c1�����I�9&��CĮrF�����GKf��#�<��:��9qM�F ���IX�{�(��� ��Lޥ��=$�a������m����zf5}{��ܬ��,��7?P��i�R
data.tar.gz.sig CHANGED
Binary file
@@ -38,7 +38,7 @@ class RemoteDwsRegistry
38
38
 
39
39
  end
40
40
 
41
- def get_key(key='')
41
+ def get_key(key='', auto_detect_type: false)
42
42
 
43
43
  r = @req.get(@url_base + key)
44
44
 
@@ -46,7 +46,33 @@ class RemoteDwsRegistry
46
46
  when 'application/xml'
47
47
 
48
48
  doc = Rexle.new(r.body)
49
- doc.root
49
+ e = doc.root
50
+
51
+ return e unless auto_detect_type
52
+
53
+ c = e.attributes[:type]
54
+ s = e.text
55
+
56
+ return e if e.elements.length > 0 or s.nil?
57
+ return s unless c
58
+
59
+ h = {
60
+ string: ->(x) {x},
61
+ boolean: ->(x){
62
+ case x
63
+ when 'true' then true
64
+ when 'false' then false
65
+ when 'on' then true
66
+ when 'off' then false
67
+ else x
68
+ end
69
+ },
70
+ number: ->(x){ x[/^[0-9]+$/] ? x.to_i : x.to_f },
71
+ time: ->(x) {Time.parse x},
72
+ json: ->(x) {JSON.parse x}
73
+ }
74
+
75
+ h[c.to_sym].call s
50
76
 
51
77
  when 'application/json'
52
78
 
@@ -57,6 +83,8 @@ class RemoteDwsRegistry
57
83
  r.body
58
84
 
59
85
  end
86
+
87
+
60
88
 
61
89
  end
62
90
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_dwsregistry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  8Evvq+W0ctr3ipWi/bs/c2vbptk+WCGaWqJDQUWsCWU/JCK1qJiaqW3b1huhQG4B
32
32
  yVeqpuJ0ke2PZQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-04-26 00:00:00.000000000 Z
34
+ date: 2016-11-18 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.4.8
103
+ rubygems_version: 2.5.1
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Used in conjunction with the rack_dwsregistry gem to remotely get and set
metadata.gz.sig CHANGED
Binary file