class Riddl::Utils::Notifications::Producer::Subscriptions

Public Instance Methods

response() click to toggle source
# 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