Asana / ruby-asana

Official Ruby client library for the Asana API v1
MIT License
77 stars 53 forks source link

`create_project` and `custom_fields` don't quite work together #165

Open jaymzh opened 1 year ago

jaymzh commented 1 year ago

In theory, when you create a project you can pass in a set of custom_fields as $CUSTOM_FIELD_GID => $VALUE.

In practice, those custom fields aren't available on the object until after it's associated with a /portfolio/ via add_item_for_portfolio.

This means you need to:

res = create_project(...)
add_item_for_porfolio(portfolio_gid: gid, item: res.gid)
update_project(...)

This isn't inherently ruby-asanas fault, since the underlying REST API claims this should work, but it does not. Ideally, the API would take a portfolio_gid argument to create_project, which it would then associate the project to so it could create the appropriate custom_field values.

However, in much the same way that the ruby-asana library kindly handles pagination and other things for us transparently in the background, perhaps in the meantime, create_project could get a portfolio_gid, and then do this 3-step dance for the user.