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(name:, icon:) ⇒ Hash
Create a new message type in a project.
-
#delete(type_id:) ⇒ void
Delete a message type.
-
#get(type_id:) ⇒ Hash
Get a single message type by id.
-
#list ⇒ Enumerator<Hash>
List message types in a project.
-
#update(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(name:, icon:) ⇒ Hash
Create a new message type in a project
22 23 24 25 26 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 22 def create(name:, icon:) with_operation(service: "messagetypes", operation: "create", is_mutation: true) do http_post("/categories.json", body: compact_params(name: name, icon: icon)).json end end |
#delete(type_id:) ⇒ void
This method returns an undefined value.
Delete a message type
51 52 53 54 55 56 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 51 def delete(type_id:) with_operation(service: "messagetypes", operation: "delete", is_mutation: true, resource_id: type_id) do http_delete("/categories/#{type_id}") nil end end |
#get(type_id:) ⇒ Hash
Get a single message type by id
31 32 33 34 35 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 31 def get(type_id:) with_operation(service: "messagetypes", operation: "get", is_mutation: false, resource_id: type_id) do http_get("/categories/#{type_id}").json end end |
#list ⇒ Enumerator<Hash>
List message types in a project
12 13 14 15 16 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 12 def list() wrap_paginated(service: "messagetypes", operation: "list", is_mutation: false) do paginate("/categories.json") end end |
#update(type_id:, name: nil, icon: nil) ⇒ Hash
Update an existing message type
42 43 44 45 46 |
# File 'lib/basecamp/generated/services/message_types_service.rb', line 42 def update(type_id:, name: nil, icon: nil) with_operation(service: "messagetypes", operation: "update", is_mutation: true, resource_id: type_id) do http_put("/categories/#{type_id}", body: compact_params(name: name, icon: icon)).json end end |