Class: BBFlow::Trello

Inherits:
Object
  • Object
show all
Extended by:
Persistent, Memoist
Defined in:
lib/bb_flow/trello.rb

Class Method Summary collapse

Methods included from Persistent

global, local, persistent

Class Method Details

.cardsArray<Trello::Card>



8
9
10
11
# File 'lib/bb_flow/trello.rb', line 8

memoize def cards
  puts 'Fetching Trello cards...'
  lists.flat_map { |list| list.cards.target }.select { |card| card.member_ids.include?(member.id) }
end

.done_listTrello::List



19
20
21
# File 'lib/bb_flow/trello.rb', line 19

memoize def done_list
  trello::List.find(done_list_id)
end

.format_card(card) ⇒ Array<String>



26
27
28
29
30
31
# File 'lib/bb_flow/trello.rb', line 26

def format_card(card)
  prefix, _, title = card.name.rpartition(/(?<=\])\s*/) # At last closing square bracket.
  _score, _, tags = prefix.rpartition(/(?<=\))\s*/) # After last parentheses.

  [tags, title, card.short_url]
end

.labelsArray<String>



14
15
16
# File 'lib/bb_flow/trello.rb', line 14

memoize def labels
  cards.flat_map { |card| card.labels.target }.map(&:name).map(&:downcase)
end