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.



303
304
305
306
307
308
309
310
311
312
# File 'lib/basecamp.rb', line 303

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



314
315
316
317
318
319
320
# File 'lib/basecamp.rb', line 314

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