Class: Trello::Label

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

Overview

A colored Label attached to a card

Instance Attribute Summary collapse

Attributes inherited from BasicData

#client

Instance Method Summary collapse

Methods inherited from BasicData

#==, #attributes, client, #collection_name, #collection_path, create, #element_name, #element_path, find, #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

#board_idString

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trello/label.rb', line 13

class Label < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true

    # Writable
    attribute :name
    attribute :color

    # Writable but for create only
    attribute :board_id, create_only: true, remote_key: 'idBoard'
  end

  validates_presence_of :id, :board_id, :name
  validates_length_of :name, in: 1..16384

  # Returns a reference to the board this label is currently connected.
  one :board, path: :boards, using: :board_id

  # Delete this label
  def delete
    client.delete("/labels/#{id}")
  end

end

#colorString

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trello/label.rb', line 13

class Label < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true

    # Writable
    attribute :name
    attribute :color

    # Writable but for create only
    attribute :board_id, create_only: true, remote_key: 'idBoard'
  end

  validates_presence_of :id, :board_id, :name
  validates_length_of :name, in: 1..16384

  # Returns a reference to the board this label is currently connected.
  one :board, path: :boards, using: :board_id

  # Delete this label
  def delete
    client.delete("/labels/#{id}")
  end

end

#idString

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trello/label.rb', line 13

class Label < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true

    # Writable
    attribute :name
    attribute :color

    # Writable but for create only
    attribute :board_id, create_only: true, remote_key: 'idBoard'
  end

  validates_presence_of :id, :board_id, :name
  validates_length_of :name, in: 1..16384

  # Returns a reference to the board this label is currently connected.
  one :board, path: :boards, using: :board_id

  # Delete this label
  def delete
    client.delete("/labels/#{id}")
  end

end

#nameString

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trello/label.rb', line 13

class Label < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true

    # Writable
    attribute :name
    attribute :color

    # Writable but for create only
    attribute :board_id, create_only: true, remote_key: 'idBoard'
  end

  validates_presence_of :id, :board_id, :name
  validates_length_of :name, in: 1..16384

  # Returns a reference to the board this label is currently connected.
  one :board, path: :boards, using: :board_id

  # Delete this label
  def delete
    client.delete("/labels/#{id}")
  end

end

Instance Method Details

#deleteObject

Delete this label



34
35
36
# File 'lib/trello/label.rb', line 34

def delete
  client.delete("/labels/#{id}")
end