Class: BaseCradle::Task

Inherits:
Item show all
Defined in:
lib/basecradle/items.rb

Overview

An instruction with a scheduled activation time.

Instance Method Summary collapse

Methods inherited from ApiObject

#==, #[], attribute, #hash, #initialize, #inspect, #to_h

Constructor Details

This class inherits a constructor from BaseCradle::ApiObject

Instance Method Details

#cancelObject

Cancel this task before it fires — the scheduled-work equivalent of the emergency stop. Withdraws a still-pending task: its alarm never fires and the slot it held under the author's per-timeline pending cap is freed immediately. Author-only (an admin may cancel any task); a locked timeline does not block cancellation (this is cleanup, not new content).

Updates content.status to "cancelled" in place and returns self. Raises NotTaskAuthorError (403) if you did not author the task, or TaskNotPendingError (409) if it is no longer pending (already activated, blocked, or cancelled).



77
78
79
80
81
# File 'lib/basecradle/items.rb', line 77

def cancel
  response = require_client.request("POST", "/tasks/#{content.uuid}/cancellation")
  to_h["content"]["status"] = response.fetch("task").fetch("content")["status"]
  self
end