Class: Basecamp3::Message

Inherits:
Model
  • Object
show all
Includes:
Concerns::Bucketable, Concerns::Commentable, Concerns::Creatorable, Concerns::Parentable, Concerns::Recordingable
Defined in:
lib/basecamp3/models/message.rb

Overview

Constant Summary

REQUIRED_FIELDS =
%w(subject)

Instance Attribute Summary collapse

Attributes included from Concerns::Commentable

#comments_count

Class Method Summary collapse

Methods included from Concerns::Commentable

#comments

Methods included from Concerns::Recordingable

included

Methods included from Concerns::Parentable

#parent

Methods included from Concerns::Bucketable

#bucket

Methods included from Concerns::Creatorable

#creator

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Basecamp3::Model

Instance Attribute Details

#contentObject

Returns the value of attribute content



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def content
  @content
end

#created_atObject

Returns the value of attribute created_at



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def created_at
  @created_at
end

#idObject

Returns the value of attribute id



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def id
  @id
end

#statusObject

Returns the value of attribute status



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def status
  @status
end

#subjectObject

Returns the value of attribute subject



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def subject
  @subject
end

#updated_atObject

Returns the value of attribute updated_at



11
12
13
# File 'lib/basecamp3/models/message.rb', line 11

def updated_at
  @updated_at
end

Class Method Details

.all(bucket_id, parent_id, params = {}) ⇒ Array<Basecamp3::Message>

Returns a paginated list of active messages.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • parent_id (Integer)

    the id of the message board

  • params (Hash) (defaults to: {})

    additional parameters

Options Hash (params):

  • :page (Integer) — default: optional

    to paginate results

Returns:



28
29
30
# 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) ⇒ Basecamp3::Message

Creates a message.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • parent_id (Integer)

    the id of the message board

  • data (Hash)

    the data to create a message with

  • params (Hash)

    a customizable set of options

Returns:



53
54
55
56
# 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) ⇒ Basecamp3::Message

Returns the message.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the message

Returns:



38
39
40
# 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) ⇒ Basecamp3::Message

Updates the message.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the message

  • data (Hash)

    the data to update the message with

  • params (Hash)

    a customizable set of options

Returns:



69
70
71
72
# 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