class Basecamp3::Todo
A model for Basecamp's TODO
{github.com/basecamp/bc3-api/blob/master/sections/todos.md#to-dos For more information, see the official Basecamp3
API documentation for TODOs}
Constants
- REQUIRED_FIELDS
Attributes
Public Class Methods
Returns a paginated list of active TODOs.
@param [Hash] params additional parameters @option params [String] :status (optional) when set to archived or trashed, will return archived or trashed to-dos that are in this list @option params [Boolean] :completed (optional) when set to true, will only return to-dos that are completed @option params [Integer] :page (optional) to paginate results
@return [Array<Basecamp3::Todo>]
# File lib/basecamp3/models/todo.rb, line 37 def self.all(bucket_id, parent_id, params = {}) Basecamp3.request.get("/buckets/#{bucket_id}/todolists/#{parent_id}/todos", params, Basecamp3::Todo) end
Completes the TODO.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO
@return [Boolean]
# File lib/basecamp3/models/todo.rb, line 95 def self.complete(bucket_id, id) Basecamp3.request.post("/buckets/#{bucket_id}/todos/#{id}/completion") end
Creates a TODO.
@param [Integer] bucket_id the id of the bucket @param [Integer] parent_id the id of the TODO list @param [Hash] data the data to create a TODO with @option params [String] :content (required) for what the to-do is for @option params [String] :description (optional) containing information about the to-do @option params [Array<Integer>] :assignee_ids (optional) an array of people that will be assigned to this to-do @option params [Boolean] :notify (optional) when set to true, will notify the assignees about being assigned @option params [Date] :due_on (optional) a date when the to-do should be completed @option params [Date] :starts_on (optional) allows the to-do to run from this date to the due_on
date
@return [Basecamp3::Todo]
# File lib/basecamp3/models/todo.rb, line 64 def self.create(bucket_id, parent_id, data) self.validate_required(data) Basecamp3.request.post("/buckets/#{bucket_id}/todolists/#{parent_id}/todos", data, Basecamp3::Todo) end
Returns the TODO.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO
@return [Basecamp3::Todo]
# File lib/basecamp3/models/todo.rb, line 47 def self.find(bucket_id, id) Basecamp3.request.get("/buckets/#{bucket_id}/todos/#{id}", {}, Basecamp3::Todo) end
Incompletes the TODO.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO
@return [Boolean]
# File lib/basecamp3/models/todo.rb, line 105 def self.incomplete(bucket_id, id) Basecamp3.request.delete("/buckets/#{bucket_id}/todos/#{id}/completion") end
Updates the TODO.
REMEMBER: Pass all existing parameters in addition to those being updated!
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the TODO @param [Hash] data the data to update the TODO with @option params [String] :content (required) for what the to-do is for @option params [String] :description (optional) containing information about the to-do @option params [Array<Integer>] :assignee_ids (optional) an array of people that will be assigned to this to-do @option params [Boolean] :notify (optional) when set to true, will notify the assignees about being assigned @option params [Date] :due_on (optional) a date when the to-do should be completed @option params [Date] :starts_on (optional) allows the to-do to run from this date to the due_on
date
@return [Basecamp3::Todo]
# File lib/basecamp3/models/todo.rb, line 84 def self.update(bucket_id, id, data) self.validate_required(data) Basecamp3.request.put("/buckets/#{bucket_id}/todos/#{id}", data, Basecamp3::Todo) end
Public Instance Methods
Returns a list of related assignees.
@return [Array<Basecamp3::Person>]
# File lib/basecamp3/models/todo.rb, line 25 def assignees @mapped_assignees ||= @assignees.map{ |a| Basecamp3::Person.new(a) } end