lib/travis/client/methods.rb in travis-1.5.1 vs lib/travis/client/methods.rb in travis-1.5.2
- old
+ new
@@ -72,10 +72,17 @@
end
def restart(entity)
# btw, internally we call this reset, not restart, as it resets the state machine
# but we thought that would be too confusing
+ raise Error, "cannot restart a #{entity.class.one}" unless entity.restartable?
session.post_raw('/requests', "#{entity.class.one}_id" => entity.id)
+ entity.reload
+ end
+
+ def cancel(entity)
+ raise Error, "cannot cancel a #{entity.class.one}" unless entity.cancelable?
+ session.post_raw("/#{entity.class.many}/#{entity.id}/cancel")
entity.reload
end
def listen(*entities, &block)
listener = Listener.new(session)