Class: Handinger::Resources::Tasks
- Inherits:
-
Object
- Object
- Handinger::Resources::Tasks
- Defined in:
- lib/handinger/resources/tasks.rb
Overview
Run and inspect tasks against a worker.
Instance Method Summary collapse
-
#create(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil, request_options: {}) ⇒ Handinger::Models::Worker
Some parameter documentations has been truncated, see Models::TaskCreateParams for more details.
-
#delete(task_id, request_options: {}) ⇒ Handinger::Models::DeleteTaskResponse
Archive a task so it stops appearing in ‘GET /tasks` results.
-
#initialize(client:) ⇒ Tasks
constructor
private
A new instance of Tasks.
-
#retrieve(task_id, request_options: {}) ⇒ Handinger::Models::TaskWithTurns
Retrieve a single task and its individual turns.
Constructor Details
#initialize(client:) ⇒ Tasks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tasks.
87 88 89 |
# File 'lib/handinger/resources/tasks.rb', line 87 def initialize(client:) @client = client end |
Instance Method Details
#create(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil, request_options: {}) ⇒ Handinger::Models::Worker
Some parameter documentations has been truncated, see Models::TaskCreateParams for more details.
Run a new task against an existing worker. Send a ‘taskId` of a prior task to add a follow-up turn instead of starting a fresh task. Send `multipart/form-data` to attach files; the bytes are bootstrapped into the worker’s workspace before the task starts.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/handinger/resources/tasks.rb', line 32 def create(params) parsed, = Handinger::TaskCreateParams.dump_request(params) @client.request( method: :post, path: "api/tasks", body: parsed, model: Handinger::Worker, options: ) end |
#delete(task_id, request_options: {}) ⇒ Handinger::Models::DeleteTaskResponse
Archive a task so it stops appearing in ‘GET /tasks` results. Turns and files are retained for audit purposes. Only the worker creator can archive a task.
75 76 77 78 79 80 81 82 |
# File 'lib/handinger/resources/tasks.rb', line 75 def delete(task_id, params = {}) @client.request( method: :delete, path: ["api/tasks/%1$s", task_id], model: Handinger::DeleteTaskResponse, options: params[:request_options] ) end |
#retrieve(task_id, request_options: {}) ⇒ Handinger::Models::TaskWithTurns
Retrieve a single task and its individual turns.
54 55 56 57 58 59 60 61 |
# File 'lib/handinger/resources/tasks.rb', line 54 def retrieve(task_id, params = {}) @client.request( method: :get, path: ["api/tasks/%1$s", task_id], model: Handinger::TaskWithTurns, options: params[:request_options] ) end |