Class: CPEE::Worklist::TaskTake

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/cpee-worklist/implementation.rb', line 253

def response
  index = @a[0].activities.index{ |c| c["id"] == @r.last }
  if index
    activity = @a[0].activities[index]
    activity['user'].push @r[-3]if CPEE::Worklist::User::ok?(@a[0].opts,activity,@r[-3])
    info = CPEE::Worklist::User::info(@a[0].opts,activity,@r[-3])
    @a[0].activities.serialize
    @a[0].notify('user/take', :user => @r[-3], :callback_id => activity['id'], :cpee_callback => activity['url'], :cpee_instance => activity['cpee_instance'],:instance_uuid => activity['uuid'], :cpee_base => activity['cpee_base'], :cpee_label => activity['label'], :cpee_activity => activity['cpee_activity_id'], :orgmodel => activity['orgmodel'], :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',@r[-3])
    ]
  else
    @status = 404
  end
end