class Basecamp3::TodoList

A model for Basecamp's TODO List

{github.com/basecamp/bc3-api/blob/master/sections/todolists.md#to-do-lists For more information, see the official Basecamp3 API documentation for TODO lists}

Constants

REQUIRED_FIELDS

Attributes

completed[RW]
completed_ratio[RW]
created_at[RW]
description[RW]
id[RW]
name[RW]
status[RW]
updated_at[RW]

Public Class Methods

all(bucket_id, parent_id, params = {}) click to toggle source

Returns a paginated list of active TODO lists.

@param [Hash] params additional parameters @option params [String] :status (optional) when set to archived or trashed, will return archived or trashed to-do lists that are in this to-do list @option params [Integer] :page (optional) to paginate results

@return [Array<Basecamp3::TodoList>]

# File lib/basecamp3/models/todo_list.rb, line 36
def self.all(bucket_id, parent_id, params = {})
  Basecamp3.request.get("/buckets/#{bucket_id}/todosets/#{parent_id}/todolists", params, Basecamp3::TodoList)
end
create(bucket_id, parent_id, data) click to toggle source

Creates a TODO list.

@param [Integer] bucket_id the id of the bucket @param [Integer] parent_id the id of the TODO set @param [Hash] data the data to create a TODO list with @option params [String] :name (required) the name of the to-do list @option params [String] :description (optional) containing information about the to-do list

@return [Basecamp3::TodoList]

# File lib/basecamp3/models/todo_list.rb, line 59
def self.create(bucket_id, parent_id, data)
  self.validate_required(data)
  Basecamp3.request.post("/buckets/#{bucket_id}/todosets/#{parent_id}/todolists", data, Basecamp3::TodoList)
end
find(bucket_id, id) click to toggle source

Returns the TODO list.

@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO list

@return [Basecamp3::TodoList]

# File lib/basecamp3/models/todo_list.rb, line 46
def self.find(bucket_id, id)
  Basecamp3.request.get("/buckets/#{bucket_id}/todolists/#{id}", {}, Basecamp3::TodoList)
end
update(bucket_id, id, data) click to toggle source

Updates the TODO list.

@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO list @param [Hash] data the data to create the TODO list with @option params [String] :name (required) the name of the to-do list @option params [String] :description (optional) containing information about the to-do list

@return [Basecamp3::TodoList]

# File lib/basecamp3/models/todo_list.rb, line 73
def self.update(bucket_id, id, data)
  self.validate_required(data)
  Basecamp3.request.put("/buckets/#{bucket_id}/todolists/#{id}", data, Basecamp3::TodoList)
end

Public Instance Methods

todos() click to toggle source

Returns a list of related todos.

@return [Array<Basecamp3::Todo>]

# File lib/basecamp3/models/todo_list.rb, line 25
def todos
  @mapped_todos ||= Basecamp3::Todo.all(bucket.id, id)
end