class Asana::Resources::User

A user object represents an account in Asana that can be given access to various workspaces, projects, and tasks.

Like other objects in the system, users are referred to by numerical IDs. However, the special string identifier ‘me` can be used anywhere a user ID is accepted, to refer to the current authenticated user.

Attributes

email[R]
id[R]
photo[R]
workspaces[R]

Public Class Methods

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

Returns the user records for all users in the specified workspace or organization.

workspace - [Id] The workspace or organization to filter users on. per_page - [Integer] the number of records to fetch per page. options - [Hash] the request I/O options.

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

Returns the full user record for a single user.

id - [Id] Globally unique identifier for the user.

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

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

  self.new(parse(client.get("/users/#{id}", options: options)).first, client: client)
end
find_by_workspace(client, workspace: required("workspace"), per_page: 20, options: {}) click to toggle source

Returns the user records for all users in all workspaces and organizations accessible to the authenticated user.

workspace - [Id] The workspace in which to get users. per_page - [Integer] the number of records to fetch per page. options - [Hash] the request I/O options.

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

Returns the full user record for the currently authenticated user.

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

# File lib/asana/resources/user.rb, line 32
def me(client, options: {})

  Resource.new(parse(client.get("/users/me", options: options)).first, client: client)
end
plural_name() click to toggle source

Returns the plural name of the resource.

# File lib/asana/resources/user.rb, line 25
def plural_name
  'users'
end