Class: Ctrl::Board
- Inherits:
-
Object
- Object
- Ctrl::Board
- Defined in:
- lib/ctrl/board.rb
Instance Attribute Summary collapse
-
#closed ⇒ Object
Returns the value of attribute closed.
-
#id ⇒ Object
Returns the value of attribute id.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #cards ⇒ Object
-
#initialize(opts) ⇒ Board
constructor
A new instance of Board.
- #lists ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(opts) ⇒ Board
Returns a new instance of Board.
5 6 7 8 9 10 11 12 13 |
# File 'lib/ctrl/board.rb', line 5 def initialize(opts); @id = opts["id"] @name = opts["name"] @url = opts["shortUrl"] || opts["url"] @labels = opts["labelNames"] || opts["labels"] @closed = opts["closed"] @lists = opts["lists"].map { |list| List.new(list) } if opts["lists"] @cards = opts["cards"].map { |card| Card.new(card) } if opts["cards"] end |
Instance Attribute Details
#closed ⇒ Object
Returns the value of attribute closed.
3 4 5 |
# File 'lib/ctrl/board.rb', line 3 def closed @closed end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ctrl/board.rb', line 3 def id @id end |
#labels ⇒ Object
Returns the value of attribute labels.
3 4 5 |
# File 'lib/ctrl/board.rb', line 3 def labels @labels end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ctrl/board.rb', line 3 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/ctrl/board.rb', line 3 def url @url end |
Class Method Details
.create(opts) ⇒ Object
17 |
# File 'lib/ctrl/board.rb', line 17 def self.create(opts); end |
.find_all ⇒ Object
28 29 30 |
# File 'lib/ctrl/board.rb', line 28 def self.find_all; API.get_boards.map { |board| Board.new(board) } end |
.find_by_id(id) ⇒ Object
19 20 21 |
# File 'lib/ctrl/board.rb', line 19 def self.find_by_id(id) Board.new(API.get_board(id)) end |
.find_by_name(name) ⇒ Object
23 24 25 26 |
# File 'lib/ctrl/board.rb', line 23 def self.find_by_name(name) fuzzy = FuzzyMatch.new(find_all, read: :name) fuzzy.find(name) end |
Instance Method Details
#cards ⇒ Object
37 38 39 40 |
# File 'lib/ctrl/board.rb', line 37 def cards; return @cards if @cards API.get_cards_for_board(id).map { |card| Card.new(card) } end |
#lists ⇒ Object
32 33 34 35 |
# File 'lib/ctrl/board.rb', line 32 def lists return @lists if @lists API.get_lists_for_board(id).map { |list| List.new(list) } end |
#save ⇒ Object
15 |
# File 'lib/ctrl/board.rb', line 15 def save; end |