Class: Attio::Resources::Tasks Private
- Defined in:
- lib/attio/resources/tasks.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
API resource for managing tasks in Attio
Tasks help track action items and to-dos associated with records.
Instance Method Summary collapse
-
#complete(id:, completed_at: nil) ⇒ Hash
private
Mark a task as completed.
-
#create(parent_object:, parent_record_id:, title:, **data) ⇒ Hash
private
Create a new task.
-
#delete(id:) ⇒ Hash
private
Delete a task.
-
#get(id:) ⇒ Hash
private
Get a specific task by ID.
-
#list(**params) ⇒ Hash
private
List tasks with optional filters.
-
#reopen(id:) ⇒ Hash
private
Reopen a completed task.
-
#update(id:, **data) ⇒ Hash
private
Update an existing task.
Constructor Details
This class inherits a constructor from Attio::Resources::Base
Instance Method Details
#complete(id:, completed_at: nil) ⇒ Hash
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.
Mark a task as completed
101 102 103 104 105 106 |
# File 'lib/attio/resources/tasks.rb', line 101 def complete(id:, completed_at: nil) validate_id!(id, "Task") data = { status: "completed" } data[:completed_at] = completed_at if completed_at request(:patch, "tasks/#{id}", data) end |
#create(parent_object:, parent_record_id:, title:, **data) ⇒ Hash
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.
Create a new task
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/attio/resources/tasks.rb', line 64 def create(parent_object:, parent_record_id:, title:, **data) validate_parent!(parent_object, parent_record_id) validate_required_string!(title, "Task title") request(:post, "tasks", data.merge( parent_object: parent_object, parent_record_id: parent_record_id, title: title )) end |
#delete(id:) ⇒ Hash
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.
Delete a task
125 126 127 128 |
# File 'lib/attio/resources/tasks.rb', line 125 def delete(id:) validate_id!(id, "Task") request(:delete, "tasks/#{id}") end |
#get(id:) ⇒ Hash
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.
Get a specific task by ID
45 46 47 48 |
# File 'lib/attio/resources/tasks.rb', line 45 def get(id:) validate_id!(id, "Task") request(:get, "tasks/#{id}") end |
#list(**params) ⇒ Hash
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.
List tasks with optional filters
35 36 37 |
# File 'lib/attio/resources/tasks.rb', line 35 def list(**params) request(:get, "tasks", params) end |
#reopen(id:) ⇒ Hash
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.
Reopen a completed task
114 115 116 117 |
# File 'lib/attio/resources/tasks.rb', line 114 def reopen(id:) validate_id!(id, "Task") request(:patch, "tasks/#{id}", { status: "pending", completed_at: nil }) end |
#update(id:, **data) ⇒ Hash
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.
Update an existing task
88 89 90 91 92 |
# File 'lib/attio/resources/tasks.rb', line 88 def update(id:, **data) validate_id!(id, "Task") validate_data!(data, "Update") request(:patch, "tasks/#{id}", data) end |