Class: Teambox::Project

Inherits:
Resource show all
Defined in:
lib/teambox-client/models/project.rb

Instance Attribute Summary

Attributes inherited from Resource

#data, #list, #references

Instance Method Summary collapse

Methods inherited from Resource

#created_at, #destroy, #id, #initialize, #inspect, #method_missing, #next, #prev, #reload, #save, #updated_at

Methods included from ReferenceList

#generate_references, #get_or_make_reference, #get_or_make_references, #get_reference, #set_reference

Constructor Details

This class inherits a constructor from Teambox::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Teambox::Resource

Instance Method Details

#comments(query = nil) ⇒ Object

Returns a Teambox::ResultSet of comments in this project



28
29
30
# File 'lib/teambox-client/models/project.rb', line 28

def comments(query=nil)
  @list.client.get("#{url}/comments", query)
end

#conversations(query = nil) ⇒ Object

Returns a Teambox::ResultSet of conversations in this project



13
14
15
# File 'lib/teambox-client/models/project.rb', line 13

def conversations(query=nil)
  @list.client.get("#{url}/conversations", query)
end

#create_comment(target, opts = {}) ⇒ Object

Creates a new Teambox::Comment in target belonging to this project



48
49
50
# File 'lib/teambox-client/models/project.rb', line 48

def create_comment(target, opts={})
  @list.client.post("#{url}/comments", opts.merge({'target_type' => target.class.to_s, 'target_id' => target.id}))
end

#create_conversation(opts = {}) ⇒ Object

Creates a new Teambox::Conversation in this project



33
34
35
# File 'lib/teambox-client/models/project.rb', line 33

def create_conversation(opts={})
  @list.client.post("#{url}/conversations", opts)
end

#create_task(task_list, opts = {}) ⇒ Object

Creates a new Teambox::Task in this project



43
44
45
# File 'lib/teambox-client/models/project.rb', line 43

def create_task(task_list, opts={})
  @list.client.post("#{url}/task_lists/#{task_list.id}/tasks", opts)
end

#create_task_list(opts = {}) ⇒ Object

Creates a new Teambox::TaskList in this project



38
39
40
# File 'lib/teambox-client/models/project.rb', line 38

def create_task_list(opts={})
  @list.client.post("#{url}/task_lists", opts)
end

#owner_userObject

Teambox::User who created this project



4
5
6
# File 'lib/teambox-client/models/project.rb', line 4

def owner_user
  get_or_make_reference('User', @data, 'owner_user_id')
end

#task_lists(query = nil) ⇒ Object

Returns a Teambox::ResultSet of task lists in this project



18
19
20
# File 'lib/teambox-client/models/project.rb', line 18

def task_lists(query=nil)
  @list.client.get("#{url}/task_lists", query)
end

#tasks(query = nil) ⇒ Object

Returns a Teambox::ResultSet of tasks in this project



23
24
25
# File 'lib/teambox-client/models/project.rb', line 23

def tasks(query=nil)
  @list.client.get("#{url}/tasks", query)
end

#urlObject

:nodoc:



8
9
10
# File 'lib/teambox-client/models/project.rb', line 8

def url #:nodoc:
  "/projects/#{@data['permalink']||@data['id']}"
end