Permalink
Browse files

Client#run_schedule returns [ScheduledJob]

  • Loading branch information...
1 parent 2ed24f1 commit f46ad5f83aba10a3cb6eee4c0e22ba8de031ff1a @frsyuki frsyuki committed Mar 12, 2012
Showing with 7 additions and 4 deletions.
  1. +5 −3 lib/td/client.rb
  2. +2 −1 lib/td/client/api.rb
View
@@ -195,10 +195,12 @@ def history(name, from=nil, to=nil)
}
end
- # TODO nil -> [ScheduledJob] or [Job]
+ # [ScheduledJob]
def run_schedule(name, time, num)
- @api.run_schedule(name, time, num)
- nil
+ results = @api.run_schedule(name, time, num)
+ results.map {|job_id,type,scheduled_at|
+ ScheduledJob.new(self, scheduled_at, job_id, type, nil)
+ }
end
# => time:Flaot
@@ -477,7 +477,8 @@ def run_schedule(name, time, num)
js['jobs'].each {|m|
job_id = m['job_id']
scheduled_at = m['scheduled_at']
- result << [job_id, scheduled_at]
+ type = (m['type'] || '?').to_sym
+ result << [job_id, type, scheduled_at]
}
return result
end

0 comments on commit f46ad5f

Please sign in to comment.