class Trello::List
A List
is a container which holds cards. Lists are items on a board.
@!attribute [r] id
@return [String]
@!attribute [rw] name
@return [String]
@!attribute [rw] closed
@return [Boolean]
@!attribute [r] board_id
@return [String] A 24-character hex string
@!attribute [rw] pos
@return [Object]
Public Class Methods
create(options)
click to toggle source
# File lib/trello/list.rb, line 30 def create(options) client.create(:list, 'name' => options[:name], 'idBoard' => options[:board_id], 'pos' => options[:pos], 'idListSource' => options[:source_list_id]) end
find(id, params = {})
click to toggle source
Finds a specific list, given an id.
@param [id] id the list's ID on Trello
(24-character hex string). @param [Hash] params
# File lib/trello/list.rb, line 26 def find(id, params = {}) client.find(:list, id, params) end
Public Instance Methods
archive_all_cards()
click to toggle source
Archives all the cards of the list
# File lib/trello/list.rb, line 105 def archive_all_cards client.post("/lists/#{id}/archiveAllCards") end
close()
click to toggle source
# File lib/trello/list.rb, line 78 def close self.closed = true end
close!()
click to toggle source
# File lib/trello/list.rb, line 82 def close! close save end
closed?()
click to toggle source
Check if the list is not active anymore.
# File lib/trello/list.rb, line 74 def closed? closed end
move_all_cards(other_list)
click to toggle source
# File lib/trello/list.rb, line 97 def move_all_cards(other_list) client.post("/lists/#{id}/moveAllCards", { idBoard: other_list.board_id, idList: other_list.id }) end
save()
click to toggle source
# File lib/trello/list.rb, line 53 def save return update! if id from_response client.post("/lists", { name: name, closed: closed || false, idBoard: board_id, pos: pos, idListSource: source_list_id }) end
update!()
click to toggle source
# File lib/trello/list.rb, line 65 def update! client.put("/lists/#{id}", { name: name, closed: closed, pos: pos }) end
update_fields(fields)
click to toggle source
Updates the fields of a list.
Supply a hash of string keyed data retrieved from the Trello
API representing a List
.
# File lib/trello/list.rb, line 43 def update_fields(fields) attributes[:id] = fields['id'] || attributes[:id] attributes[:name] = fields['name'] || fields[:name] || attributes[:name] attributes[:closed] = fields['closed'] if fields.has_key?('closed') attributes[:board_id] = fields['idBoard'] || fields[:board_id] || attributes[:board_id] attributes[:pos] = fields['pos'] || fields[:pos] || attributes[:pos] attributes[:source_list_id] = fields['idListSource'] || fields[:source_list_id] || attributes[:source_list_id] self end