Class: Asana::Workspace

Inherits:
Resource
  • Object
show all
Defined in:
lib/asana/resources/workspace.rb

Instance Method Summary collapse

Methods inherited from Resource

check_prefix_options, custom_method_collection_url, #method_not_allowed, parent_resources, prefix, prefix_options, prefix_source, #to_json

Instance Method Details

#create_project(*args) ⇒ Object



11
12
13
14
15
16
# File 'lib/asana/resources/workspace.rb', line 11

def create_project(*args)
  options = { :workspace => self.id }
  project = Project.new(options.merge(args.first))
  response = Project.post(nil, nil, project.to_json)
  Project.new(connection.format.decode(response.body))
end

#create_tag(*args) ⇒ Object



34
35
36
37
38
39
# File 'lib/asana/resources/workspace.rb', line 34

def create_tag(*args)
  options = { :workspace => self.id }
  tag = Tag.new(options.merge(args.first))
  response = Tag.post(nil, nil, tag.to_json)
  Tag.new(connection.format.decode(response.body))
end

#create_task(*args) ⇒ Object



23
24
25
26
27
28
# File 'lib/asana/resources/workspace.rb', line 23

def create_task(*args)
  options = { :workspace => self.id, :assignee => 'me' }
  task = Task.new(options.merge(args.first))
  response = Task.post(nil, nil, task.to_json)
  Task.new(connection.format.decode(response.body))
end

#projectsObject



7
8
9
# File 'lib/asana/resources/workspace.rb', line 7

def projects
  Project.all_by_workspace(:params => { :workspace_id => self.id })
end

#tagsObject



30
31
32
# File 'lib/asana/resources/workspace.rb', line 30

def tags
  Tag.all_by_workspace(:params => { :workspace_id => self.id })
end

#tasks(assignee) ⇒ Object



18
19
20
21
# File 'lib/asana/resources/workspace.rb', line 18

def tasks(assignee)
  query_options = { :workspace => self.id, :assignee => assignee }
  Task.all_by_workspace(:params => query_options)
end

#usersObject



41
42
43
# File 'lib/asana/resources/workspace.rb', line 41

def users
  User.all_by_workspace(:params => { :workspace_id => self.id })
end