lib/khronos/server/scheduler.rb in khronos-0.1.1 vs lib/khronos/server/scheduler.rb in khronos-0.1.2

- old
+ new

@@ -12,11 +12,11 @@ get '/' do { :name => "Khronos - HTTP Job Scheduler Interface.", :version => Khronos::VERSION, :link => "https://github.com/endel/khronos" - } + }.to_json end # Creates a schedule # # @param [String] context application-level identifier @@ -86,9 +86,24 @@ schedule.update_attributes(params) end schedule.save schedule.to_json + end + + # Delete a single task by params + # + # @param [String] context + # @param [String] context + # + # @return [Hash] + delete '/task' do + if params.empty? + return 403, "Too open query. Use '?all=1' to delete all entries." + elsif params['all'] + params = {} + end + { :deleted => Storage::Schedule.where(params).delete_all }.to_json end # Force a task to be scheduled right now # # @param [Integer] id