Class: Basecamp::TodoList
- Inherits:
-
Resource
- Object
- ActiveResource::Base
- Resource
- Basecamp::TodoList
show all
- Defined in:
- lib/basecamp/resources/todo_list.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
check_prefix_options, first, last, parent_resources, prefix, prefix_source
Class Method Details
.all(project_id, complete = nil) ⇒ Object
Returns all lists for a project. If complete is true, only completed lists are returned. If complete is false, only uncompleted lists are returned.
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/basecamp/resources/todo_list.rb', line 4
def self.all(project_id, complete = nil)
filter = case complete
when nil then "all"
when true then "finished"
when false then "pending"
else raise ArgumentError, "invalid value for `complete'"
end
find(:all, :params => { :project_id => project_id, :filter => filter })
end
|
Instance Method Details
#prefix_options ⇒ Object
23
24
25
|
# File 'lib/basecamp/resources/todo_list.rb', line 23
def prefix_options
{ :project_id => project_id }
end
|
#project ⇒ Object
15
16
17
|
# File 'lib/basecamp/resources/todo_list.rb', line 15
def project
@project ||= Project.find(project_id)
end
|
#todo_items(options = {}) ⇒ Object
19
20
21
|
# File 'lib/basecamp/resources/todo_list.rb', line 19
def todo_items(options = {})
@todo_items ||= TodoItem.find(:all, :params => options.merge(:todo_list_id => id))
end
|