Class: Basecamp::Services::MessagesService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::MessagesService
- Defined in:
- lib/basecamp/generated/services/messages_service.rb
Overview
Service for Messages operations
Instance Method Summary collapse
-
#create(board_id:, subject:, content: nil, status: nil, category_id: nil, subscriptions: nil, visible_to_clients: nil) ⇒ Hash
Create a new message on a message board.
-
#get(message_id:) ⇒ Hash
Get a single message by id.
-
#list(board_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List messages on a message board.
-
#pin(message_id:) ⇒ void
Pin a message to the top of the message board.
-
#unpin(message_id:) ⇒ void
Unpin a message from the message board.
-
#update(message_id:, subject: nil, content: nil, status: nil, category_id: nil) ⇒ Hash
Update an existing message.
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create(board_id:, subject:, content: nil, status: nil, category_id: nil, subscriptions: nil, visible_to_clients: nil) ⇒ Hash
Create a new message on a message board
33 34 35 36 37 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 33 def create(board_id:, subject:, content: nil, status: nil, category_id: nil, subscriptions: nil, visible_to_clients: nil) with_operation(service: "messages", operation: "create", is_mutation: true, resource_id: board_id) do http_post("/message_boards/#{board_id}/messages.json", body: compact_params(subject: subject, content: content, status: status, category_id: category_id, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json end end |
#get(message_id:) ⇒ Hash
Get a single message by id
42 43 44 45 46 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 42 def get(message_id:) with_operation(service: "messages", operation: "get", is_mutation: false, resource_id: ) do http_get("/messages/#{}", operation: "GetMessage").json end end |
#list(board_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List messages on a message board
17 18 19 20 21 22 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 17 def list(board_id:, sort: nil, direction: nil, page: nil, max_items: nil) wrap_paginated(service: "messages", operation: "list", is_mutation: false, resource_id: board_id) do params = compact_query_params(sort: sort, direction: direction, page: page) paginate("/message_boards/#{board_id}/messages.json", params: params, operation: "ListMessages", max_items: max_items) end end |
#pin(message_id:) ⇒ void
This method returns an undefined value.
Pin a message to the top of the message board
64 65 66 67 68 69 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 64 def pin(message_id:) with_operation(service: "messages", operation: "pin", is_mutation: true, resource_id: ) do http_post("/recordings/#{}/pin.json") nil end end |
#unpin(message_id:) ⇒ void
This method returns an undefined value.
Unpin a message from the message board
74 75 76 77 78 79 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 74 def unpin(message_id:) with_operation(service: "messages", operation: "unpin", is_mutation: true, resource_id: ) do http_delete("/recordings/#{}/pin.json") nil end end |
#update(message_id:, subject: nil, content: nil, status: nil, category_id: nil) ⇒ Hash
Update an existing message
55 56 57 58 59 |
# File 'lib/basecamp/generated/services/messages_service.rb', line 55 def update(message_id:, subject: nil, content: nil, status: nil, category_id: nil) with_operation(service: "messages", operation: "update", is_mutation: true, resource_id: ) do http_put("/messages/#{}", body: compact_params(subject: subject, content: content, status: status, category_id: category_id)).json end end |