Class: Trellohub::List
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Trellohub::List
- Defined in:
- lib/trellohub/list.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all ⇒ Object
30 31 32 |
# File 'lib/trellohub/list.rb', line 30 def all @all || self.all! end |
.all! ⇒ Object
34 35 36 |
# File 'lib/trellohub/list.rb', line 34 def all! @all = Trell.lists(Trellohub::Board.id) end |
.find_by(id: nil, name: nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/trellohub/list.rb', line 38 def find_by(id: nil, name: nil) case when !id.nil? self.all.find { |list| list.id == id } when !name.nil? self.all.find { |list| list.name == name } else nil end end |
Instance Method Details
#board_id ⇒ Object
25 26 27 |
# File 'lib/trellohub/list.rb', line 25 def board_id Trellohub::Board.id end |
#find_id ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trellohub/list.rb', line 10 def find_id current_list = self.class.find_by(name: name) list = case when current_list && current_list.closed Trell.update_list(current_list.id, closed: false) when current_list.nil? Trell.create_list(name: name, idBoard: board_id) else current_list end list.id end |
#id ⇒ Object
6 7 8 |
# File 'lib/trellohub/list.rb', line 6 def id @id ||= find_id end |