server/handlerwrappers/default.rb in cpee-1.3.107 vs server/handlerwrappers/default.rb in cpee-1.3.108

- old
+ new

@@ -27,23 +27,20 @@ @controller.notify("running/activity_calling", :instance => "#{@url}/#{@controller.id}", :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters) if passthrough.nil? params = [] callback = Digest::MD5.hexdigest(Kernel::rand().to_s) - (parameters[:parameters] || {}).each do |h| - if h.class == Hash - h.each do |k,v| - params << Riddl::Parameter::Simple.new("#{k}",CPEE::ValueHelper::generate(v)) - end - end + (parameters[:parameters] || {}).each do |k,v| + params << Riddl::Parameter::Simple.new("#{k}",CPEE::ValueHelper::generate(v)) end params << Riddl::Header.new("CPEE_BASE",@url) params << Riddl::Header.new("CPEE_INSTANCE","#{@url}/#{@controller.id}") params << Riddl::Header.new("CPEE_CALLBACK",callback) type = parameters[:method] || 'post' client = Riddl::Client.new(@handler_endpoint) + status, result, headers = client.request type => params raise "Could not #{parameters[:method] || 'post'} #{@handler_endpoint}" if status != 200 if headers["CPEE_CALLBACK"] && headers["CPEE_CALLBACK"] == 'true' @controller.callbacks[callback] = CPEE::Callback.new("callback activity: #{@handler_position}",self,:callback,nil,nil,:http) @@ -125,10 +122,10 @@ end # }}} def vote_sync_after # {{{ @controller.call_vote("running/syncing_after", :endpoint => @handler_endpoint, :instance => "#{@url}/#{@controller.id}", :activity => @handler_position) end # }}} - def vote_sync_before # {{{ + def vote_sync_before(parameters=nil) # {{{ @controller.call_vote("running/syncing_before", :endpoint => @handler_endpoint, :instance => "#{@url}/#{@controller.id}", :activity => @handler_position) end # }}} def callback(result) @handler_returnValue = result