asana 0.10.3 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +24 -0
  3. data/.github/workflows/pubilsh-to-rubygem.yml +18 -0
  4. data/.github/workflows/publish-to-github-releases.yml +16 -0
  5. data/.gitignore +0 -1
  6. data/.rubocop.yml +38 -3
  7. data/.ruby-version +1 -1
  8. data/Appraisals +8 -3
  9. data/Gemfile +7 -3
  10. data/Gemfile.lock +166 -0
  11. data/Guardfile +12 -10
  12. data/README.md +45 -20
  13. data/Rakefile +20 -27
  14. data/VERSION +1 -1
  15. data/asana.gemspec +20 -18
  16. data/examples/Gemfile.lock +2 -2
  17. data/examples/cli_app.rb +2 -2
  18. data/examples/events.rb +3 -3
  19. data/examples/personal_access_token.rb +2 -2
  20. data/lib/asana/authentication/oauth2/access_token_authentication.rb +4 -1
  21. data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +3 -2
  22. data/lib/asana/authentication/oauth2/client.rb +2 -0
  23. data/lib/asana/authentication/oauth2.rb +6 -4
  24. data/lib/asana/authentication/token_authentication.rb +3 -1
  25. data/lib/asana/authentication.rb +2 -0
  26. data/lib/asana/client/configuration.rb +6 -5
  27. data/lib/asana/client.rb +13 -11
  28. data/lib/asana/errors.rb +16 -11
  29. data/lib/asana/http_client/environment_info.rb +9 -8
  30. data/lib/asana/http_client/error_handling.rb +26 -20
  31. data/lib/asana/http_client/response.rb +2 -0
  32. data/lib/asana/http_client.rb +66 -65
  33. data/lib/asana/resource_includes/attachment_uploading.rb +6 -6
  34. data/lib/asana/resource_includes/collection.rb +4 -4
  35. data/lib/asana/resource_includes/event.rb +2 -0
  36. data/lib/asana/resource_includes/event_subscription.rb +2 -0
  37. data/lib/asana/resource_includes/events.rb +4 -1
  38. data/lib/asana/resource_includes/registry.rb +2 -0
  39. data/lib/asana/resource_includes/resource.rb +8 -5
  40. data/lib/asana/resource_includes/response_helper.rb +2 -0
  41. data/lib/asana/resources/audit_log_api.rb +42 -0
  42. data/lib/asana/resources/gen/attachments_base.rb +7 -6
  43. data/lib/asana/resources/gen/audit_log_api_base.rb +37 -0
  44. data/lib/asana/resources/gen/goal_relationships_base.rb +83 -0
  45. data/lib/asana/resources/gen/goals_base.rb +153 -0
  46. data/lib/asana/resources/gen/memberships_base.rb +71 -0
  47. data/lib/asana/resources/gen/portfolios_base.rb +3 -3
  48. data/lib/asana/resources/gen/project_briefs_base.rb +68 -0
  49. data/lib/asana/resources/gen/project_templates_base.rb +73 -0
  50. data/lib/asana/resources/gen/projects_base.rb +17 -4
  51. data/lib/asana/resources/gen/status_updates_base.rb +72 -0
  52. data/lib/asana/resources/gen/tasks_base.rb +13 -15
  53. data/lib/asana/resources/gen/teams_base.rb +41 -13
  54. data/lib/asana/resources/gen/time_periods_base.rb +47 -0
  55. data/lib/asana/resources/gen/typeahead_base.rb +2 -2
  56. data/lib/asana/resources/gen/users_base.rb +3 -4
  57. data/lib/asana/resources/gen/webhooks_base.rb +13 -0
  58. data/lib/asana/resources/gen/workspaces_base.rb +1 -1
  59. data/lib/asana/resources/goal.rb +54 -0
  60. data/lib/asana/resources/goal_relationship.rb +32 -0
  61. data/lib/asana/resources/membership.rb +20 -0
  62. data/lib/asana/resources/portfolio.rb +3 -3
  63. data/lib/asana/resources/project_brief.rb +30 -0
  64. data/lib/asana/resources/project_template.rb +36 -0
  65. data/lib/asana/resources/status_update.rb +54 -0
  66. data/lib/asana/resources/time_period.rb +30 -0
  67. data/lib/asana/resources/typeahead.rb +1 -1
  68. data/lib/asana/resources.rb +4 -4
  69. data/lib/asana/ruby2_0_0_compatibility.rb +2 -0
  70. data/lib/asana/version.rb +1 -1
  71. data/lib/asana.rb +2 -0
  72. data/package-lock.json +115 -0
  73. data/samples/attachments_sample.yaml +4 -4
  74. data/samples/audit_log_api_sample.yaml +11 -0
  75. data/samples/goal_relationships_sample.yaml +51 -0
  76. data/samples/goals_sample.yaml +101 -0
  77. data/samples/memberships_sample.yaml +41 -0
  78. data/samples/project_briefs_sample.yaml +41 -0
  79. data/samples/project_templates_sample.yaml +41 -0
  80. data/samples/projects_sample.yaml +10 -0
  81. data/samples/status_updates_sample.yaml +41 -0
  82. data/samples/teams_sample.yaml +24 -4
  83. data/samples/time_periods_sample.yaml +21 -0
  84. data/samples/webhooks_sample.yaml +10 -0
  85. metadata +75 -40
  86. data/.travis.yml +0 -16
@@ -35,7 +35,7 @@ module Asana
35
35
  def add_dependents_for_task(client, task_gid: required("task_gid"), options: {}, **data)
36
36
  path = "/tasks/{task_gid}/addDependents"
37
37
  path["{task_gid}"] = task_gid
38
- Collection.new(parse(client.post(path, body: data, options: options)), type: Task, client: client)
38
+ parse(client.post(path, body: data, options: options)).first
39
39
  end
40
40
 
41
41
  # Add followers to a task
@@ -48,7 +48,7 @@ module Asana
48
48
  def add_followers_for_task(client, task_gid: required("task_gid"), options: {}, **data)
49
49
  path = "/tasks/{task_gid}/addFollowers"
50
50
  path["{task_gid}"] = task_gid
51
- parse(client.post(path, body: data, options: options)).first
51
+ Task.new(parse(client.post(path, body: data, options: options)).first, client: client)
52
52
  end
53
53
 
54
54
  # Add a project to a task
@@ -184,9 +184,9 @@ module Asana
184
184
  # Get multiple tasks
185
185
  #
186
186
 
187
- # assignee - [str] The assignee to filter tasks on. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
187
+ # assignee - [str] The assignee to filter tasks on. If searching for unassigned tasks, assignee.any = null can be specified. *Note: If you specify `assignee`, you must also specify the `workspace` to filter on.*
188
188
  # project - [str] The project to filter tasks on.
189
- # section - [str] The section to filter tasks on. *Note: Currently, this is only supported in board views.*
189
+ # section - [str] The section to filter tasks on.
190
190
  # workspace - [str] The workspace to filter tasks on. *Note: If you specify `workspace`, you must also specify the `assignee` to filter on.*
191
191
  # completed_since - [datetime] Only return tasks that are either incomplete or that have been completed since this time.
192
192
  # modified_since - [datetime] Only return tasks that have been modified since the given time. *Note: A task is considered “modified” if any of its properties change, or associations between it and other objects are modified (e.g. a task being added to a project). A task is not considered modified just because another object it is associated with (e.g. a subtask) is modified. Actions that count as modifying the task include assigning, renaming, completing, and adding stories.*
@@ -204,15 +204,17 @@ module Asana
204
204
  # Get tasks from a project
205
205
  #
206
206
  # project_gid - [str] (required) Globally unique identifier for the project.
207
+ # completed_since - [str] Only return tasks that are either incomplete or that have been completed since this time. Accepts a date-time string or the keyword *now*.
207
208
  # options - [Hash] the request I/O options
208
209
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
209
210
  # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
210
211
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
211
212
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
212
- def get_tasks_for_project(client, project_gid: required("project_gid"), options: {})
213
+ def get_tasks_for_project(client, project_gid: required("project_gid"), completed_since: nil, options: {})
213
214
  path = "/projects/{project_gid}/tasks"
214
215
  path["{project_gid}"] = project_gid
215
- Collection.new(parse(client.get(path, options: options)), type: Task, client: client)
216
+ params = { completed_since: completed_since }.reject { |_,v| v.nil? || Array(v).empty? }
217
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Task, client: client)
216
218
  end
217
219
 
218
220
  # Get tasks from a section
@@ -269,7 +271,7 @@ module Asana
269
271
  def remove_dependencies_for_task(client, task_gid: required("task_gid"), options: {}, **data)
270
272
  path = "/tasks/{task_gid}/removeDependencies"
271
273
  path["{task_gid}"] = task_gid
272
- Collection.new(parse(client.post(path, body: data, options: options)), type: Resource, client: client)
274
+ parse(client.post(path, body: data, options: options)).first
273
275
  end
274
276
 
275
277
  # Unlink dependents from a task
@@ -282,7 +284,7 @@ module Asana
282
284
  def remove_dependents_for_task(client, task_gid: required("task_gid"), options: {}, **data)
283
285
  path = "/tasks/{task_gid}/removeDependents"
284
286
  path["{task_gid}"] = task_gid
285
- Collection.new(parse(client.post(path, body: data, options: options)), type: Resource, client: client)
287
+ parse(client.post(path, body: data, options: options)).first
286
288
  end
287
289
 
288
290
  # Remove followers from a task
@@ -295,7 +297,7 @@ module Asana
295
297
  def remove_follower_for_task(client, task_gid: required("task_gid"), options: {}, **data)
296
298
  path = "/tasks/{task_gid}/removeFollowers"
297
299
  path["{task_gid}"] = task_gid
298
- parse(client.post(path, body: data, options: options)).first
300
+ Task.new(parse(client.post(path, body: data, options: options)).first, client: client)
299
301
  end
300
302
 
301
303
  # Remove a project from a task
@@ -331,7 +333,6 @@ module Asana
331
333
  # resource_subtype - [str] Filters results by the task's resource_subtype
332
334
  # assignee_any - [str] Comma-separated list of user identifiers
333
335
  # assignee_not - [str] Comma-separated list of user identifiers
334
- # assignee_status - [str] One of `inbox`, `today`, `upcoming`, or `later`
335
336
  # portfolios_any - [str] Comma-separated list of portfolio IDs
336
337
  # projects_any - [str] Comma-separated list of project IDs
337
338
  # projects_not - [str] Comma-separated list of project IDs
@@ -343,15 +344,12 @@ module Asana
343
344
  # tags_not - [str] Comma-separated list of tag IDs
344
345
  # tags_all - [str] Comma-separated list of tag IDs
345
346
  # teams_any - [str] Comma-separated list of team IDs
346
- # followers_any - [str] Comma-separated list of user identifiers
347
347
  # followers_not - [str] Comma-separated list of user identifiers
348
348
  # created_by_any - [str] Comma-separated list of user identifiers
349
349
  # created_by_not - [str] Comma-separated list of user identifiers
350
350
  # assigned_by_any - [str] Comma-separated list of user identifiers
351
351
  # assigned_by_not - [str] Comma-separated list of user identifiers
352
- # liked_by_any - [str] Comma-separated list of user identifiers
353
352
  # liked_by_not - [str] Comma-separated list of user identifiers
354
- # commented_on_by_any - [str] Comma-separated list of user identifiers
355
353
  # commented_on_by_not - [str] Comma-separated list of user identifiers
356
354
  # due_on_before - [date] ISO 8601 date string
357
355
  # due_on_after - [date] ISO 8601 date string
@@ -386,10 +384,10 @@ module Asana
386
384
  # options - [Hash] the request I/O options
387
385
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
388
386
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
389
- def search_tasks_for_workspace(client, workspace_gid: required("workspace_gid"), text: nil, resource_subtype: nil, assignee_any: nil, assignee_not: nil, assignee_status: nil, portfolios_any: nil, projects_any: nil, projects_not: nil, projects_all: nil, sections_any: nil, sections_not: nil, sections_all: nil, tags_any: nil, tags_not: nil, tags_all: nil, teams_any: nil, followers_any: nil, followers_not: nil, created_by_any: nil, created_by_not: nil, assigned_by_any: nil, assigned_by_not: nil, liked_by_any: nil, liked_by_not: nil, commented_on_by_any: nil, commented_on_by_not: nil, due_on_before: nil, due_on_after: nil, due_on: nil, due_at_before: nil, due_at_after: nil, start_on_before: nil, start_on_after: nil, start_on: nil, created_on_before: nil, created_on_after: nil, created_on: nil, created_at_before: nil, created_at_after: nil, completed_on_before: nil, completed_on_after: nil, completed_on: nil, completed_at_before: nil, completed_at_after: nil, modified_on_before: nil, modified_on_after: nil, modified_on: nil, modified_at_before: nil, modified_at_after: nil, is_blocking: nil, is_blocked: nil, has_attachment: nil, completed: nil, is_subtask: nil, sort_by: nil, sort_ascending: nil, options: {})
387
+ def search_tasks_for_workspace(client, workspace_gid: required("workspace_gid"), text: nil, resource_subtype: nil, assignee_any: nil, assignee_not: nil, portfolios_any: nil, projects_any: nil, projects_not: nil, projects_all: nil, sections_any: nil, sections_not: nil, sections_all: nil, tags_any: nil, tags_not: nil, tags_all: nil, teams_any: nil, followers_not: nil, created_by_any: nil, created_by_not: nil, assigned_by_any: nil, assigned_by_not: nil, liked_by_not: nil, commented_on_by_not: nil, due_on_before: nil, due_on_after: nil, due_on: nil, due_at_before: nil, due_at_after: nil, start_on_before: nil, start_on_after: nil, start_on: nil, created_on_before: nil, created_on_after: nil, created_on: nil, created_at_before: nil, created_at_after: nil, completed_on_before: nil, completed_on_after: nil, completed_on: nil, completed_at_before: nil, completed_at_after: nil, modified_on_before: nil, modified_on_after: nil, modified_on: nil, modified_at_before: nil, modified_at_after: nil, is_blocking: nil, is_blocked: nil, has_attachment: nil, completed: nil, is_subtask: nil, sort_by: nil, sort_ascending: nil, options: {})
390
388
  path = "/workspaces/{workspace_gid}/tasks/search"
391
389
  path["{workspace_gid}"] = workspace_gid
392
- params = { text: text, resource_subtype: resource_subtype, "assignee.any": assignee_any, "assignee.not": assignee_not, assignee_status: assignee_status, "portfolios.any": portfolios_any, "projects.any": projects_any, "projects.not": projects_not, "projects.all": projects_all, "sections.any": sections_any, "sections.not": sections_not, "sections.all": sections_all, "tags.any": tags_any, "tags.not": tags_not, "tags.all": tags_all, "teams.any": teams_any, "followers.any": followers_any, "followers.not": followers_not, "created_by.any": created_by_any, "created_by.not": created_by_not, "assigned_by.any": assigned_by_any, "assigned_by.not": assigned_by_not, "liked_by.any": liked_by_any, "liked_by.not": liked_by_not, "commented_on_by.any": commented_on_by_any, "commented_on_by.not": commented_on_by_not, due_on_before: due_on_before, due_on_after: due_on_after, due_on: due_on, due_at_before: due_at_before, due_at_after: due_at_after, start_on_before: start_on_before, start_on_after: start_on_after, start_on: start_on, created_on_before: created_on_before, created_on_after: created_on_after, created_on: created_on, created_at_before: created_at_before, created_at_after: created_at_after, completed_on_before: completed_on_before, completed_on_after: completed_on_after, completed_on: completed_on, completed_at_before: completed_at_before, completed_at_after: completed_at_after, modified_on_before: modified_on_before, modified_on_after: modified_on_after, modified_on: modified_on, modified_at_before: modified_at_before, modified_at_after: modified_at_after, is_blocking: is_blocking, is_blocked: is_blocked, has_attachment: has_attachment, completed: completed, is_subtask: is_subtask, sort_by: sort_by, sort_ascending: sort_ascending }.reject { |_,v| v.nil? || Array(v).empty? }
390
+ params = { text: text, resource_subtype: resource_subtype, "assignee.any": assignee_any, "assignee.not": assignee_not, "portfolios.any": portfolios_any, "projects.any": projects_any, "projects.not": projects_not, "projects.all": projects_all, "sections.any": sections_any, "sections.not": sections_not, "sections.all": sections_all, "tags.any": tags_any, "tags.not": tags_not, "tags.all": tags_all, "teams.any": teams_any, "followers.not": followers_not, "created_by.any": created_by_any, "created_by.not": created_by_not, "assigned_by.any": assigned_by_any, "assigned_by.not": assigned_by_not, "liked_by.not": liked_by_not, "commented_on_by.not": commented_on_by_not, due_on_before: due_on_before, due_on_after: due_on_after, due_on: due_on, due_at_before: due_at_before, due_at_after: due_at_after, start_on_before: start_on_before, start_on_after: start_on_after, start_on: start_on, created_on_before: created_on_before, created_on_after: created_on_after, created_on: created_on, created_at_before: created_at_before, created_at_after: created_at_after, completed_on_before: completed_on_before, completed_on_after: completed_on_after, completed_on: completed_on, completed_at_before: completed_at_before, completed_at_after: completed_at_after, modified_on_before: modified_on_before, modified_on_after: modified_on_after, modified_on: modified_on, modified_at_before: modified_at_before, modified_at_after: modified_at_after, is_blocking: is_blocking, is_blocked: is_blocked, has_attachment: has_attachment, completed: completed, is_subtask: is_subtask, sort_by: sort_by, sort_ascending: sort_ascending }.reject { |_,v| v.nil? || Array(v).empty? }
393
391
  Collection.new(parse(client.get(path, params: params, options: options)), type: Task, client: client)
394
392
  end
395
393
 
@@ -22,35 +22,35 @@ module Asana
22
22
  def add_user_for_team(client, team_gid: required("team_gid"), options: {}, **data)
23
23
  path = "/teams/{team_gid}/addUser"
24
24
  path["{team_gid}"] = team_gid
25
- User.new(parse(client.post(path, body: data, options: options)).first, client: client)
25
+ parse(client.post(path, body: data, options: options)).first
26
26
  end
27
27
 
28
- # Get a team
28
+ # Create a team
29
29
  #
30
- # team_gid - [str] (required) Globally unique identifier for the team.
30
+
31
31
  # options - [Hash] the request I/O options
32
32
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
33
33
  # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
34
34
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
35
35
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
36
- def get_team(client, team_gid: required("team_gid"), options: {})
37
- path = "/teams/{team_gid}"
38
- path["{team_gid}"] = team_gid
39
- Team.new(parse(client.get(path, options: options)).first, client: client)
36
+ # data - [Hash] the attributes to POST
37
+ def create_team(client, options: {}, **data)
38
+ path = "/teams"
39
+ Team.new(parse(client.post(path, body: data, options: options)).first, client: client)
40
40
  end
41
41
 
42
- # Get teams in an organization
42
+ # Get a team
43
43
  #
44
- # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
44
+ # team_gid - [str] (required) Globally unique identifier for the team.
45
45
  # options - [Hash] the request I/O options
46
46
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
47
47
  # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
48
48
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
49
49
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
50
- def get_teams_for_organization(client, workspace_gid: required("workspace_gid"), options: {})
51
- path = "/organizations/{workspace_gid}/teams"
52
- path["{workspace_gid}"] = workspace_gid
53
- Collection.new(parse(client.get(path, options: options)), type: Team, client: client)
50
+ def get_team(client, team_gid: required("team_gid"), options: {})
51
+ path = "/teams/{team_gid}"
52
+ path["{team_gid}"] = team_gid
53
+ Team.new(parse(client.get(path, options: options)).first, client: client)
54
54
  end
55
55
 
56
56
  # Get teams for a user
@@ -69,6 +69,20 @@ module Asana
69
69
  Collection.new(parse(client.get(path, params: params, options: options)), type: Team, client: client)
70
70
  end
71
71
 
72
+ # Get teams in a workspace
73
+ #
74
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
75
+ # options - [Hash] the request I/O options
76
+ # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
77
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
78
+ # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
79
+ # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
80
+ def get_teams_for_workspace(client, workspace_gid: required("workspace_gid"), options: {})
81
+ path = "/workspaces/{workspace_gid}/teams"
82
+ path["{workspace_gid}"] = workspace_gid
83
+ Collection.new(parse(client.get(path, options: options)), type: Team, client: client)
84
+ end
85
+
72
86
  # Remove a user from a team
73
87
  #
74
88
  # team_gid - [str] (required) Globally unique identifier for the team.
@@ -82,6 +96,20 @@ module Asana
82
96
  parse(client.post(path, body: data, options: options)).first
83
97
  end
84
98
 
99
+ # Update a team
100
+ #
101
+
102
+ # options - [Hash] the request I/O options
103
+ # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
104
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
105
+ # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
106
+ # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
107
+ # data - [Hash] the attributes to PUT
108
+ def update_team(client, options: {}, **data)
109
+ path = "/teams"
110
+ Team.new(parse(client.put(path, body: data, options: options)).first, client: client)
111
+ end
112
+
85
113
  end
86
114
  end
87
115
  end
@@ -0,0 +1,47 @@
1
+ ### WARNING: This file is auto-generated by our OpenAPI spec. Do not
2
+ ### edit it manually.
3
+
4
+ require_relative '../../resource_includes/response_helper'
5
+
6
+ module Asana
7
+ module Resources
8
+ class TimePeriodsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get a time period
16
+ #
17
+ # time_period_gid - [str] (required) Globally unique identifier for the time period.
18
+ # options - [Hash] the request I/O options
19
+ # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
20
+ # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
21
+ def get_time_period(client, time_period_gid: required("time_period_gid"), options: {})
22
+ path = "/time_periods/{time_period_gid}"
23
+ path["{time_period_gid}"] = time_period_gid
24
+ parse(client.get(path, options: options)).first
25
+ end
26
+
27
+ # Get time periods
28
+ #
29
+
30
+ # start_on - [date] ISO 8601 date string
31
+ # end_on - [date] ISO 8601 date string
32
+ # workspace - [str] (required) Globally unique identifier for the workspace.
33
+ # options - [Hash] the request I/O options
34
+ # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
35
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
36
+ # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
37
+ # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
38
+ def get_time_periods(client, start_on: nil, end_on: nil, workspace: nil, options: {})
39
+ path = "/time_periods"
40
+ params = { start_on: start_on, end_on: end_on, workspace: workspace }.reject { |_,v| v.nil? || Array(v).empty? }
41
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
@@ -15,9 +15,9 @@ module Asana
15
15
  # Get objects via typeahead
16
16
  #
17
17
  # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
18
- # resource_type - [str] (required) The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported.
18
+ # resource_type - [str] (required) The type of values the typeahead should return. You can choose from one of the following: `custom_field`, `project`, `project_template`, `portfolio`, `tag`, `task`, and `user`. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. `task`). Using multiple types is not yet supported.
19
19
  # type - [str] *Deprecated: new integrations should prefer the resource_type field.*
20
- # query - [str] The string that will be used to search for relevant objects. If an empty string is passed in, the API will currently return an empty result set.
20
+ # query - [str] The string that will be used to search for relevant objects. If an empty string is passed in, the API will return results.
21
21
  # count - [int] The number of results to return. The default is 20 if this parameter is omitted, with a minimum of 1 and a maximum of 100. If there are fewer results found than requested, all will be returned.
22
22
  # options - [Hash] the request I/O options
23
23
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
@@ -43,14 +43,15 @@ module Asana
43
43
  #
44
44
 
45
45
  # workspace - [str] The workspace or organization ID to filter users on.
46
+ # team - [str] The team ID to filter users on.
46
47
  # options - [Hash] the request I/O options
47
48
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
48
49
  # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
49
50
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
50
51
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
51
- def get_users(client, workspace: nil, options: {})
52
+ def get_users(client, workspace: nil, team: nil, options: {})
52
53
  path = "/users"
53
- params = { workspace: workspace }.reject { |_,v| v.nil? || Array(v).empty? }
54
+ params = { workspace: workspace, team: team }.reject { |_,v| v.nil? || Array(v).empty? }
54
55
  Collection.new(parse(client.get(path, params: params, options: options)), type: User, client: client)
55
56
  end
56
57
 
@@ -59,7 +60,6 @@ module Asana
59
60
  # team_gid - [str] (required) Globally unique identifier for the team.
60
61
  # options - [Hash] the request I/O options
61
62
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
62
- # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
63
63
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
64
64
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
65
65
  def get_users_for_team(client, team_gid: required("team_gid"), options: {})
@@ -73,7 +73,6 @@ module Asana
73
73
  # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
74
74
  # options - [Hash] the request I/O options
75
75
  # > offset - [str] Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
76
- # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
77
76
  # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
78
77
  # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
79
78
  def get_users_for_workspace(client, workspace_gid: required("workspace_gid"), options: {})
@@ -64,6 +64,19 @@ module Asana
64
64
  Collection.new(parse(client.get(path, params: params, options: options)), type: Webhook, client: client)
65
65
  end
66
66
 
67
+ # Update a webhook
68
+ #
69
+ # webhook_gid - [str] (required) Globally unique identifier for the webhook.
70
+ # options - [Hash] the request I/O options
71
+ # > opt_fields - [list[str]] Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
72
+ # > opt_pretty - [bool] Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
73
+ # data - [Hash] the attributes to PUT
74
+ def update_webhook(client, webhook_gid: required("webhook_gid"), options: {}, **data)
75
+ path = "/webhooks/{webhook_gid}"
76
+ path["{webhook_gid}"] = webhook_gid
77
+ Webhook.new(parse(client.put(path, body: data, options: options)).first, client: client)
78
+ end
79
+
67
80
  end
68
81
  end
69
82
  end
@@ -22,7 +22,7 @@ module Asana
22
22
  def add_user_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data)
23
23
  path = "/workspaces/{workspace_gid}/addUser"
24
24
  path["{workspace_gid}"] = workspace_gid
25
- User.new(parse(client.post(path, body: data, options: options)).first, client: client)
25
+ parse(client.post(path, body: data, options: options)).first
26
26
  end
27
27
 
28
28
  # Get a workspace
@@ -0,0 +1,54 @@
1
+ require_relative 'gen/goals_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class Goal < GoalsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :due_on
13
+
14
+ attr_reader :html_notes
15
+
16
+ attr_reader :is_workspace_level
17
+
18
+ attr_reader :liked
19
+
20
+ attr_reader :name
21
+
22
+ attr_reader :notes
23
+
24
+ attr_reader :start_on
25
+
26
+ attr_reader :status
27
+
28
+ attr_reader :current_status_update
29
+
30
+ attr_reader :followers
31
+
32
+ attr_reader :likes
33
+
34
+ attr_reader :metric
35
+
36
+ attr_reader :num_likes
37
+
38
+ attr_reader :owner
39
+
40
+ attr_reader :team
41
+
42
+ attr_reader :time_period
43
+
44
+ attr_reader :workspace
45
+
46
+ class << self
47
+ # Returns the plural name of the resource.
48
+ def plural_name
49
+ 'goals'
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,32 @@
1
+ require_relative 'gen/goal_relationships_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class GoalRelationship < GoalRelationshipsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :contribution_weight
13
+
14
+ attr_reader :resource_subtype
15
+
16
+ attr_reader :supported_goal
17
+
18
+ attr_reader :owner
19
+
20
+ attr_reader :supporting_resource
21
+
22
+ attr_reader :supporting_resource
23
+
24
+ class << self
25
+ # Returns the plural name of the resource.
26
+ def plural_name
27
+ 'goal_relationships'
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'gen/memberships_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class Membership < MembershipsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ class << self
13
+ # Returns the plural name of the resource.
14
+ def plural_name
15
+ 'memberships'
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -107,7 +107,7 @@ module Asana
107
107
  # options - [Hash] the request I/O options.
108
108
  def get_items(options: {})
109
109
 
110
- Collection.new(parse(client.get("/portfolios/#{gid}/items", options: options)), type: self, client: client)
110
+ Collection.new(parse(client.get("/portfolios/#{gid}/items", options: options)), type: Resource, client: client)
111
111
  end
112
112
 
113
113
  # Add an item to a portfolio.
@@ -165,7 +165,7 @@ module Asana
165
165
  # options - [Hash] the request I/O options.
166
166
  def custom_field_settings(options: {})
167
167
 
168
- Collection.new(parse(client.get("/portfolios/#{gid}/custom_field_settings", options: options)), type: self, client: client)
168
+ Collection.new(parse(client.get("/portfolios/#{gid}/custom_field_settings", options: options)), type: CustomFieldSetting, client: client)
169
169
  end
170
170
 
171
171
  # Create a new custom field setting on the portfolio. Returns the full
@@ -200,4 +200,4 @@ module Asana
200
200
 
201
201
  end
202
202
  end
203
- end
203
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'gen/project_briefs_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class ProjectBrief < ProjectBriefsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :html_text
13
+
14
+ attr_reader :title
15
+
16
+ attr_reader :permalink_url
17
+
18
+ attr_reader :project
19
+
20
+ attr_reader :text
21
+
22
+ class << self
23
+ # Returns the plural name of the resource.
24
+ def plural_name
25
+ 'project_briefs'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'gen/project_templates_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class ProjectTemplate < ProjectTemplatesBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :color
13
+
14
+ attr_reader :description
15
+
16
+ attr_reader :html_description
17
+
18
+ attr_reader :name
19
+
20
+ attr_reader :owner
21
+
22
+ attr_reader :public
23
+
24
+ attr_reader :requested_dates
25
+
26
+ attr_reader :team
27
+
28
+ class << self
29
+ # Returns the plural name of the resource.
30
+ def plural_name
31
+ 'project_templates'
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ require_relative 'gen/status_updates_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class StatusUpdate < StatusUpdatesBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :html_text
13
+
14
+ attr_reader :resource_subtype
15
+
16
+ attr_reader :status_type
17
+
18
+ attr_reader :text
19
+
20
+ attr_reader :title
21
+
22
+ attr_reader :author
23
+
24
+ attr_reader :created_at
25
+
26
+ attr_reader :created_by
27
+
28
+ attr_reader :hearted
29
+
30
+ attr_reader :hearts
31
+
32
+ attr_reader :liked
33
+
34
+ attr_reader :likes
35
+
36
+ attr_reader :created_at
37
+
38
+ attr_reader :modified_at
39
+
40
+ attr_reader :num_hearts
41
+
42
+ attr_reader :num_likes
43
+
44
+ attr_reader :parent
45
+
46
+ class << self
47
+ # Returns the plural name of the resource.
48
+ def plural_name
49
+ 'status_updates'
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'gen/time_periods_base'
2
+
3
+ module Asana
4
+ module Resources
5
+ class TimePeriod < TimePeriodsBase
6
+
7
+
8
+ attr_reader :gid
9
+
10
+ attr_reader :resource_type
11
+
12
+ attr_reader :display_name
13
+
14
+ attr_reader :end_on
15
+
16
+ attr_reader :parent
17
+
18
+ attr_reader :period
19
+
20
+ attr_reader :start_on
21
+
22
+ class << self
23
+ # Returns the plural name of the resource.
24
+ def plural_name
25
+ 'time_periods'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -14,7 +14,7 @@ module Asana
14
14
  class << self
15
15
  # Returns the plural name of the resource.
16
16
  def plural_name
17
- 'typeaheads'
17
+ 'typeahead'
18
18
  end
19
19
  end
20
20
  end