soar_sr 1.1.10 → 1.1.11
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/lib/soar_sr/associations.rb +14 -8
- data/lib/soar_sr/version.rb +1 -1
- data/lib/soar_sr.rb +48 -2
- 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: 05a8b23810bacbbccacd773a77f60acaf884d0ef
|
4
|
+
data.tar.gz: e0050b40257e65c1c1e511fea9898099d732ebb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3ab8b46470cbae1432234266b59c06a207029d11a1177ceb9596b48003421a635c91c2680f25efc01f75fe6bd8f7a59ad8bc15c56b37486823b08e764a1c44
|
7
|
+
data.tar.gz: 9d69aef2617b49b7e07902ca613b23231402c1fbdf2af09ee5770214358c40e421f29780ab4cd93a0977dc1845807063256e0506e704a4695e171aa9d5c9265a
|
data/lib/soar_sr/associations.rb
CHANGED
@@ -44,11 +44,19 @@ module SoarSr
|
|
44
44
|
(associations['service_components'].size > 0) or (associations['services'].size > 0)
|
45
45
|
end
|
46
46
|
|
47
|
-
def service_associations(service)
|
47
|
+
def service_associations(service)_{
|
48
48
|
service = standardize(service)
|
49
49
|
provided?(service, 'service') and registered?(service, 'services')
|
50
50
|
result = @registry.services.service_uris(service)
|
51
|
-
|
51
|
+
|
52
|
+
bindings = result['data']['bindings']
|
53
|
+
bindings ||= {}
|
54
|
+
uris = {}
|
55
|
+
bindings.each do |id, detail|
|
56
|
+
uris[id] = detail['access_point']
|
57
|
+
end
|
58
|
+
|
59
|
+
service = {'id' => compile_domain_id('services', service), 'uris' => uris, 'associations' => { 'domain_perspectives' => {}}}
|
52
60
|
domain_perspectives = @registry.domain_perspectives.list_domain_perspectives['data']['domain_perspectives']
|
53
61
|
|
54
62
|
threads = []
|
@@ -61,10 +69,9 @@ module SoarSr
|
|
61
69
|
service['associations']['domain_perspectives'] =
|
62
70
|
Hash::deep_merge(service['associations']['domain_perspectives'],
|
63
71
|
sv['associations']['domain_perspectives'])
|
64
|
-
service['associations']['domain_perspectives'] = service['associations']['domain_perspectives'].uniq
|
65
72
|
end
|
66
|
-
service
|
67
|
-
end
|
73
|
+
success_data(service)
|
74
|
+
}end
|
68
75
|
|
69
76
|
def associate_service_component_with_domain_perspective(service_component, domain_perspective)_{
|
70
77
|
service_component = standardize(service_component)
|
@@ -191,11 +198,10 @@ module SoarSr
|
|
191
198
|
def map_domain_perspective_associations(domain_perspective, service)
|
192
199
|
result = domain_perspective_associations(domain_perspective)
|
193
200
|
result['data']['associations']['services'].each do |id, associated|
|
194
|
-
`echo "#{id} -> #{associated} with #{service[id]} and #{id} and #{associated}}" >> /Users/ernstv/scratch/log` if (domain_perspective == 'testing')
|
195
201
|
if ((service['id'] == id) and (associated == true))
|
196
202
|
service['associations'] ||= {}
|
197
|
-
service['associations']['domain_perspectives'] ||=
|
198
|
-
service['associations']['domain_perspectives']
|
203
|
+
service['associations']['domain_perspectives'] ||= {}
|
204
|
+
service['associations']['domain_perspectives'][domain_perspective] = domain_perspective
|
199
205
|
end
|
200
206
|
end
|
201
207
|
service
|
data/lib/soar_sr/version.rb
CHANGED
data/lib/soar_sr.rb
CHANGED
@@ -24,8 +24,10 @@ class ::Hash
|
|
24
24
|
result = first
|
25
25
|
if first.is_a?(Hash) and (second.is_a?(Hash))
|
26
26
|
result = first.merge(second)
|
27
|
-
|
27
|
+
elsif first.is_a?(Array) and second.is_a?(Array)
|
28
28
|
return first + second
|
29
|
+
else
|
30
|
+
return second
|
29
31
|
end
|
30
32
|
first.each do |first_key, first_value|
|
31
33
|
second.each do |second_key, second_value|
|
@@ -35,7 +37,7 @@ class ::Hash
|
|
35
37
|
elsif first_value.is_a?(Array) and (second_value.is_a?(Array))
|
36
38
|
result[first_key] = first_value + second_value
|
37
39
|
else
|
38
|
-
result[first_key] =
|
40
|
+
result[first_key] = second_value
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -52,3 +54,47 @@ class ::Hash
|
|
52
54
|
keys
|
53
55
|
end
|
54
56
|
end
|
57
|
+
|
58
|
+
|
59
|
+
# a = {'key' => 'value'}
|
60
|
+
# => {"key"=>"value"}
|
61
|
+
# b = {'key2' => 'value2'}
|
62
|
+
# => {"key2"=>"value2"}
|
63
|
+
# a.merge b
|
64
|
+
# => {"key"=>"value", "key2"=>"value2"}
|
65
|
+
|
66
|
+
# a = {'key' => 'value'}
|
67
|
+
# => {"key"=>"value"}
|
68
|
+
# b = {'key' => 'value2'}
|
69
|
+
# => {"key"=>"value2"}
|
70
|
+
# a.merge b
|
71
|
+
# => {"key"=>"value2"}
|
72
|
+
# Hash.deep_merge(a, b)
|
73
|
+
# => {"key"=>"valuevalue2"}
|
74
|
+
|
75
|
+
# a = {'key' => 'value', 'dictionary' => { '1' => 'one', '2' => 'two' }}
|
76
|
+
# => {"key"=>"value", "dictionary"=>{"1"=>"one", "2"=>"two"}}
|
77
|
+
# b = {'key2' => 'value2', 'dictionary' => { '3' => 'one', '4' => 'two' }}
|
78
|
+
# => {"key2"=>"value2", "dictionary"=>{"3"=>"one", "4"=>"two"}}
|
79
|
+
# a.merge b
|
80
|
+
# => {"key"=>"value", "dictionary"=>{"3"=>"one", "4"=>"two"}, "key2"=>"value2"}
|
81
|
+
# Hash.deep_merge(a, b)
|
82
|
+
# => {"key"=>"value", "dictionary"=>{"1"=>"one", "2"=>"two", "3"=>"one", "4"=>"two"}, "key2"=>"value2"}
|
83
|
+
|
84
|
+
# a = {'key' => 'value', 'dictionary' => [ '1', '2']}
|
85
|
+
# => {"key"=>"value", "dictionary"=>["1", "2"]}
|
86
|
+
# b = {'key2' => 'value2', 'dictionary' => ['3', '4']}
|
87
|
+
# => {"key2"=>"value2", "dictionary"=>["3", "4"]}
|
88
|
+
# a.merge b
|
89
|
+
# => {"key"=>"value", "dictionary"=>["3", "4"], "key2"=>"value2"}
|
90
|
+
# Hash.deep_merge(a, b)
|
91
|
+
# => {"key"=>"value", "dictionary"=>["1", "2", "3", "4"], "key2"=>"value2"}
|
92
|
+
|
93
|
+
# a = {'key' => 'value', 'dictionary' => { '1' => 'one', '2' => {'2.1' => 'twoone', '2.2' => 'twotwo' }}}
|
94
|
+
# => {"key"=>"value", "dictionary"=>{"1"=>"one", "2"=>{"2.1"=>"twoone", "2.2"=>"twotwo"}}}
|
95
|
+
# b = {'key2' => 'value2', 'dictionary' => { '3' => 'three', '2' => {'2.3' => 'twothree', '2.4' => 'twofour' }}}
|
96
|
+
# => {"key2"=>"value2", "dictionary"=>{"3"=>"three", "2"=>{"2.3"=>"twothree", "2.4"=>"twofour"}}}
|
97
|
+
# a.merge b
|
98
|
+
# => {"key"=>"value", "dictionary"=>{"3"=>"three", "2"=>{"2.3"=>"twothree", "2.4"=>"twofour"}}, "key2"=>"value2"}
|
99
|
+
# Hash::deep_merge(a, b)
|
100
|
+
# => {"key"=>"value", "dictionary"=>{"1"=>"one", "2"=>{"2.1"=>"twoone", "2.2"=>"twotwo", "2.3"=>"twothree", "2.4"=>"twofour"}, "3"=>"three"}, "key2"=>"value2"}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_sr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst van Graan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: persistent-cache
|