Class: Basecamp::Services::TodolistsService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::TodolistsService
- Defined in:
- lib/basecamp/generated/services/todolists_service.rb
Overview
Service for Todolists operations
Instance Method Summary collapse
-
#create(todoset_id:, name:, description: nil, visible_to_clients: nil) ⇒ Hash
Create a new todolist in a todoset.
-
#get(id:) ⇒ Hash
Get a single todolist or todolist group by id.
-
#list(todoset_id:, status: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List todolists in a todoset.
-
#replace(id:, name:, description: nil) ⇒ Hash
Replace a todolist (or todolist group) with a new complete representation.
-
#reposition(todolist_id:, position:) ⇒ void
Reposition a to-do list within its to-do set.
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create(todoset_id:, name:, description: nil, visible_to_clients: nil) ⇒ Hash
Create a new todolist in a todoset
60 61 62 63 64 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 60 def create(todoset_id:, name:, description: nil, visible_to_clients: nil) with_operation(service: "todolists", operation: "create", is_mutation: true, resource_id: todoset_id) do http_post("/todosets/#{todoset_id}/todolists.json", body: compact_params(name: name, description: description, visible_to_clients: visible_to_clients)).json end end |
#get(id:) ⇒ Hash
Get a single todolist or todolist group by id
13 14 15 16 17 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 13 def get(id:) with_operation(service: "todolists", operation: "get", is_mutation: false, resource_id: id) do http_get("/todolists/#{id}", operation: "GetTodolistOrGroup").json end end |
#list(todoset_id:, status: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List todolists in a todoset
47 48 49 50 51 52 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 47 def list(todoset_id:, status: nil, page: nil, max_items: nil) wrap_paginated(service: "todolists", operation: "list", is_mutation: false, resource_id: todoset_id) do params = compact_query_params(status: status, page: page) paginate("/todosets/#{todoset_id}/todolists.json", params: params, operation: "ListTodolists", max_items: max_items) end end |
#replace(id:, name:, description: nil) ⇒ Hash
Replace a todolist (or todolist group) with a new complete representation.
24 25 26 27 28 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 24 def replace(id:, name:, description: nil) with_operation(service: "todolists", operation: "replace", is_mutation: true, resource_id: id) do http_put("/todolists/#{id}", body: compact_params(name: name, description: description)).json end end |
#reposition(todolist_id:, position:) ⇒ void
This method returns an undefined value.
Reposition a to-do list within its to-do set.
34 35 36 37 38 39 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 34 def reposition(todolist_id:, position:) with_operation(service: "todolists", operation: "reposition", is_mutation: true, resource_id: todolist_id) do http_put("/todosets/todolists/#{todolist_id}/position.json", body: compact_params(position: position)) nil end end |