Class: Asana::Resources::ProjectsBase
- Defined in:
- lib/asana/resources/gen/projects_base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.add_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add a custom field to a project.
-
.add_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add followers to a project.
-
.add_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add users to a project.
-
.create_project(client, options: {}, **data) ⇒ Object
options - [Hash] the request I/O options > opt_fields - [list] Defines fields to return.
-
.create_project_for_team(client, team_gid: required("team_gid"), options: {}, **data) ⇒ Object
Create a project in a team.
-
.create_project_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data) ⇒ Object
Create a project in a workspace.
-
.delete_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Delete a project.
-
.duplicate_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Duplicate a project.
-
.get_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Get a project.
-
.get_projects(client, workspace: nil, team: nil, archived: nil, options: {}) ⇒ Object
workspace - [str] The workspace or organization to filter projects on.
-
.get_projects_for_task(client, task_gid: required("task_gid"), options: {}) ⇒ Object
Get projects a task is in.
-
.get_projects_for_team(client, team_gid: required("team_gid"), archived: nil, options: {}) ⇒ Object
Get a team’s projects.
-
.get_projects_for_workspace(client, workspace_gid: required("workspace_gid"), archived: nil, options: {}) ⇒ Object
Get all projects in a workspace.
-
.get_task_counts_for_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Get task count of a project.
- .inherited(base) ⇒ Object
-
.project_save_as_template(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Create a project template from a project.
-
.remove_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove a custom field from a project.
-
.remove_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove followers from a project.
-
.remove_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove users from a project.
-
.update_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Update a project.
Methods inherited from Resource
#initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s
Methods included from ResponseHelper
Constructor Details
This class inherits a constructor from Asana::Resources::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource
Class Method Details
.add_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add a custom field to a project
21 22 23 24 25 |
# File 'lib/asana/resources/gen/projects_base.rb', line 21 def add_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/addCustomFieldSetting" path["{project_gid}"] = project_gid CustomFieldSetting.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.add_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add followers to a project
34 35 36 37 38 |
# File 'lib/asana/resources/gen/projects_base.rb', line 34 def add_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/addFollowers" path["{project_gid}"] = project_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.add_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Add users to a project
47 48 49 50 51 |
# File 'lib/asana/resources/gen/projects_base.rb', line 47 def add_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/addMembers" path["{project_gid}"] = project_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.create_project(client, options: {}, **data) ⇒ Object
options - [Hash] the request I/O options > opt_fields - [list] 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. > 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.
60 61 62 63 |
# File 'lib/asana/resources/gen/projects_base.rb', line 60 def create_project(client, options: {}, **data) path = "/projects" Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.create_project_for_team(client, team_gid: required("team_gid"), options: {}, **data) ⇒ Object
Create a project in a team
72 73 74 75 76 |
# File 'lib/asana/resources/gen/projects_base.rb', line 72 def create_project_for_team(client, team_gid: required("team_gid"), options: {}, **data) path = "/teams/{team_gid}/projects" path["{team_gid}"] = team_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.create_project_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data) ⇒ Object
Create a project in a workspace
85 86 87 88 89 |
# File 'lib/asana/resources/gen/projects_base.rb', line 85 def create_project_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data) path = "/workspaces/{workspace_gid}/projects" path["{workspace_gid}"] = workspace_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.delete_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Delete a project
97 98 99 100 101 |
# File 'lib/asana/resources/gen/projects_base.rb', line 97 def delete_project(client, project_gid: required("project_gid"), options: {}) path = "/projects/{project_gid}" path["{project_gid}"] = project_gid parse(client.delete(path, options: )).first end |
.duplicate_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Duplicate a project
110 111 112 113 114 |
# File 'lib/asana/resources/gen/projects_base.rb', line 110 def duplicate_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/duplicate" path["{project_gid}"] = project_gid Job.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.get_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Get a project
122 123 124 125 126 |
# File 'lib/asana/resources/gen/projects_base.rb', line 122 def get_project(client, project_gid: required("project_gid"), options: {}) path = "/projects/{project_gid}" path["{project_gid}"] = project_gid Project.new(parse(client.get(path, options: )).first, client: client) end |
.get_projects(client, workspace: nil, team: nil, archived: nil, options: {}) ⇒ Object
workspace - [str] The workspace or organization to filter projects on.
139 140 141 142 143 |
# File 'lib/asana/resources/gen/projects_base.rb', line 139 def get_projects(client, workspace: nil, team: nil, archived: nil, options: {}) path = "/projects" params = { workspace: workspace, team: team, archived: archived }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get(path, params: params, options: )), type: Project, client: client) end |
.get_projects_for_task(client, task_gid: required("task_gid"), options: {}) ⇒ Object
Get projects a task is in
153 154 155 156 157 |
# File 'lib/asana/resources/gen/projects_base.rb', line 153 def get_projects_for_task(client, task_gid: required("task_gid"), options: {}) path = "/tasks/{task_gid}/projects" path["{task_gid}"] = task_gid Collection.new(parse(client.get(path, options: )), type: Project, client: client) end |
.get_projects_for_team(client, team_gid: required("team_gid"), archived: nil, options: {}) ⇒ Object
Get a team’s projects
168 169 170 171 172 173 |
# File 'lib/asana/resources/gen/projects_base.rb', line 168 def get_projects_for_team(client, team_gid: required("team_gid"), archived: nil, options: {}) path = "/teams/{team_gid}/projects" path["{team_gid}"] = team_gid params = { archived: archived }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get(path, params: params, options: )), type: Project, client: client) end |
.get_projects_for_workspace(client, workspace_gid: required("workspace_gid"), archived: nil, options: {}) ⇒ Object
Get all projects in a workspace
184 185 186 187 188 189 |
# File 'lib/asana/resources/gen/projects_base.rb', line 184 def get_projects_for_workspace(client, workspace_gid: required("workspace_gid"), archived: nil, options: {}) path = "/workspaces/{workspace_gid}/projects" path["{workspace_gid}"] = workspace_gid params = { archived: archived }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get(path, params: params, options: )), type: Project, client: client) end |
.get_task_counts_for_project(client, project_gid: required("project_gid"), options: {}) ⇒ Object
Get task count of a project
199 200 201 202 203 |
# File 'lib/asana/resources/gen/projects_base.rb', line 199 def get_task_counts_for_project(client, project_gid: required("project_gid"), options: {}) path = "/projects/{project_gid}/task_counts" path["{project_gid}"] = project_gid parse(client.get(path, options: )).first end |
.inherited(base) ⇒ Object
10 11 12 |
# File 'lib/asana/resources/gen/projects_base.rb', line 10 def self.inherited(base) Registry.register(base) end |
.project_save_as_template(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Create a project template from a project
212 213 214 215 216 |
# File 'lib/asana/resources/gen/projects_base.rb', line 212 def project_save_as_template(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/saveAsTemplate" path["{project_gid}"] = project_gid Job.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.remove_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove a custom field from a project
224 225 226 227 228 |
# File 'lib/asana/resources/gen/projects_base.rb', line 224 def remove_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/removeCustomFieldSetting" path["{project_gid}"] = project_gid parse(client.post(path, body: data, options: )).first end |
.remove_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove followers from a project
237 238 239 240 241 |
# File 'lib/asana/resources/gen/projects_base.rb', line 237 def remove_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/removeFollowers" path["{project_gid}"] = project_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.remove_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Remove users from a project
250 251 252 253 254 |
# File 'lib/asana/resources/gen/projects_base.rb', line 250 def remove_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}/removeMembers" path["{project_gid}"] = project_gid Project.new(parse(client.post(path, body: data, options: )).first, client: client) end |
.update_project(client, project_gid: required("project_gid"), options: {}, **data) ⇒ Object
Update a project
263 264 265 266 267 |
# File 'lib/asana/resources/gen/projects_base.rb', line 263 def update_project(client, project_gid: required("project_gid"), options: {}, **data) path = "/projects/{project_gid}" path["{project_gid}"] = project_gid Project.new(parse(client.put(path, body: data, options: )).first, client: client) end |