class Basecamp3::Message

A model for Basecamp's Message

{github.com/basecamp/bc3-api/blob/master/sections/messages.md#messages For more information, see the official Basecamp3 API documentation for Messages}

Constants

REQUIRED_FIELDS

Attributes

content[RW]
created_at[RW]
id[RW]
status[RW]
subject[RW]
updated_at[RW]

Public Class Methods

all(bucket_id, parent_id, params = {}) click to toggle source

Returns a paginated list of active messages.

@param [Integer] bucket_id the id of the bucket @param [Integer] parent_id the id of the message board @param [Hash] params additional parameters @option params [Integer] :page (optional) to paginate results

@return [Array<Basecamp3::Message>]

# File lib/basecamp3/models/message.rb, line 28
def self.all(bucket_id, parent_id, params = {})
  Basecamp3.request.get("/buckets/#{bucket_id}/message_boards/#{parent_id}/messages", params, Basecamp3::Message)
end
create(bucket_id, parent_id, data) click to toggle source

Creates a message.

@param [Integer] bucket_id the id of the bucket @param [Integer] parent_id the id of the message board @param [Hash] data the data to create a message with @option params [Integer] :subject (required) the title of the message @option params [String] :status (required) set to active to publish immediately @option params [String] :content (optional) the body of the message @option params [Integer] :category_id (optional) to set a type for the message

@return [Basecamp3::Message]

# File lib/basecamp3/models/message.rb, line 53
def self.create(bucket_id, parent_id, data)
  self.validate_required(data)
  Basecamp3.request.post("/buckets/#{bucket_id}/message_boards/#{parent_id}/messages", data, Basecamp3::Message)
end
find(bucket_id, id) click to toggle source

Returns the message.

@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the message

@return [Basecamp3::Message]

# File lib/basecamp3/models/message.rb, line 38
def self.find(bucket_id, id)
  Basecamp3.request.get("/buckets/#{bucket_id}/messages/#{id}", {}, Basecamp3::Message)
end
update(bucket_id, id, data) click to toggle source

Updates the message.

@param [Integer] bucket_id the id of the bucket @param [Integer] id the id of the message @param [Hash] data the data to update the message with @option params [Integer] :subject (required) the title of the message @option params [String] :status (required) set to active to publish immediately @option params [String] :content (optional) the body of the message @option params [Integer] :category_id (optional) to set a type for the message

@return [Basecamp3::Message]

# File lib/basecamp3/models/message.rb, line 69
def self.update(bucket_id, id, data)
  self.validate_required(data)
  Basecamp3.request.put("/buckets/#{bucket_id}/messages/#{id}", data, Basecamp3::Message)
end