soar_sr 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2702c19c60541e68ab7a9d746ba435880f17c281
4
- data.tar.gz: 8e8cca3ba77f88cfc040c0395e0505dcfa533a37
3
+ metadata.gz: 3cefb79b8608b2d6ca36fbb80f4ee026712bac7d
4
+ data.tar.gz: ec16f16d2b60d63085b5330f8d75ff4ec98ea912
5
5
  SHA512:
6
- metadata.gz: bdf159e353ed589d0248c5d05eaf70679caca49cef25906ba294864d2799dfec76a311e3651d4deac8f0c31e938333d93f25c37160058840109bf033431b47f8
7
- data.tar.gz: b53f504c41535c16c83ad0d77424f39a2d38a53b9599365e3809178022a69cb348d0c7790dd9170e5bb355091208f1cdd4914e5117f8b8d66c8749d5c8c4863f
6
+ metadata.gz: be56ec8c74ddf1133159fd5760fad68df08b2fc916a2110f8b48afa3b1bebc815bd121cf538f180cfbea05174392e232faadb68bd822a12dfa7a5567eb0cf3a6
7
+ data.tar.gz: 032724121dbea9f5dba8ec6bc66ff836328fce053cbe099b760c46d1f2453122947df6a96194f22e237ea6d6a582f92f3a8fb141fb7f441d9b14038dacb1e66a
@@ -47,16 +47,22 @@ module SoarSr
47
47
  def associate_service_component_with_domain_perspective(service_component, domain_perspective)_{
48
48
  service_component = standardize(service_component)
49
49
  domain_perspective = standardize(domain_perspective)
50
- provided?(domain_perspective, 'domain perspective') and registered?(domain_perspective, 'domains')
50
+ provided?(domain_perspective, 'domain perspective') and any_registered?(domain_perspective)
51
51
  provided?(service_component, 'service component') and registered?(service_component, 'service-components')
52
52
 
53
53
  service_component_id = compile_domain_id('service-components', service_component)
54
- meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective)
54
+ type_registered = which_type_registered?(domain_perspective)
55
+
56
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective) if type_registered == 'domains'
57
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('teams', domain_perspective) if type_registered == 'teams'
55
58
 
56
59
  raise ValidationError, 'already associated' if meta['associations']['service_components'][service_component_id]
57
60
 
58
61
  meta['associations']['service_components'][service_component_id] = true
59
- result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta)
62
+
63
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta) if type_registered == 'domains'
64
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('teams', domain_perspective, meta) if type_registered == 'teams'
65
+
60
66
  authorized?(result) and identifier?(result, 'domain perspective')
61
67
  success
62
68
  }end
@@ -64,16 +70,21 @@ module SoarSr
64
70
  def associate_service_with_domain_perspective(service, domain_perspective)_{
65
71
  service = standardize(service)
66
72
  domain_perspective = standardize(domain_perspective)
67
- provided?(domain_perspective, 'domain perspective') and registered?(domain_perspective, 'domains')
73
+ provided?(domain_perspective, 'domain perspective') and any_registered?(domain_perspective)
68
74
  provided?(service, 'service') and registered?(service, 'services')
69
75
 
70
76
  service_id = compile_domain_id('services', service)
71
- meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective)
77
+
78
+ type_registered = which_type_registered?(domain_perspective)
79
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective) if type_registered == 'domains'
80
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('teams', domain_perspective) if type_registered == 'teams'
72
81
 
73
82
  raise ValidationError, 'already associated' if meta['associations']['services'][service_id]
74
83
 
75
84
  meta['associations']['services'][service_id] = true
76
- result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta)
85
+
86
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta) if type_registered == 'domains'
87
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('teams', domain_perspective, meta) if type_registered == 'teams'
77
88
  authorized?(result) and identifier?(result, 'domain perspective')
78
89
  success
79
90
  }end
@@ -82,16 +93,22 @@ module SoarSr
82
93
  service_component = standardize(service_component)
83
94
  domain_perspective = standardize(domain_perspective)
84
95
  # byebug
85
- provided?(domain_perspective, 'domain perspective') and registered?(domain_perspective, 'domains')
96
+ provided?(domain_perspective, 'domain perspective') and any_registered?(domain_perspective)
86
97
  provided?(service_component, 'service component') and registered?(service_component, 'service-components')
87
98
 
88
99
  service_component_id = compile_domain_id('service-components', service_component)
89
- meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective)
100
+
101
+ type_registered = which_type_registered?(domain_perspective)
102
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective) if type_registered == 'domains'
103
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('teams', domain_perspective) if type_registered == 'teams'
90
104
 
91
105
  raise ValidationError, 'not associated' if not meta['associations']['service_components'][service_component_id]
92
106
 
93
107
  meta['associations']['service_components'].delete(service_component_id)
94
- result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta)
108
+
109
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta) if type_registered == 'domains'
110
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('teams', domain_perspective, meta) if type_registered == 'teams'
111
+
95
112
  authorized?(result) and identifier?(result, 'domain perspective')
96
113
  success
97
114
  }end
@@ -100,16 +117,22 @@ module SoarSr
100
117
  service = standardize(service)
101
118
  domain_perspective = standardize(domain_perspective)
102
119
  # byebug
103
- provided?(domain_perspective, 'domain perspective') and registered?(domain_perspective, 'domains')
120
+ provided?(domain_perspective, 'domain perspective') and any_registered?(domain_perspective)
104
121
  provided?(service, 'service') and registered?(service, 'services')
105
122
 
106
123
  service_id = compile_domain_id('services', service)
107
- meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective)
124
+
125
+ type_registered = which_type_registered?(domain_perspective)
126
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('domains', domain_perspective) if type_registered == 'domains'
127
+ meta = @registry.domain_perspectives.meta_for_domain_perspective('teams', domain_perspective) if type_registered == 'teams'
108
128
 
109
129
  raise ValidationError, 'not associated' if not meta['associations']['services'][service_id]
110
130
 
111
131
  meta['associations']['services'].delete(service_id)
112
- result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta)
132
+
133
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('domains', domain_perspective, meta) if type_registered == 'domains'
134
+ result = @registry.domain_perspectives.configure_meta_for_domain_perspective('teams', domain_perspective, meta) if type_registered == 'teams'
135
+
113
136
  authorized?(result) and identifier?(result, 'domain perspective')
114
137
  success
115
138
  }end
@@ -135,5 +158,12 @@ module SoarSr
135
158
  def no_meta?(meta)
136
159
  (meta['associations']['service_components'] == {}) and (meta['associations']['services'] == {})
137
160
  end
161
+
162
+ def which_type_registered?(domain_perspective)
163
+ return 'domains' if type_registered?(domain_perspective, 'domains')
164
+ return 'teams' if type_registered?(domain_perspective, 'teams')
165
+ nil
166
+ end
167
+
138
168
  end
139
- end
169
+ end
@@ -55,6 +55,7 @@ module SoarSr
55
55
 
56
56
  def any_registered?(domain_perspective)
57
57
  raise ValidationError, "unknown domain perspective provided" if (not type_registered?(domain_perspective, 'domains')) and (not type_registered?(domain_perspective, 'teams'))
58
+ true
58
59
  end
59
60
 
60
61
  def registered?(element, type)
@@ -1,3 +1,3 @@
1
1
  module SoarSr
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
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: 0.1.9
4
+ version: 0.1.10
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: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: persistent-cache