Class: Trello::Client::List

Inherits:
Object
  • Object
show all
Defined in:
lib/trello-client/list.rb

Overview

Trello::Client::List object

See trello.com/docs/api/list/index.html

Instance Method Summary collapse

Constructor Details

#initialize(list) {|_self| ... } ⇒ List

Initialize Trello::Client::List

Params:

list

Hash’ified JSON list or JSON string

Yields:

  • (_self)

Yield Parameters:



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

#cardsObject

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_sObject

String representation.



45
46
47
# File 'lib/trello-client/list.rb', line 45

def to_s
  @list.to_s
end