Class: Riddl::Utils::Notifications::Producer::CreateSubscription
- Inherits:
-
Implementation
- Object
- Implementation
- Riddl::Utils::Notifications::Producer::CreateSubscription
- Defined in:
- lib/ruby/riddl/utils/notifications_producer.rb
Overview
}}}
Instance Method Summary collapse
-
#response ⇒ Object
{{{.
Methods inherited from Implementation
#headers, #initialize, #status
Constructor Details
This class inherits a constructor from Riddl::Implementation
Instance Method Details
#response ⇒ Object
{{{
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/ruby/riddl/utils/notifications_producer.rb', line 222 def response backend = @a[0] handler = @a[1] url = @p[0].name == 'url' ? @p.shift.value : nil topics = [] key, consumer_secret, producer_secret = backend.subscriptions.create do |doc,key| doc.root.attributes['url'] = url if url while @p.length > 0 topic = @p.shift.value base = @p.shift type = base.name items = base.value.split(',') t = if topics.include?(topic) doc.find("/n:subscription/n:topic[@id='#{topic}']").first else topics << topic doc.root.add('topic', :id => topic) end items.each do |i| t.add(type[0..-2], i) end end end handler.key(key).topics(topics).create unless handler.nil? [ Riddl::Parameter::Simple.new('key',key), Riddl::Parameter::Simple.new('producer-secret',producer_secret), Riddl::Parameter::Simple.new('consumer-secret',consumer_secret) ] end |