Class: Basecamp::Services::MessageTypesService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::MessageTypesService
- Defined in:
- lib/basecamp/generated/services/message_types_service.rb
Overview
Service for MessageTypes operations
Instance Method Summary collapse
-
#create(bucket_id:, name:, icon:) ⇒ Hash
Create a new message type in a project.
-
#delete(bucket_id:, type_id:) ⇒ void
Delete a message type.
-
#get(bucket_id:, type_id:) ⇒ Hash
Get a single message type by id.
-
#list(bucket_id:, max_items: nil) ⇒ ListEnumerator<Hash>
List message types in a project.
-
#update(bucket_id:, type_id:, name: nil, icon: nil) ⇒ Hash
Update an existing message type.
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create(bucket_id:, name:, icon:) ⇒ Hash
Create a new message type in a project
25 26 27 28 29 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 25 def create(bucket_id:, name:, icon:) with_operation(service: "messagetypes", operation: "create", is_mutation: true, project_id: bucket_id) do http_post("/buckets/#{bucket_id}/categories.json", body: compact_params(name: name, icon: icon)).json end end |
#delete(bucket_id:, type_id:) ⇒ void
This method returns an undefined value.
Delete a message type
57 58 59 60 61 62 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 57 def delete(bucket_id:, type_id:) with_operation(service: "messagetypes", operation: "delete", is_mutation: true, project_id: bucket_id, resource_id: type_id) do http_delete("/buckets/#{bucket_id}/categories/#{type_id}") nil end end |
#get(bucket_id:, type_id:) ⇒ Hash
Get a single message type by id
35 36 37 38 39 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 35 def get(bucket_id:, type_id:) with_operation(service: "messagetypes", operation: "get", is_mutation: false, project_id: bucket_id, resource_id: type_id) do http_get("/buckets/#{bucket_id}/categories/#{type_id}", operation: "GetMessageType").json end end |
#list(bucket_id:, max_items: nil) ⇒ ListEnumerator<Hash>
List message types in a project
14 15 16 17 18 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 14 def list(bucket_id:, max_items: nil) wrap_paginated(service: "messagetypes", operation: "list", is_mutation: false, project_id: bucket_id) do paginate("/buckets/#{bucket_id}/categories.json", operation: "ListMessageTypes", max_items: max_items) end end |
#update(bucket_id:, type_id:, name: nil, icon: nil) ⇒ Hash
Update an existing message type
47 48 49 50 51 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 47 def update(bucket_id:, type_id:, name: nil, icon: nil) with_operation(service: "messagetypes", operation: "update", is_mutation: true, project_id: bucket_id, resource_id: type_id) do http_put("/buckets/#{bucket_id}/categories/#{type_id}", body: compact_params(name: name, icon: icon)).json end end |