class Asana::Resources::ProjectsBase

Public Class Methods

add_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Add a custom field to a project

project_gid - [str] (required) Globally unique identifier for the project. options - [Hash] the request I/O 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. data - [Hash] the attributes to POST

# 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: options)).first, client: client)
end
add_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Add followers to a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to POST

# 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
  parse(client.post(path, body: data, options: options)).first
end
add_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Add users to a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to POST

# 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
  parse(client.post(path, body: data, options: options)).first
end
create_project(client, options: {}, **data) click to toggle source

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. data - [Hash] the attributes to POST

# 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: options)).first, client: client)
end
create_project_for_team(client, team_gid: required("team_gid"), options: {}, **data) click to toggle source

Create a project in a team

team_gid - [str] (required) Globally unique identifier for the team. 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. data - [Hash] the attributes to POST

# 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: options)).first, client: client)
end
create_project_for_workspace(client, workspace_gid: required("workspace_gid"), options: {}, **data) click to toggle source

Create a project in a workspace

workspace_gid - [str] (required) Globally unique identifier for the workspace or organization. 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. data - [Hash] the attributes to POST

# 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: options)).first, client: client)
end
delete_project(client, project_gid: required("project_gid"), options: {}) click to toggle source

Delete a project

project_gid - [str] (required) Globally unique identifier for the project. 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.

# 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: options)).first
end
duplicate_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Duplicate a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to POST

# 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: options)).first, client: client)
end
get_project(client, project_gid: required("project_gid"), options: {}) click to toggle source

Get a project

project_gid - [str] (required) Globally unique identifier for the project. 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.

# 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: options)).first, client: client)
end
get_projects(client, workspace: nil, team: nil, archived: nil, options: {}) click to toggle source

workspace - [str] The workspace or organization to filter projects on. team - [str] The team to filter projects on. archived - [bool] Only return projects whose `archived` field takes on the value of this parameter. options - [Hash] the request I/O options > 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.' > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100. > 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.

# 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: options)), type: Project, client: client)
end
get_projects_for_task(client, task_gid: required("task_gid"), options: {}) click to toggle source

Get projects a task is in

task_gid - [str] (required) The task to operate on. options - [Hash] the request I/O options > 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.' > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100. > 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.

# 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: options)), type: Project, client: client)
end
get_projects_for_team(client, team_gid: required("team_gid"), archived: nil, options: {}) click to toggle source

Get a team's projects

team_gid - [str] (required) Globally unique identifier for the team. archived - [bool] Only return projects whose `archived` field takes on the value of this parameter. options - [Hash] the request I/O options > 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.' > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100. > 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.

# 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: options)), type: Project, client: client)
end
get_projects_for_workspace(client, workspace_gid: required("workspace_gid"), archived: nil, options: {}) click to toggle source

Get all projects in a workspace

workspace_gid - [str] (required) Globally unique identifier for the workspace or organization. archived - [bool] Only return projects whose `archived` field takes on the value of this parameter. options - [Hash] the request I/O options > 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.' > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100. > 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.

# 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: options)), type: Project, client: client)
end
get_task_counts_for_project(client, project_gid: required("project_gid"), options: {}) click to toggle source

Get task count of a project

project_gid - [str] (required) Globally unique identifier for the project. options - [Hash] the request I/O options > 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.' > limit - [int] Results per page. The number of objects to return per page. The value must be between 1 and 100. > 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.

# 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: options)).first
end
inherited(base) click to toggle source
# File lib/asana/resources/gen/projects_base.rb, line 10
def self.inherited(base)
  Registry.register(base)
end
remove_custom_field_setting_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Remove a custom field from a project

project_gid - [str] (required) Globally unique identifier for the project. options - [Hash] the request I/O 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. data - [Hash] the attributes to POST

# File lib/asana/resources/gen/projects_base.rb, line 211
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: options)).first
end
remove_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Remove followers from a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to POST

# File lib/asana/resources/gen/projects_base.rb, line 224
def remove_followers_for_project(client, project_gid: required("project_gid"), options: {}, **data)
  path = "/projects/{project_gid}/removeFollowers"
  path["{project_gid}"] = project_gid
  parse(client.post(path, body: data, options: options)).first
end
remove_members_for_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Remove users from a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to POST

# File lib/asana/resources/gen/projects_base.rb, line 237
def remove_members_for_project(client, project_gid: required("project_gid"), options: {}, **data)
  path = "/projects/{project_gid}/removeMembers"
  path["{project_gid}"] = project_gid
  parse(client.post(path, body: data, options: options)).first
end
update_project(client, project_gid: required("project_gid"), options: {}, **data) click to toggle source

Update a project

project_gid - [str] (required) Globally unique identifier for the project. 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. data - [Hash] the attributes to PUT

# File lib/asana/resources/gen/projects_base.rb, line 250
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: options)).first, client: client)
end