lib/td/client/api/schedule.rb in td-client-0.8.68 vs lib/td/client/api/schedule.rb in td-client-0.8.69

- old
+ new

@@ -3,32 +3,35 @@ #### ## Schedule API ## - # => start:String + # @param [String] name + # @param [Hash] opts + # @return [String] def create_schedule(name, opts) params = opts.update({:type=> opts[:type] || opts['type'] || 'hive'}) code, body, res = post("/v3/schedule/create/#{e name}", params) if code != "200" raise_error("Create schedule failed", res) end js = checked_json(body, %w[start]) return js['start'] end - # => cron:String, query:String + # @param [String] name + # @return [Array] def delete_schedule(name) code, body, res = post("/v3/schedule/delete/#{e name}") if code != "200" raise_error("Delete schedule failed", res) end js = checked_json(body, %w[]) return js['cron'], js["query"] end - # => [(name:String, cron:String, query:String, database:String, result_url:String)] + # @return [Array] def list_schedules code, body, res = get("/v3/schedule/list") if code != "200" raise_error("List schedules failed", res) end @@ -48,18 +51,25 @@ result << [name, cron, query, database, result_url, timezone, delay, next_time, priority, retry_limit, nil] # same as database } return result end + # @param [String] name + # @param [Hash] params + # @return [nil] def update_schedule(name, params) code, body, res = post("/v3/schedule/update/#{e name}", params) if code != "200" raise_error("Update schedule failed", res) end return nil end + # @param [String] name + # @param [Fixnum] from + # @param [Fixnum] to + # @return [Array] def history(name, from=0, to=nil) params = {} params['from'] = from.to_s if from params['to'] = to.to_s if to code, body, res = get("/v3/schedule/history/#{e name}", params) @@ -82,9 +92,13 @@ result << [scheduled_at, job_id, type, status, query, start_at, end_at, result_url, priority, database] } return result end + # @param [String] name + # @param [String] time + # @param [Fixnum] num + # @return [Array] def run_schedule(name, time, num) params = {} params = {'num' => num} if num code, body, res = post("/v3/schedule/run/#{e name}/#{e time}", params) if code != "200"