Class: Trello::Client::List
- Inherits:
-
Object
- Object
- Trello::Client::List
- Defined in:
- lib/trello-client/list.rb
Overview
Trello::Client::List object
Instance Method Summary collapse
-
#[](key) ⇒ Object
Get Trello::Client::List property.
-
#cards ⇒ Object
Get
Array
of Trello::Client::Card objects. -
#initialize(list) {|_self| ... } ⇒ List
constructor
Initialize Trello::Client::List.
-
#to_s ⇒ Object
String representation.
Constructor Details
#initialize(list) {|_self| ... } ⇒ List
Initialize Trello::Client::List
Params:
list
-
Hash’ified JSON list or JSON string
19 20 21 22 23 |
# File 'lib/trello-client/list.rb', line 19 def initialize(list) @list = list.kind_of?(Hash) ? list : MultiJson.decode(list) yield self if block_given? self end |
Instance Method Details
#[](key) ⇒ Object
Get Trello::Client::List property
28 29 30 |
# File 'lib/trello-client/list.rb', line 28 def[](key) @list[key] end |
#cards ⇒ Object
Get Array
of Trello::Client::Card objects
35 36 37 38 39 40 |
# File 'lib/trello-client/list.rb', line 35 def cards unless @lists @cards = ( @list['cards'] || [] ).collect { |c| Trello::Client::Card.new(c) } end @cards end |
#to_s ⇒ Object
String representation.
45 46 47 |
# File 'lib/trello-client/list.rb', line 45 def to_s @list.to_s end |