class Asana::Resources::Workspace

A workspace is the highest-level organizational unit in Asana. All projects and tasks have an associated workspace.

An organization is a special kind of workspace that represents a company. In an organization, you can group your projects into teams. You can read more about how organizations work on the Asana Guide. To tell if your workspace is an organization or not, check its ‘is_organization` property.

Over time, we intend to migrate most workspaces into organizations and to release more organization-specific functionality. We may eventually deprecate using workspace-based APIs for organizations. Currently, and until after some reasonable grace period following any further announcements, you can still reference organizations in any ‘workspace` parameter.

Attributes

id[R]
is_organization[R]
name[R]

Public Class Methods

find_all(client, per_page: 20, options: {}) click to toggle source

Returns the compact records for all workspaces visible to the authorized user.

per_page - [Integer] the number of records to fetch per page. options - [Hash] the request I/O options.

# File lib/asana/resources/workspace.rb, line 49
def find_all(client, per_page: 20, options: {})
  params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
  Collection.new(parse(client.get("/workspaces", params: params, options: options)), type: self, client: client)
end
find_by_id(client, id, options: {}) click to toggle source

Returns the full workspace record for a single workspace.

id - [Id] Globally unique identifier for the workspace or organization.

options - [Hash] the request I/O options.

# File lib/asana/resources/workspace.rb, line 40
def find_by_id(client, id, options: {})

  self.new(parse(client.get("/workspaces/#{id}", options: options)).first, client: client)
end
plural_name() click to toggle source

Returns the plural name of the resource.

# File lib/asana/resources/workspace.rb, line 31
def plural_name
  'workspaces'
end

Public Instance Methods

typeahead(type: required("type"), query: nil, count: nil, per_page: 20, options: {}) click to toggle source

Retrieves objects in the workspace based on an auto-completion/typeahead search algorithm. This feature is meant to provide results quickly, so do not rely on this API to provide extremely accurate search results. The result set is limited to a single page of results with a maximum size, so you won’t be able to fetch large numbers of results.

type - [Enum] The type of values the typeahead should return. Note that unlike in the names of endpoints, the types listed here are in singular form (e.g. ‘task`). Using multiple types is not yet supported.

query - [String] The string that will be used to search for relevant objects. If an empty string is passed in, the API will currently return an empty result set.

count - [Number] The number of results to return. The default is ‘20` if this parameter is omitted, with a minimum of `1` and a maximum of `100`. If there are fewer results found than requested, all will be returned.

per_page - [Integer] the number of records to fetch per page. options - [Hash] the request I/O options.

# File lib/asana/resources/workspace.rb, line 84
def typeahead(type: required("type"), query: nil, count: nil, per_page: 20, options: {})
  params = { type: type, query: query, count: count, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }
  Collection.new(parse(client.get("/workspaces/#{id}/typeahead", params: params, options: options)), type: Resource, client: client)
end
update(options: {}, **data) click to toggle source

Update properties on a workspace. Returns the complete, updated workspace record.

options - [Hash] the request I/O options. data - [Hash] the attributes to post.

# File lib/asana/resources/workspace.rb, line 59
def update(options: {}, **data)

  refresh_with(parse(client.put("/workspaces/#{id}", body: data, options: options)).first)
end