Module: FerrisBueller::Replies

Included in:
Web
Defined in:
lib/ferris-bueller/replies.rb

Instance Method Summary collapse

Instance Method Details

#reply_close(inc_num, params) ⇒ Object


61
62
63
# File 'lib/ferris-bueller/replies.rb', line 61

def reply_close inc_num, params
  { text: 'close %d' % inc_num }
end

#reply_comment(inc_num, comment, params) ⇒ Object


71
72
73
# File 'lib/ferris-bueller/replies.rb', line 71

def reply_comment inc_num, comment, params
  { text: 'comment %d %s' % [ inc_num, comment ] }
end

#reply_dunno(params) ⇒ Object


36
37
38
# File 'lib/ferris-bueller/replies.rb', line 36

def reply_dunno params
  { text: "Invalid usage. Try the `help` command" }
end

#reply_help(params) ⇒ Object


31
32
33
# File 'lib/ferris-bueller/replies.rb', line 31

def reply_help params
  { text: "Help!" }
end

#reply_list(params) ⇒ Object


41
42
43
# File 'lib/ferris-bueller/replies.rb', line 41

def reply_list params
  { text: 'list' }
end

#reply_open(sev_num, summary, params) ⇒ Object


66
67
68
# File 'lib/ferris-bueller/replies.rb', line 66

def reply_open sev_num, summary, params
  { text: 'open %d %s' % [ sev_num, summary ] }
end

#reply_resolve(inc_num, params) ⇒ Object


56
57
58
# File 'lib/ferris-bueller/replies.rb', line 56

def reply_resolve inc_num, params
  { text: 'resolve %d' % inc_num }
end

#reply_show(inc_num, params) ⇒ Object


51
52
53
# File 'lib/ferris-bueller/replies.rb', line 51

def reply_show inc_num, params
  { text: 'show %d' % inc_num }
end

#reply_summary(params) ⇒ Object


46
47
48
# File 'lib/ferris-bueller/replies.rb', line 46

def reply_summary params
  { text: 'summary' }
end

#reply_whoami(params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ferris-bueller/replies.rb', line 4

def reply_whoami params
  u = user_lookup(params)
  if u
    { text: "You're <@#{params['user_id']}>",
      attachments: [
        {
          title: 'Slack User',
          # pretext: 'User found via Slack APIs',
          text: "```#{JSON.pretty_generate(u[:slack])}```",
          mrkdwn_in: %w[ text pretext ]
        },
        {
          title: 'Jira User',
          # pretext: 'User found via Jira APIs',
          text: "```#{JSON.pretty_generate(u[:jira])}```",
          mrkdwn_in: %w[ text pretext ]
        }
      ]
    }
  else
    {
      text: "You're <@#{params['user_id']}>, but I can't say much more than that"
    }
  end
end