Class: Riddl::Utils::Notifications::Producer::Subscriptions

Inherits:
Implementation
  • Object
show all
Defined in:
lib/ruby/riddl/utils/notifications_producer.rb

Overview

}}}

Instance Method Summary collapse

Methods inherited from Implementation

#headers, #initialize, #status

Constructor Details

This class inherits a constructor from Riddl::Implementation

Instance Method Details

#responseObject

{{{



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/ruby/riddl/utils/notifications_producer.rb', line 187

def response
  backend = @a[0]
  details = @a[1]
  Riddl::Parameter::Complex.new("subscriptions","text/xml") do
    ret = XML::Smart::string <<-END
      <subscriptions details='#{details}' xmlns='http://riddl.org/ns/common-patterns/notifications-producer/1.0'/>
    END
    backend.subscriptions.each do |sub,key|
      sub.read do |doc|
        if doc.root.attributes['url']
          ret.root.add('subscription', :id => key, :url => doc.root.attributes['url'])
        else
          ret.root.add('subscription', :id => key)
        end
      end
    end
    ret.to_s
  end
end