Class: CPEE::Logging::Subscriptions

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/cpee-logging-xes-yaml/implementation.rb

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/cpee-logging-xes-yaml/implementation.rb', line 150

def response
  opts = @a[0]
  Riddl::Parameter::Complex.new('subscriptions','text/xml') do
    ret = XML::Smart::string <<-END
      <subscriptions xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'/>
    END
    Dir.glob(File.join(opts[:notifications_dir],'*','subscription.xml')).each do |f|
      ret.root.add('subscription').tap do |n|
        n.attributes['id'] = File.basename(File.dirname(f))
        XML::Smart.open_unprotected(f) do |doc|
          n.attributes['url'] =  doc.root.attributes['url']
        end
      end
    end
    ret.to_s
  end
end