Class: CPEE::Worklist::TaskGiveBack

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/cpee-worklist/implementation.rb', line 274

def response
  index = @a[0].activities.index{ |c| c["id"] == @r.last }

  if index && (@a[0].activities[index]['user'].include?(@r[-3]))
    activity = @a[0].activities[index]
    activity['user'] = []
    callback_id = @a[0].activities[index]['id']
    @a[0].activities.serialize
    @a[0].notify('user/giveback', :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'])
    Riddl::Client.new(@a[0].activities[index]['url']).put [
      Riddl::Header.new('CPEE-UPDATE','true'),
      Riddl::Header.new('CPEE-STATUS','giveback'),
      Riddl::Header.new('CPEE-EVENT','giveback'),
      Riddl::Parameter::Simple.new('user',@r[-3])
    ]
  else
    @status = 404
  end
end