Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2010 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/370868 to your computer and use it in GitHub Desktop.
Save anonymous/370868 to your computer and use it in GitHub Desktop.
class RuoteKit::Application
post "/_ruote/engine/reply" do
h = Rufus::Json.decode( env["rack.input"].read ) || {}
#p h
if params['merge_workitem'] == '1'
puts "merge request"
process = engine.process( h['fei']['wfid'] )
if process && expression = process.expressions.detect { |exp| exp.fei.expid == h['fei']['expid'] }
merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge!(v2, &merger) : v2 }
h.merge!(expression.h.applied_workitem, &merger)
end
end
#p h
engine.reply( Ruote::Workitem.new(h) )
respond_to do |format|
format.json { json( :status, :ok ) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment