我正在使用asana gem并尝试获取所有项目中所有任务的所有created_at日期。我可以显示名称和ID,但不能显示其他字段。例如,created_at在打印到屏幕时返回空白。看起来每个任务都应该有一个created_at日期。
代码如下:
client.workspaces.find_all.each do |workspace|
puts "\t* #{workspace.name} - projects:"
client.projects.find_by_workspace(workspace: workspace.id, per_page: 20).each do |projects|
puts "\t\t*- #{projects.name} - tasks"
projects.tasks.find_all.each do |task|
puts "\t\t\t*- #{task.name}"
puts "\t\t\t*- #{task.id}"
puts "\t\t\t*- #{task.assignee}"
puts "\t\t\t*- #{task.due_on}"
puts "\t\t\t*- #{task.created_at}"
puts "\t\t\t*- #{task.completed_at}"
end
end
end
答案 0 :(得分:0)
您似乎需要在要查看的字段上指定选项。 默认情况下,当我们展开列表时,我们只显示名称和ID。你可以这样做:
projects.tasks.find_all(options:{fields:[“created_at”,...]})。each ...
有关详细信息,请参阅https://asana.com/developers/documentation/getting-started/input-output-options。