Class: Basecamp3::MessageType

Inherits:
Model
  • Object
show all
Defined in:
lib/basecamp3/models/message_type.rb

Overview

Constant Summary

REQUIRED_FIELDS =
%w(name icon)

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Basecamp3::Model

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at



5
6
7
# File 'lib/basecamp3/models/message_type.rb', line 5

def created_at
  @created_at
end

#iconObject

Returns the value of attribute icon



5
6
7
# File 'lib/basecamp3/models/message_type.rb', line 5

def icon
  @icon
end

#idObject

Returns the value of attribute id



5
6
7
# File 'lib/basecamp3/models/message_type.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name



5
6
7
# File 'lib/basecamp3/models/message_type.rb', line 5

def name
  @name
end

#updated_atObject

Returns the value of attribute updated_at



5
6
7
# File 'lib/basecamp3/models/message_type.rb', line 5

def updated_at
  @updated_at
end

Class Method Details

.all(bucket_id) ⇒ Array<Basecamp3::MessageType>

Returns a list of all the message types.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

Returns:



18
19
20
# File 'lib/basecamp3/models/message_type.rb', line 18

def self.all(bucket_id)
  Basecamp3.request.get("/buckets/#{bucket_id}/categories", {}, Basecamp3::MessageType)
end

.create(bucket_id, data) ⇒ Basecamp3::MessageType

Creates a message type.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • data (Hash)

    the data to create a message type with

  • params (Hash)

    a customizable set of options

Returns:



40
41
42
43
# 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

.delete(bucket_id, id) ⇒ Boolean

Deletes the message type.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the message type

Returns:

  • (Boolean)


65
66
67
# File 'lib/basecamp3/models/message_type.rb', line 65

def self.delete(bucket_id, id)
  Basecamp3.request.delete("/buckets/#{bucket_id}/categories/#{id}")
end

.find(bucket_id, id) ⇒ Basecamp3::MessageType

Returns the message type.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the message type

Returns:



28
29
30
# 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

.update(bucket_id, id, data) ⇒ Basecamp3::MessageType

Updates a message type.

Parameters:

  • bucket_id (Integer)

    the id of the bucket

  • id (Integer)

    the id of the message type

  • data (Hash)

    the data to update the message type with

  • params (Hash)

    a customizable set of options

Returns:



54
55
56
57
# 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