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) ⇒ Enumerator<Hash>
List todolists in a todoset.
-
#reposition(todolist_id:, position:) ⇒ void
Reposition a to-do list within its to-do set.
-
#update(id:, name: nil, description: nil) ⇒ Hash
Update an existing todolist or todolist group.
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
58 59 60 61 62 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 58 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}").json end end |
#list(todoset_id:, status: nil) ⇒ Enumerator<Hash>
List todolists in a todoset
45 46 47 48 49 50 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 45 def list(todoset_id:, status: nil) wrap_paginated(service: "todolists", operation: "list", is_mutation: false, resource_id: todoset_id) do params = compact_query_params(status: status) paginate("/todosets/#{todoset_id}/todolists.json", params: params) 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 |
#update(id:, name: nil, description: nil) ⇒ Hash
Update an existing todolist or todolist group
24 25 26 27 28 |
# File 'lib/basecamp/generated/services/todolists_service.rb', line 24 def update(id:, name: nil, description: nil) with_operation(service: "todolists", operation: "update", is_mutation: true, resource_id: id) do http_put("/todolists/#{id}", body: compact_params(name: name, description: description)).json end end |