Class: Trello::Comment

Inherits:
BasicData show all
Defined in:
lib/trello/comment.rb

Overview

A Comment is a string with a creation date; it resides inside a Card and belongs to a User.

Instance Attribute Summary collapse

Attributes inherited from BasicData

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicData

#==, #attributes, client, #collection_name, #collection_path, create, #element_name, #element_path, #hash, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attrs, #save, save, schema, #schema, #update!, #update_fields

Methods included from JsonUtils

included

Constructor Details

This class inherits a constructor from Trello::BasicData

Instance Attribute Details

#app_creatorString (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#creator_idString (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#dataHash (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#dateDatetime (readonly)

Returns:

  • (Datetime)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#displayHash (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#idString (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#limitsHash (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#text=(value) ⇒ String (writeonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

#typeString (readonly)

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trello/comment.rb', line 22

class Comment < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :creator_id, readonly: true, remote_key: 'idMemberCreator'
    attribute :data, readonly: true
    attribute :type, readonly: true
    attribute :date, readonly: true, serializer: 'Time'
    attribute :limits, readonly: true
    attribute :app_creator, readonly: true, remote_key: 'appCreator'
    attribute :display, readonly: true

    # Writable
    attribute :text, update_only: true
  end

  validates_presence_of :id, :text, :date, :creator_id
  validates_length_of   :text,        in: 1..16384

  class << self
    def find(action_id)
      response = client.get("/actions/#{action_id}")
      self.parse response do |data|
        data.client = client
      end
    end
  end

  # Returns the board this comment is located
  def board(params = {})
    Board.from_response client.get("/actions/#{id}/board", params)
  end

  # Returns the card the comment is located
  def card(params = {})
    Card.from_response client.get("/actions/#{id}/card", params)
  end

  # Returns the list the comment is located
  def list(params = {})
    List.from_response client.get("/actions/#{id}/list", params)
  end

  # Deletes the comment from the card
  def delete
    ruta = "/actions/#{id}"
    client.delete(ruta)
  end

  # Returns the member who created the comment.
  one :member_creator, via: Member, path: :members, using: :creator_id
end

Class Method Details

.find(action_id) ⇒ Object



43
44
45
46
47
48
# File 'lib/trello/comment.rb', line 43

def find(action_id)
  response = client.get("/actions/#{action_id}")
  self.parse response do |data|
    data.client = client
  end
end

Instance Method Details

#board(params = {}) ⇒ Object

Returns the board this comment is located



52
53
54
# File 'lib/trello/comment.rb', line 52

def board(params = {})
  Board.from_response client.get("/actions/#{id}/board", params)
end

#card(params = {}) ⇒ Object

Returns the card the comment is located



57
58
59
# File 'lib/trello/comment.rb', line 57

def card(params = {})
  Card.from_response client.get("/actions/#{id}/card", params)
end

#deleteObject

Deletes the comment from the card



67
68
69
70
# File 'lib/trello/comment.rb', line 67

def delete
  ruta = "/actions/#{id}"
  client.delete(ruta)
end

#list(params = {}) ⇒ Object

Returns the list the comment is located



62
63
64
# File 'lib/trello/comment.rb', line 62

def list(params = {})
  List.from_response client.get("/actions/#{id}/list", params)
end