Class: Basecamp::TodoList

Inherits:
Resource
  • Object
show all
Defined in:
lib/basecamp.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

element_name, 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.



158
159
160
161
162
163
164
165
166
167
# File 'lib/basecamp.rb', line 158

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



169
170
171
# File 'lib/basecamp.rb', line 169

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