asana 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) 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/.ruby-version +1 -1
  7. data/.swagger-codegen-ignore +0 -1
  8. data/Appraisals +2 -35
  9. data/Gemfile +2 -0
  10. data/Gemfile.lock +174 -0
  11. data/README.md +23 -58
  12. data/Rakefile +10 -14
  13. data/VERSION +1 -0
  14. data/asana.gemspec +5 -5
  15. data/examples/Gemfile.lock +10 -10
  16. data/lib/asana/client.rb +10 -10
  17. data/lib/asana/http_client/error_handling.rb +11 -4
  18. data/lib/asana/resource_includes/attachment_uploading.rb +14 -7
  19. data/lib/asana/resources/gen/attachments_base.rb +7 -6
  20. data/lib/asana/resources/gen/audit_log_api_base.rb +37 -0
  21. data/lib/asana/resources/gen/goals_base.rb +229 -0
  22. data/lib/asana/resources/gen/project_briefs_base.rb +68 -0
  23. data/lib/asana/resources/gen/project_templates_base.rb +73 -0
  24. data/lib/asana/resources/gen/projects_base.rb +14 -1
  25. data/lib/asana/resources/gen/status_updates_base.rb +72 -0
  26. data/lib/asana/resources/gen/tags_base.rb +16 -3
  27. data/lib/asana/resources/gen/tasks_base.rb +9 -10
  28. data/lib/asana/resources/gen/teams_base.rb +27 -13
  29. data/lib/asana/resources/gen/time_periods_base.rb +47 -0
  30. data/lib/asana/resources/gen/typeahead_base.rb +1 -1
  31. data/lib/asana/resources/gen/users_base.rb +3 -4
  32. data/lib/asana/resources/gen/webhooks_base.rb +13 -0
  33. data/lib/asana/resources/gen/workspaces_base.rb +1 -1
  34. data/lib/asana/resources/portfolio.rb +3 -3
  35. data/lib/asana/version.rb +1 -1
  36. data/package-lock.json +115 -0
  37. data/samples/attachments_sample.yaml +41 -0
  38. data/samples/audit_log_api_sample.yaml +11 -0
  39. data/samples/batch_api_sample.yaml +11 -0
  40. data/samples/custom_field_settings_sample.yaml +21 -0
  41. data/samples/custom_fields_sample.yaml +81 -0
  42. data/samples/events_sample.yaml +11 -0
  43. data/samples/goals_sample.yaml +161 -0
  44. data/samples/jobs_sample.yaml +11 -0
  45. data/samples/organization_exports_sample.yaml +21 -0
  46. data/samples/portfolio_memberships_sample.yaml +31 -0
  47. data/samples/portfolios_sample.yaml +121 -0
  48. data/samples/project_briefs_sample.yaml +41 -0
  49. data/samples/project_memberships_sample.yaml +21 -0
  50. data/samples/project_statuses_sample.yaml +41 -0
  51. data/samples/project_templates_sample.yaml +41 -0
  52. data/samples/projects_sample.yaml +191 -0
  53. data/samples/sections_sample.yaml +71 -0
  54. data/samples/status_updates_sample.yaml +41 -0
  55. data/samples/stories_sample.yaml +51 -0
  56. data/samples/tags_sample.yaml +81 -0
  57. data/samples/tasks_sample.yaml +261 -0
  58. data/samples/team_memberships_sample.yaml +41 -0
  59. data/samples/teams_sample.yaml +61 -0
  60. data/samples/time_periods_sample.yaml +21 -0
  61. data/samples/typeahead_sample.yaml +11 -0
  62. data/samples/user_task_lists_sample.yaml +21 -0
  63. data/samples/users_sample.yaml +51 -0
  64. data/samples/webhooks_sample.yaml +51 -0
  65. data/samples/workspace_memberships_sample.yaml +31 -0
  66. data/samples/workspaces_sample.yaml +51 -0
  67. data/swagger_templates/api.mustache +1 -1
  68. data/swagger_templates/api_doc.mustache +12 -0
  69. data/swagger_templates/ruby-config.json +1 -2
  70. metadata +62 -15
  71. data/.travis.yml +0 -15
@@ -5,8 +5,9 @@ module Asana
5
5
  module AttachmentUploading
6
6
  # Uploads a new attachment to the resource.
7
7
  #
8
- # filename - [String] the absolute path of the file to upload.
8
+ # filename - [String] the absolute path of the file to upload OR the desired filename when using +io+
9
9
  # mime - [String] the MIME type of the file
10
+ # io - [IO] an object which returns the file's content on +#read+, e.g. a +::StringIO+
10
11
  # options - [Hash] the request I/O options
11
12
  # data - [Hash] extra attributes to post
12
13
  #
@@ -14,16 +15,22 @@ module Asana
14
15
  # rubocop:disable Metrics/MethodLength
15
16
  def attach(filename: required('filename'),
16
17
  mime: required('mime'),
17
- options: {}, **data)
18
- path = File.expand_path(filename)
19
- unless File.exist?(path)
20
- raise ArgumentError, "file #{filename} doesn't exist"
21
- end
22
- upload = Faraday::UploadIO.new(path, mime)
18
+ io: nil, options: {}, **data)
19
+
20
+ upload = if io.nil?
21
+ path = File.expand_path(filename)
22
+ raise ArgumentError, "file #{filename} doesn't exist" unless File.exist?(path)
23
+
24
+ Faraday::FilePart.new(path, mime)
25
+ else
26
+ Faraday::FilePart.new(io, mime, filename)
27
+ end
28
+
23
29
  response = client.post("/#{self.class.plural_name}/#{gid}/attachments",
24
30
  body: data,
25
31
  upload: upload,
26
32
  options: options)
33
+
27
34
  Attachment.new(parse(response).first, client: client)
28
35
  end
29
36
  # rubocop:enable Metrics/MethodLength
@@ -36,18 +36,19 @@ module Asana
36
36
  Attachment.new(parse(client.get(path, options: options)).first, client: client)
37
37
  end
38
38
 
39
- # Get attachments for a task
39
+ # Get attachments from an object
40
40
  #
41
- # task_gid - [str] (required) The task to operate on.
41
+
42
+ # parent - [str] (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a task or project_brief.
42
43
  # options - [Hash] the request I/O options
43
44
  # > 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.'
44
45
  # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
45
46
  # > 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.
46
47
  # > 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.
47
- def get_attachments_for_task(client, task_gid: required("task_gid"), options: {})
48
- path = "/tasks/{task_gid}/attachments"
49
- path["{task_gid}"] = task_gid
50
- Collection.new(parse(client.get(path, options: options)), type: Attachment, client: client)
48
+ def get_attachments_for_object(client, parent: nil, options: {})
49
+ path = "/attachments"
50
+ params = { parent: parent }.reject { |_,v| v.nil? || Array(v).empty? }
51
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Attachment, client: client)
51
52
  end
52
53
 
53
54
  end
@@ -0,0 +1,37 @@
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 AuditLogAPIBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get audit log events
16
+ #
17
+ # workspace_gid - [str] (required) Globally unique identifier for the workspace or organization.
18
+ # start_at - [datetime] Filter to events created after this time (inclusive).
19
+ # end_at - [datetime] Filter to events created before this time (exclusive).
20
+ # event_type - [str] Filter to events of this type. Refer to the [Supported AuditLogEvents](/docs/supported-auditlogevents) for a full list of values.
21
+ # actor_type - [str] Filter to events with an actor of this type. This only needs to be included if querying for actor types without an ID. If `actor_gid` is included, this should be excluded.
22
+ # actor_gid - [str] Filter to events triggered by the actor with this ID.
23
+ # resource_gid - [str] Filter to events with this resource ID.
24
+ # options - [Hash] the request I/O options
25
+ # > 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.'
26
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
27
+ def get_audit_log_events(client, workspace_gid: required("workspace_gid"), start_at: nil, end_at: nil, event_type: nil, actor_type: nil, actor_gid: nil, resource_gid: nil, options: {})
28
+ path = "/workspaces/{workspace_gid}/audit_log_events"
29
+ path["{workspace_gid}"] = workspace_gid
30
+ params = { start_at: start_at, end_at: end_at, event_type: event_type, actor_type: actor_type, actor_gid: actor_gid, resource_gid: resource_gid }.reject { |_,v| v.nil? || Array(v).empty? }
31
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,229 @@
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 GoalsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Add a collaborator to a goal
16
+ #
17
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
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
+ # data - [Hash] the attributes to POST
22
+ def add_followers(client, goal_gid: required("goal_gid"), options: {}, **data)
23
+ path = "/goals/{goal_gid}/addFollowers"
24
+ path["{goal_gid}"] = goal_gid
25
+ parse(client.post(path, body: data, options: options)).first
26
+ end
27
+
28
+ # Add a subgoal to a parent goal
29
+ #
30
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
31
+ # options - [Hash] the request I/O options
32
+ # > 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.
33
+ # > 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.
34
+ # data - [Hash] the attributes to POST
35
+ def add_subgoal(client, goal_gid: required("goal_gid"), options: {}, **data)
36
+ path = "/goals/{goal_gid}/addSubgoal"
37
+ path["{goal_gid}"] = goal_gid
38
+ parse(client.post(path, body: data, options: options)).first
39
+ end
40
+
41
+ # Add a project/portfolio as supporting work for a goal.
42
+ #
43
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
44
+ # options - [Hash] the request I/O options
45
+ # > 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.
46
+ # > 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.
47
+ # data - [Hash] the attributes to POST
48
+ def add_supporting_work_for_goal(client, goal_gid: required("goal_gid"), options: {}, **data)
49
+ path = "/goals/{goal_gid}/addSupportingWork"
50
+ path["{goal_gid}"] = goal_gid
51
+ parse(client.post(path, body: data, options: options)).first
52
+ end
53
+
54
+ # Create a goal
55
+ #
56
+
57
+ # options - [Hash] the request I/O options
58
+ # > 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.'
59
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
60
+ # > 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.
61
+ # > 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.
62
+ # data - [Hash] the attributes to POST
63
+ def create_goal(client, options: {}, **data)
64
+ path = "/goals"
65
+ parse(client.post(path, body: data, options: options)).first
66
+ end
67
+
68
+ # Create a goal metric
69
+ #
70
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
71
+ # options - [Hash] the request I/O options
72
+ # > 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.
73
+ # > 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.
74
+ # data - [Hash] the attributes to POST
75
+ def create_goal_metric(client, goal_gid: required("goal_gid"), options: {}, **data)
76
+ path = "/goals/{goal_gid}/setMetric"
77
+ path["{goal_gid}"] = goal_gid
78
+ parse(client.post(path, body: data, options: options)).first
79
+ end
80
+
81
+ # Delete a goal
82
+ #
83
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
84
+ # options - [Hash] the request I/O options
85
+ # > 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.
86
+ # > 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.
87
+ def delete_goal(client, goal_gid: required("goal_gid"), options: {})
88
+ path = "/goals/{goal_gid}"
89
+ path["{goal_gid}"] = goal_gid
90
+ parse(client.delete(path, options: options)).first
91
+ end
92
+
93
+ # Get a goal
94
+ #
95
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
96
+ # options - [Hash] the request I/O options
97
+ # > 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.
98
+ # > 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.
99
+ def get_goal(client, goal_gid: required("goal_gid"), options: {})
100
+ path = "/goals/{goal_gid}"
101
+ path["{goal_gid}"] = goal_gid
102
+ parse(client.get(path, options: options)).first
103
+ end
104
+
105
+ # Get goals
106
+ #
107
+
108
+ # portfolio - [str] Globally unique identifier for supporting portfolio.
109
+ # project - [str] Globally unique identifier for supporting project.
110
+ # is_workspace_level - [bool] Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter.
111
+ # team - [str] Globally unique identifier for the team.
112
+ # workspace - [str] Globally unique identifier for the workspace.
113
+ # time_periods - [list[str]] Globally unique identifiers for the time periods.
114
+ # options - [Hash] the request I/O options
115
+ # > 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.'
116
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
117
+ # > 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.
118
+ # > 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.
119
+ def get_goals(client, portfolio: nil, project: nil, is_workspace_level: nil, team: nil, workspace: nil, time_periods: nil, options: {})
120
+ path = "/goals"
121
+ params = { portfolio: portfolio, project: project, is_workspace_level: is_workspace_level, team: team, workspace: workspace, time_periods: time_periods }.reject { |_,v| v.nil? || Array(v).empty? }
122
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
123
+ end
124
+
125
+ # Get parent goals from a goal
126
+ #
127
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
128
+ # options - [Hash] the request I/O options
129
+ # > 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.
130
+ # > 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.
131
+ def get_parent_goals_for_goal(client, goal_gid: required("goal_gid"), options: {})
132
+ path = "/goals/{goal_gid}/parentGoals"
133
+ path["{goal_gid}"] = goal_gid
134
+ Collection.new(parse(client.get(path, options: options)), type: Resource, client: client)
135
+ end
136
+
137
+ # Get subgoals from a goal
138
+ #
139
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
140
+ # options - [Hash] the request I/O options
141
+ # > 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.
142
+ # > 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.
143
+ def get_subgoals_for_goal(client, goal_gid: required("goal_gid"), options: {})
144
+ path = "/goals/{goal_gid}/subgoals"
145
+ path["{goal_gid}"] = goal_gid
146
+ Collection.new(parse(client.get(path, options: options)), type: Resource, client: client)
147
+ end
148
+
149
+ # Remove a collaborator from a goal
150
+ #
151
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
152
+ # options - [Hash] the request I/O options
153
+ # > 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.
154
+ # > 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.
155
+ # data - [Hash] the attributes to POST
156
+ def remove_followers(client, goal_gid: required("goal_gid"), options: {}, **data)
157
+ path = "/goals/{goal_gid}/removeFollowers"
158
+ path["{goal_gid}"] = goal_gid
159
+ parse(client.post(path, body: data, options: options)).first
160
+ end
161
+
162
+ # Remove a subgoal from a goal
163
+ #
164
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
165
+ # options - [Hash] the request I/O options
166
+ # > 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.
167
+ # > 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.
168
+ # data - [Hash] the attributes to POST
169
+ def remove_subgoal(client, goal_gid: required("goal_gid"), options: {}, **data)
170
+ path = "/goals/{goal_gid}/removeSubgoal"
171
+ path["{goal_gid}"] = goal_gid
172
+ parse(client.post(path, body: data, options: options)).first
173
+ end
174
+
175
+ # Remove a project/portfolio as supporting work for a goal.
176
+ #
177
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
178
+ # options - [Hash] the request I/O options
179
+ # > 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.
180
+ # > 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.
181
+ # data - [Hash] the attributes to POST
182
+ def remove_supporting_work_for_goal(client, goal_gid: required("goal_gid"), options: {}, **data)
183
+ path = "/goals/{goal_gid}/removeSupportingWork"
184
+ path["{goal_gid}"] = goal_gid
185
+ parse(client.post(path, body: data, options: options)).first
186
+ end
187
+
188
+ # Get supporting work from a goal
189
+ #
190
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
191
+ # options - [Hash] the request I/O options
192
+ # > 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.
193
+ # > 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.
194
+ def supporting_work(client, goal_gid: required("goal_gid"), options: {})
195
+ path = "/goals/{goal_gid}/supportingWork"
196
+ path["{goal_gid}"] = goal_gid
197
+ Collection.new(parse(client.get(path, options: options)), type: Project, client: client)
198
+ end
199
+
200
+ # Update a goal
201
+ #
202
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
203
+ # options - [Hash] the request I/O options
204
+ # > 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.
205
+ # > 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.
206
+ # data - [Hash] the attributes to PUT
207
+ def update_goal(client, goal_gid: required("goal_gid"), options: {}, **data)
208
+ path = "/goals/{goal_gid}"
209
+ path["{goal_gid}"] = goal_gid
210
+ parse(client.put(path, body: data, options: options)).first
211
+ end
212
+
213
+ # Update a goal metric
214
+ #
215
+ # goal_gid - [str] (required) Globally unique identifier for the goal.
216
+ # options - [Hash] the request I/O options
217
+ # > 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.
218
+ # > 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.
219
+ # data - [Hash] the attributes to POST
220
+ def update_goal_metric(client, goal_gid: required("goal_gid"), options: {}, **data)
221
+ path = "/goals/{goal_gid}/setMetricCurrentValue"
222
+ path["{goal_gid}"] = goal_gid
223
+ parse(client.post(path, body: data, options: options)).first
224
+ end
225
+
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,68 @@
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 ProjectBriefsBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Create a project brief
16
+ #
17
+ # project_gid - [str] (required) Globally unique identifier for the project.
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
+ # data - [Hash] the attributes to POST
22
+ def create_project_brief(client, project_gid: required("project_gid"), options: {}, **data)
23
+ path = "/projects/{project_gid}/project_briefs"
24
+ path["{project_gid}"] = project_gid
25
+ parse(client.post(path, body: data, options: options)).first
26
+ end
27
+
28
+ # Delete a project brief
29
+ #
30
+ # project_brief_gid - [str] (required) Globally unique identifier for the project brief.
31
+ # options - [Hash] the request I/O options
32
+ # > 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.
33
+ # > 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.
34
+ def delete_project_brief(client, project_brief_gid: required("project_brief_gid"), options: {})
35
+ path = "/project_briefs/{project_brief_gid}"
36
+ path["{project_brief_gid}"] = project_brief_gid
37
+ parse(client.delete(path, options: options)).first
38
+ end
39
+
40
+ # Get a project brief
41
+ #
42
+ # project_brief_gid - [str] (required) Globally unique identifier for the project brief.
43
+ # options - [Hash] the request I/O options
44
+ # > 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.
45
+ # > 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.
46
+ def get_project_brief(client, project_brief_gid: required("project_brief_gid"), options: {})
47
+ path = "/project_briefs/{project_brief_gid}"
48
+ path["{project_brief_gid}"] = project_brief_gid
49
+ parse(client.get(path, options: options)).first
50
+ end
51
+
52
+ # Update a project brief
53
+ #
54
+ # project_brief_gid - [str] (required) Globally unique identifier for the project brief.
55
+ # options - [Hash] the request I/O options
56
+ # > 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.
57
+ # > 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.
58
+ # data - [Hash] the attributes to PUT
59
+ def update_project_brief(client, project_brief_gid: required("project_brief_gid"), options: {}, **data)
60
+ path = "/project_briefs/{project_brief_gid}"
61
+ path["{project_brief_gid}"] = project_brief_gid
62
+ parse(client.put(path, body: data, options: options)).first
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,73 @@
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 ProjectTemplatesBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Get a project template
16
+ #
17
+ # project_template_gid - [str] (required) Globally unique identifier for the project template.
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_project_template(client, project_template_gid: required("project_template_gid"), options: {})
22
+ path = "/project_templates/{project_template_gid}"
23
+ path["{project_template_gid}"] = project_template_gid
24
+ parse(client.get(path, options: options)).first
25
+ end
26
+
27
+ # Get multiple project templates
28
+ #
29
+
30
+ # workspace - [str] The workspace to filter results on.
31
+ # team - [str] The team to filter projects on.
32
+ # options - [Hash] the request I/O options
33
+ # > 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.'
34
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
35
+ # > 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.
36
+ # > 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.
37
+ def get_project_templates(client, workspace: nil, team: nil, options: {})
38
+ path = "/project_templates"
39
+ params = { workspace: workspace, team: team }.reject { |_,v| v.nil? || Array(v).empty? }
40
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
41
+ end
42
+
43
+ # Get a team's project templates
44
+ #
45
+ # team_gid - [str] (required) Globally unique identifier for the team.
46
+ # options - [Hash] the request I/O options
47
+ # > 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
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
49
+ # > 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
+ # > 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_project_templates_for_team(client, team_gid: required("team_gid"), options: {})
52
+ path = "/teams/{team_gid}/project_templates"
53
+ path["{team_gid}"] = team_gid
54
+ Collection.new(parse(client.get(path, options: options)), type: Resource, client: client)
55
+ end
56
+
57
+ # Instantiate a project from a project template
58
+ #
59
+ # project_template_gid - [str] (required) Globally unique identifier for the project template.
60
+ # options - [Hash] the request I/O options
61
+ # > 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.
62
+ # > 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.
63
+ # data - [Hash] the attributes to POST
64
+ def instantiate_project(client, project_template_gid: required("project_template_gid"), options: {}, **data)
65
+ path = "/project_templates/{project_template_gid}/instantiateProject"
66
+ path["{project_template_gid}"] = project_template_gid
67
+ Job.new(parse(client.post(path, body: data, options: options)).first, client: client)
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
@@ -21,7 +21,7 @@ module Asana
21
21
  def add_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data)
22
22
  path = "/projects/{project_gid}/addCustomFieldSetting"
23
23
  path["{project_gid}"] = project_gid
24
- parse(client.post(path, body: data, options: options)).first
24
+ CustomFieldSetting.new(parse(client.post(path, body: data, options: options)).first, client: client)
25
25
  end
26
26
 
27
27
  # Add followers to a project
@@ -202,6 +202,19 @@ module Asana
202
202
  parse(client.get(path, options: options)).first
203
203
  end
204
204
 
205
+ # Create a project template from a project
206
+ #
207
+ # project_gid - [str] (required) Globally unique identifier for the project.
208
+ # options - [Hash] the request I/O options
209
+ # > 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.
210
+ # > 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.
211
+ # data - [Hash] the attributes to POST
212
+ def project_save_as_template(client, project_gid: required("project_gid"), options: {}, **data)
213
+ path = "/projects/{project_gid}/saveAsTemplate"
214
+ path["{project_gid}"] = project_gid
215
+ Job.new(parse(client.post(path, body: data, options: options)).first, client: client)
216
+ end
217
+
205
218
  # Remove a custom field from a project
206
219
  #
207
220
  # project_gid - [str] (required) Globally unique identifier for the project.
@@ -0,0 +1,72 @@
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 StatusUpdatesBase < Resource
9
+
10
+ def self.inherited(base)
11
+ Registry.register(base)
12
+ end
13
+
14
+ class << self
15
+ # Create a status update
16
+ #
17
+
18
+ # options - [Hash] the request I/O options
19
+ # > 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.'
20
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
21
+ # > 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.
22
+ # > 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.
23
+ # data - [Hash] the attributes to POST
24
+ def create_status_for_object(client, options: {}, **data)
25
+ path = "/status_updates"
26
+ parse(client.post(path, body: data, options: options)).first
27
+ end
28
+
29
+ # Delete a status update
30
+ #
31
+ # status_gid - [str] (required) The status update to get.
32
+ # options - [Hash] the request I/O options
33
+ # > 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.
34
+ # > 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.
35
+ def delete_status(client, status_gid: required("status_gid"), options: {})
36
+ path = "/status_updates/{status_gid}"
37
+ path["{status_gid}"] = status_gid
38
+ parse(client.delete(path, options: options)).first
39
+ end
40
+
41
+ # Get a status update
42
+ #
43
+ # status_gid - [str] (required) The status update to get.
44
+ # options - [Hash] the request I/O options
45
+ # > 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.
46
+ # > 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.
47
+ def get_status(client, status_gid: required("status_gid"), options: {})
48
+ path = "/status_updates/{status_gid}"
49
+ path["{status_gid}"] = status_gid
50
+ parse(client.get(path, options: options)).first
51
+ end
52
+
53
+ # Get status updates from an object
54
+ #
55
+
56
+ # parent - [str] (required) Globally unique identifier for object to fetch statuses from. Must be a GID for a project, portfolio, or goal.
57
+ # created_since - [datetime] Only return statuses that have been created since the given time.
58
+ # options - [Hash] the request I/O options
59
+ # > 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.'
60
+ # > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100.
61
+ # > 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.
62
+ # > 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.
63
+ def get_statuses_for_object(client, parent: nil, created_since: nil, options: {})
64
+ path = "/status_updates"
65
+ params = { parent: parent, created_since: created_since }.reject { |_,v| v.nil? || Array(v).empty? }
66
+ Collection.new(parse(client.get(path, params: params, options: options)), type: Resource, client: client)
67
+ end
68
+
69
+ end
70
+ end
71
+ end
72
+ end