class Basecamp3::MessageType
A model for Basecamp's Message Board
{github.com/basecamp/bc3-api/blob/master/sections/message_types.md#get-message-types For more information, see the official Basecamp3
API documentation for Message types}
Constants
- REQUIRED_FIELDS
Attributes
Public Class Methods
Returns a list of all the message types.
@param [Integer] bucket_id the id of the bucket
@return [Array<Basecamp3::MessageType>]
# File lib/basecamp3/models/message_type.rb, line 18 def self.all(bucket_id) Basecamp3.request.get("/buckets/#{bucket_id}/categories", {}, Basecamp3::MessageType) end
Creates a message type.
@param [Integer] bucket_id the id of the bucket @param [Hash] data the data to create a message type with @option params [String] :name (required) the name of the message type @option params [String] :icon (required) the icon of the message type
@return [Basecamp3::MessageType]
# File lib/basecamp3/models/message_type.rb, line 40 def self.create(bucket_id, data) self.validate_required(data) Basecamp3.request.post("/buckets/#{bucket_id}/categories", data, Basecamp3::MessageType) end
Deletes the message type.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the message type
@return [Boolean]
# File lib/basecamp3/models/message_type.rb, line 65 def self.delete(bucket_id, id) Basecamp3.request.delete("/buckets/#{bucket_id}/categories/#{id}") end
Returns the message type.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the message type
@return [Basecamp3::MessageType]
# File lib/basecamp3/models/message_type.rb, line 28 def self.find(bucket_id, id) Basecamp3.request.get("/buckets/#{bucket_id}/categories/#{id}", {}, Basecamp3::MessageType) end
Updates a message type.
@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the message type @param [Hash] data the data to update the message type with @option params [String] :name (required) the name of the message type @option params [String] :icon (required) the icon of the message type
@return [Basecamp3::MessageType]
# File lib/basecamp3/models/message_type.rb, line 54 def self.update(bucket_id, id, data) self.validate_required(data) Basecamp3.request.put("/buckets/#{bucket_id}/categories/#{id}", data, Basecamp3::MessageType) end