Class: Trello::List
- Includes:
- HasActions
- Defined in:
- lib/trello/list.rb
Overview
A List is a container which holds cards. Lists are items on a board.
Instance Attribute Summary collapse
-
#board_id ⇒ String
readonly
A 24-character hex string.
- #closed ⇒ Boolean
- #id ⇒ String readonly
- #name ⇒ String
- #pos ⇒ Object
Attributes inherited from BasicData
Class Method Summary collapse
- .create(options) ⇒ Object
-
.find(id, params = {}) ⇒ Object
Finds a specific list, given an id.
Instance Method Summary collapse
- #close ⇒ Object
- #close! ⇒ Object
-
#closed? ⇒ Boolean
Check if the list is not active anymore.
-
#request_prefix ⇒ Object
:nodoc:.
- #save ⇒ Object
- #update! ⇒ Object
-
#update_fields(fields) ⇒ Object
Updates the fields of a list.
Methods included from HasActions
Methods inherited from BasicData
#==, client, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save
Constructor Details
This class inherits a constructor from Trello::BasicData
Instance Attribute Details
#board_id ⇒ String (readonly)
Returns A 24-character hex string.
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 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trello/list.rb', line 14 class List < BasicData register_attributes :id, :name, :closed, :board_id, :pos, readonly: [ :id, :board_id ] validates_presence_of :id, :name, :board_id validates_length_of :name, in: 1..16384 include HasActions class << self # Finds a specific list, given an id. # # @param [id] id the list's ID on Trello (24-character hex string). # @param [Hash] params def find(id, params = {}) client.find(:list, id, params) end def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end end # Updates the fields of a list. # # Supply a hash of string keyed data retrieved from the Trello API representing # a List. def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end def update! client.put("/lists/#{id}", { name: name, closed: closed }) end # Check if the list is not active anymore. def closed? closed end def close self.closed = true end def close! close save end # Return the board the list is connected to. one :board, path: :boards, using: :board_id # Returns all the cards on this list. # # The options hash may have a filter key which can have its value set as any # of the following values: # :filter => [ :none, :open, :closed, :all ] # default :open many :cards, filter: :open # :nodoc: def request_prefix "/lists/#{id}" end end |
#closed ⇒ Boolean
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 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trello/list.rb', line 14 class List < BasicData register_attributes :id, :name, :closed, :board_id, :pos, readonly: [ :id, :board_id ] validates_presence_of :id, :name, :board_id validates_length_of :name, in: 1..16384 include HasActions class << self # Finds a specific list, given an id. # # @param [id] id the list's ID on Trello (24-character hex string). # @param [Hash] params def find(id, params = {}) client.find(:list, id, params) end def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end end # Updates the fields of a list. # # Supply a hash of string keyed data retrieved from the Trello API representing # a List. def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end def update! client.put("/lists/#{id}", { name: name, closed: closed }) end # Check if the list is not active anymore. def closed? closed end def close self.closed = true end def close! close save end # Return the board the list is connected to. one :board, path: :boards, using: :board_id # Returns all the cards on this list. # # The options hash may have a filter key which can have its value set as any # of the following values: # :filter => [ :none, :open, :closed, :all ] # default :open many :cards, filter: :open # :nodoc: def request_prefix "/lists/#{id}" end end |
#id ⇒ String (readonly)
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 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trello/list.rb', line 14 class List < BasicData register_attributes :id, :name, :closed, :board_id, :pos, readonly: [ :id, :board_id ] validates_presence_of :id, :name, :board_id validates_length_of :name, in: 1..16384 include HasActions class << self # Finds a specific list, given an id. # # @param [id] id the list's ID on Trello (24-character hex string). # @param [Hash] params def find(id, params = {}) client.find(:list, id, params) end def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end end # Updates the fields of a list. # # Supply a hash of string keyed data retrieved from the Trello API representing # a List. def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end def update! client.put("/lists/#{id}", { name: name, closed: closed }) end # Check if the list is not active anymore. def closed? closed end def close self.closed = true end def close! close save end # Return the board the list is connected to. one :board, path: :boards, using: :board_id # Returns all the cards on this list. # # The options hash may have a filter key which can have its value set as any # of the following values: # :filter => [ :none, :open, :closed, :all ] # default :open many :cards, filter: :open # :nodoc: def request_prefix "/lists/#{id}" end end |
#name ⇒ String
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 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trello/list.rb', line 14 class List < BasicData register_attributes :id, :name, :closed, :board_id, :pos, readonly: [ :id, :board_id ] validates_presence_of :id, :name, :board_id validates_length_of :name, in: 1..16384 include HasActions class << self # Finds a specific list, given an id. # # @param [id] id the list's ID on Trello (24-character hex string). # @param [Hash] params def find(id, params = {}) client.find(:list, id, params) end def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end end # Updates the fields of a list. # # Supply a hash of string keyed data retrieved from the Trello API representing # a List. def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end def update! client.put("/lists/#{id}", { name: name, closed: closed }) end # Check if the list is not active anymore. def closed? closed end def close self.closed = true end def close! close save end # Return the board the list is connected to. one :board, path: :boards, using: :board_id # Returns all the cards on this list. # # The options hash may have a filter key which can have its value set as any # of the following values: # :filter => [ :none, :open, :closed, :all ] # default :open many :cards, filter: :open # :nodoc: def request_prefix "/lists/#{id}" end end |
#pos ⇒ Object
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 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/trello/list.rb', line 14 class List < BasicData register_attributes :id, :name, :closed, :board_id, :pos, readonly: [ :id, :board_id ] validates_presence_of :id, :name, :board_id validates_length_of :name, in: 1..16384 include HasActions class << self # Finds a specific list, given an id. # # @param [id] id the list's ID on Trello (24-character hex string). # @param [Hash] params def find(id, params = {}) client.find(:list, id, params) end def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end end # Updates the fields of a list. # # Supply a hash of string keyed data retrieved from the Trello API representing # a List. def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end def update! client.put("/lists/#{id}", { name: name, closed: closed }) end # Check if the list is not active anymore. def closed? closed end def close self.closed = true end def close! close save end # Return the board the list is connected to. one :board, path: :boards, using: :board_id # Returns all the cards on this list. # # The options hash may have a filter key which can have its value set as any # of the following values: # :filter => [ :none, :open, :closed, :all ] # default :open many :cards, filter: :open # :nodoc: def request_prefix "/lists/#{id}" end end |
Class Method Details
.create(options) ⇒ Object
30 31 32 33 34 |
# File 'lib/trello/list.rb', line 30 def create() client.create(:list, 'name' => [:name], 'idBoard' => [:board_id]) end |
.find(id, params = {}) ⇒ Object
Finds a specific list, given an id.
26 27 28 |
# File 'lib/trello/list.rb', line 26 def find(id, params = {}) client.find(:list, id, params) end |
Instance Method Details
#close ⇒ Object
72 73 74 |
# File 'lib/trello/list.rb', line 72 def close self.closed = true end |
#close! ⇒ Object
76 77 78 79 |
# File 'lib/trello/list.rb', line 76 def close! close save end |
#closed? ⇒ Boolean
Check if the list is not active anymore.
68 69 70 |
# File 'lib/trello/list.rb', line 68 def closed? closed end |
#request_prefix ⇒ Object
:nodoc:
92 93 94 |
# File 'lib/trello/list.rb', line 92 def request_prefix "/lists/#{id}" end |
#save ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/trello/list.rb', line 50 def save return update! if id client.post("/lists", { name: name, closed: closed || false, idBoard: board_id }).json_into(self) end |
#update! ⇒ Object
60 61 62 63 64 65 |
# File 'lib/trello/list.rb', line 60 def update! client.put("/lists/#{id}", { name: name, closed: closed }) end |
#update_fields(fields) ⇒ Object
Updates the fields of a list.
Supply a hash of string keyed data retrieved from the Trello API representing a List.
41 42 43 44 45 46 47 48 |
# File 'lib/trello/list.rb', line 41 def update_fields(fields) attributes[:id] = fields['id'] attributes[:name] = fields['name'] attributes[:closed] = fields['closed'] attributes[:board_id] = fields['idBoard'] attributes[:pos] = fields['pos'] self end |