riddl 0.99.132 → 0.99.133

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.
@@ -71,7 +71,7 @@ module Riddl
71
71
  def to_s
72
72
  File.read(@name)
73
73
  end
74
- def view(&block)
74
+ def read(&block)
75
75
  XML::Smart.open_unprotected(@name) do |doc|
76
76
  doc.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0'
77
77
  block.call doc
@@ -86,9 +86,8 @@ module Riddl
86
86
 
87
87
  def each(&block)
88
88
  keys.each do |key|
89
- doc = XML::Smart.open_unprotected(@target + '/' + key + '/subscription.xml')
90
- doc.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0'
91
- block.call doc, key
89
+ f = @target + '/' + key + '/subscription.xml'
90
+ block.call Sub.new(f), key if File.exists? f
92
91
  end
93
92
  end
94
93
 
@@ -138,6 +137,14 @@ module Riddl
138
137
  raise "topics file not found" unless File.exists?(topics)
139
138
  @topics = XML::Smart.open_unprotected(topics.gsub(/^\/+/,'/'))
140
139
  @topics.register_namespace 'n', 'http://riddl.org/ns/common-patterns/notifications-producer/1.0'
140
+
141
+ subscriptions.each do |sub,key|
142
+ sub.read do |doc|
143
+ if doc.find('/*[@url]').empty?
144
+ sub.delete
145
+ end
146
+ end
147
+ end
141
148
  end
142
149
 
143
150
  def subscriptions
@@ -177,12 +184,14 @@ module Riddl
177
184
  ret = XML::Smart::string <<-END
178
185
  <subscriptions details='#{details}' xmlns='http://riddl.org/ns/common-patterns/notifications-producer/1.0'/>
179
186
  END
180
- backend.subscriptions.each do |doc,key|
181
- if doc.root.attributes['url']
182
- ret.root.add('subscription', :id => key, :url => doc.root.attributes['url'])
183
- else
184
- ret.root.add('subscription', :id => key)
185
- end
187
+ backend.subscriptions.each do |sub,key|
188
+ sub.read do |doc|
189
+ if doc.root.attributes['url']
190
+ ret.root.add('subscription', :id => key, :url => doc.root.attributes['url'])
191
+ else
192
+ ret.root.add('subscription', :id => key)
193
+ end
194
+ end
186
195
  end
187
196
  ret.to_s
188
197
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "riddl"
3
- s.version = "0.99.132"
3
+ s.version = "0.99.133"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "restful interface description and declaration language: tools and client/server libs"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.132
4
+ version: 0.99.133
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: tools
11
11
  cert_chain: []
12
- date: 2013-12-10 00:00:00.000000000 Z
12
+ date: 2013-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-smart