Module: Camper::Client::TodolistsAPI
- Included in:
- Camper::Client
- Defined in:
- lib/camper/api/todolists.rb
Overview
Defines methods related to todolists.
Instance Method Summary collapse
-
#create_todolist(todoset, name, description = '') ⇒ Resource
Create a todolist within the given todoset.
-
#todolist(todoset, id) ⇒ Resource
Get a todolist with a given id.
-
#todolists(todoset, options = {}) ⇒ PaginatedResponse<Resource>
Get the todolists associated with the todoset.
-
#trash_todolist(todolist) ⇒ Object
Trash a todolist it calls the trash_recording endpoint under the hood.
-
#update_todolist(todolist, name, description = nil) ⇒ Resource
Update a todolist to change name and description.
Instance Method Details
#create_todolist(todoset, name, description = '') ⇒ Resource
Create a todolist within the given todoset
50 51 52 53 54 |
# File 'lib/camper/api/todolists.rb', line 50 def create_todolist(todoset, name, description = '') body = { name: name, description: description } post(todoset.todolists_url, body: body, override_path: true) end |
#todolist(todoset, id) ⇒ Resource
Get a todolist with a given id
34 35 36 |
# File 'lib/camper/api/todolists.rb', line 34 def todolist(todoset, id) get("/buckets/#{todoset.bucket.id}/todolists/#{id}") end |
#todolists(todoset, options = {}) ⇒ PaginatedResponse<Resource>
Get the todolists associated with the todoset
21 22 23 |
# File 'lib/camper/api/todolists.rb', line 21 def todolists(todoset, = {}) get(todoset.todolists_url, query: , override_path: true) end |
#trash_todolist(todolist) ⇒ Object
Trash a todolist
it calls the trash_recording endpoint under the hood
90 91 92 |
# File 'lib/camper/api/todolists.rb', line 90 def trash_todolist(todolist) trash_recording(todolist) end |
#update_todolist(todolist, name, description = nil) ⇒ Resource
Update a todolist to change name and description
73 74 75 76 77 78 |
# File 'lib/camper/api/todolists.rb', line 73 def update_todolist(todolist, name, description = nil) body = { name: name } body[:description] = description.nil? ? todolist.description : description put(todolist.url, body: body, override_path: true) end |