class Lita::Updates::SlackReport

Public Instance Methods

call() click to toggle source
# File lib/lita/updates/slack_report.rb, line 2
def call
  robot.chat_service.api.send(
    :call_api,
    "chat.postMessage",
    as_user:     false,
    username:    user.mention_name,
    channel:     target.id,
    text:        "#{user.name} posted a status update:",
    attachments: JSON.dump(attachments.collect(&:to_hash))
  )
end

Private Instance Methods

answer(prompt, value, colour) click to toggle source
# File lib/lita/updates/slack_report.rb, line 16
def answer(prompt, value, colour)
  return nil if value.strip.empty? || value[NOTHING]

  Lita::Adapters::Slack::Attachment.new value,
    :title => prompt, :color => colour
end
attachments() click to toggle source
# File lib/lita/updates/slack_report.rb, line 23
def attachments
  [
    answer("What have you just been working on?", yesterday, "good"),
    answer("What’s next?", today, "warning"),
    answer("What blockers are impeding your progress?", blockers, "danger")
  ].compact
end