Class: Trello::List
- Inherits:
-
Object
- Object
- Trello::List
- Defined in:
- lib/trello-lite/list.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
- #cards ⇒ Object
- #cards_by_member(username) ⇒ Object
- #find_card(name = "") ⇒ Object
- #id ⇒ Object
-
#initialize(attrs = {}) ⇒ List
constructor
A new instance of List.
- #name ⇒ Object
Constructor Details
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/trello-lite/list.rb', line 3 def attributes @attributes end |
Instance Method Details
#cards ⇒ Object
22 23 24 |
# File 'lib/trello-lite/list.rb', line 22 def cards @cards end |
#cards_by_member(username) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/trello-lite/list.rb', line 26 def cards_by_member(username) members_cards = [] @cards.each do |card| member_in_card = card.members.select { |member| member.username == username } next if member_in_card.empty? members_cards << card end members_cards end |
#find_card(name = "") ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/trello-lite/list.rb', line 36 def find_card(name = "") card_obj = nil cards.each do |card| card_obj = card if card.name == name end if card_obj.nil? puts "Card doesn't exist. Here are some card names." cards.each do |card| puts card.name end else card_obj end end |
#id ⇒ Object
14 15 16 |
# File 'lib/trello-lite/list.rb', line 14 def id attributes[:id] end |
#name ⇒ Object
18 19 20 |
# File 'lib/trello-lite/list.rb', line 18 def name attributes[:name] end |