Class: Basecamp::TodoList

Inherits:
Resource
  • Object
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_options, 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.



6
7
8
9
10
11
12
13
14
15
# File 'lib/basecamp/resources/todo_list.rb', line 6

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

#todo_items(options = {}) ⇒ Object



17
18
19
# File 'lib/basecamp/resources/todo_list.rb', line 17

def todo_items(options = {})
  @todo_items ||= TodoItem.find(:all, :params => options.merge(:todo_list_id => id))
end