Class: Sambot::Slack::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/sambot/slack/formatter.rb

Constant Summary collapse

COLUMNS =
{
  'Blocked': {color: '#e85151', order: 1},
  'In Progress': {color: '#49d14b', order: 2},
  'Ready': {color: '#336334', order: 3},
  'Pending Prioritization': {color: '#5b7aa3', order: 4},
  'Icebox': {color: '#d1d1d1', order: 5}
}

Class Method Summary collapse

Class Method Details

.format(work_item) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/sambot/slack/formatter.rb', line 13

def self.format(work_item)
  {
    fallback: "#{work_item.id_and_subject}",
    title: "#{work_item.id_and_subject}",
    text: "#{work_item.column} - #{work_item.assignee}",
    color: "#{COLUMNS[work_item.column.to_sym] ? COLUMNS[work_item.column.to_sym][:color] : ''}"
  }
end

.indexObject



22
23
24
25
26
# File 'lib/sambot/slack/formatter.rb', line 22

def self.index
  COLUMNS.keys.map do |key|
    {fallback: key, title: key, color: COLUMNS[key][:color]}
  end
end