Reputation: 26789
Asana has Sections on the My Tasks View. I want to use the Asana Ruby API to update the My Tasks Section of a given pre-existing task.
I have been spending hours trying to get this to work on the latest version of the Ruby Asana API Gem.
The API support for this new feature seems spotty, but this thread indicates it's possible using the /tasks/task-id/addProject
endpoint.
Attempting to hit this endpoint with the Asana Ruby Gem is not working for me:
@client.tasks.add_project_for_task(task_gid: task.gid, section: section_id, project: ENV['my_tasks_project_id'])
This gives:
Asana::Errors::InvalidRequest: section: Not the correct type
Okay, so that's presumably because it's a special My Tasks section, rather than a typical project section. So let's try with assignee_section
@client.tasks.add_project_for_task(task_gid: task.gid, assignee_section: section_id, project: ENV['my_tasks_project_id'], options: {pretty: true})
No error from this, but it does nothing. So how do I set the My Tasks section of a pre-existing task with the Ruby Asana gem?
It might be that the Asana Ruby SDK is too out of date to do this at all, and I need to write a custom body for the request. I'd be interested in how to write such a custom body request from within the gem, if a raw/custom body is the only way.
Upvotes: 0
Views: 385
Reputation: 26789
Simple solution, just set task_updates[:assignee_section]
with the My Tasks section Gid. Then task.update(task_updates)
My Task sections are fundamentally different than normal Project sections. Hope this helps future people
Upvotes: 0