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:) ⇒ Enumerator<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
24 25 26 27 28 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 24 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
56 57 58 59 60 61 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 56 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
34 35 36 37 38 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 34 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:) ⇒ Enumerator<Hash>
List message types in a project
13 14 15 16 17 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 13 def list(bucket_id:) wrap_paginated(service: "messagetypes", operation: "list", is_mutation: false, project_id: bucket_id) do paginate("/buckets/#{bucket_id}/categories.json", operation: "ListMessageTypes") end end |
#update(bucket_id:, type_id:, name: nil, icon: nil) ⇒ Hash
Update an existing message type
46 47 48 49 50 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 46 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 |