Method: Camper::Client::TodosAPI#todo

Defined in:
lib/camper/api/todos.rb

#todo(parent, id) ⇒ Resource

Get a todo with a given id using a particular parent resource.

Examples:

client.todo(my_project, '10')
client.todo(new_todolist, 134)
client.todo(67543, '2440')

Parameters:

  • parent (Integer|String|Project|Resource)

    can be either a project id, a project or a todolist resource

  • id (Integer|String)

    id of the todo

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/camper/api/todos.rb', line 48

def todo(parent, id)
  bucket_id = parent

  if parent.is_a? Camper::Project
    bucket_id = parent.id
  elsif parent.respond_to?(:type)
    bucket_id = parent.bucket.id
  end

  get("/buckets/#{bucket_id}/todos/#{id}")
end