Class: CPEE::Worklist::AssignTask

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/cpee-worklist/implementation.rb', line 315

def response
 index = @a[0].activities.index{ |c| c["id"] == @r.last }
  if index
    user = @p[0].value
    @a[0].activities[index]["user"] << user if CPEE::Worklist::User::ok?(@a[0].opts,@a[0].activities[index],user)
    callback_id = @a[0].activities[index]['id']
    info = CPEE::Worklist::User::info(@a[0].opts,@a[0].activities[index],user)
    @a[0].activities.serialize
    @a[0].notify('user/take', :index => callback_id, :user => @p[0].value, :organisation => info)
    Riddl::Client.new(@a[0].activities[index]['url']).put [
      Riddl::Header.new('CPEE-UPDATE','true'),
      Riddl::Header.new('CPEE-STATUS','take'),
      Riddl::Header.new('CPEE-EVENT','take'),
      Riddl::Parameter::Simple.new('user',@p[0].value)
    ]
  else
    @status = 404
  end
end