Class: Slackdraft::Format::Alert
- Inherits:
-
Attachment
- Object
- Base
- Message
- Attachment
- Slackdraft::Format::Alert
- Defined in:
- lib/slackdraft/format/alert.rb
Overview
fattr message: nil
Instance Method Summary collapse
- #alert(header) ⇒ Object
-
#alert=(alert) ⇒ Object
Set the alert text.
- #bot(bot) ⇒ Object (also: #alerter)
-
#bot=(bot) ⇒ Object
(also: #alerter=)
Set the alert text.
- #botlink(botlink) ⇒ Object (also: #alerterlink)
-
#botlink=(botlink) ⇒ Object
(also: #alerterlink=)
Set the alert text.
-
#header=(header) ⇒ Object
Set the alert text.
-
#parse ⇒ Object
Parse the alert message.
- #runbook(runbook) ⇒ Object (also: #fix_url)
-
#runbook=(runbook) ⇒ Object
Set the severity.
- #send! ⇒ Object
- #service(service) ⇒ Object (also: #system)
-
#service=(service) ⇒ Object
(also: #system=)
Set the alert text.
- #sev(severity) ⇒ Object (also: #severity)
-
#sev=(severity) ⇒ Object
(also: #severity=)
Set the severity.
- #type(type) ⇒ Object
-
#type=(type) ⇒ Object
Set the alert text.
Methods inherited from Attachment
#add_field, #generate_attachment, #initialize, #to_h
Methods inherited from Message
#add_attachment, #channel, #generate_payload, #icon_emoji, #icon_url, #parse_usernames_and_channels, #text, #username
Methods inherited from Base
Constructor Details
This class inherits a constructor from Slackdraft::Attachment
Instance Method Details
#alert(header) ⇒ Object
91 92 93 |
# File 'lib/slackdraft/format/alert.rb', line 91 def alert(alert) @alert = alert end |
#alert=(alert) ⇒ Object
Set the alert text
88 89 90 |
# File 'lib/slackdraft/format/alert.rb', line 88 def alert=(alert) @alert = alert end |
#bot(bot) ⇒ Object Also known as: alerter
63 64 65 |
# File 'lib/slackdraft/format/alert.rb', line 63 def bot(bot) @bot = bot end |
#bot=(bot) ⇒ Object Also known as: alerter=
Set the alert text
60 61 62 |
# File 'lib/slackdraft/format/alert.rb', line 60 def bot=(bot) @bot = bot end |
#botlink(botlink) ⇒ Object Also known as: alerterlink
73 74 75 |
# File 'lib/slackdraft/format/alert.rb', line 73 def botlink(botlink) @botlink = botlink end |
#botlink=(botlink) ⇒ Object Also known as: alerterlink=
Set the alert text
70 71 72 |
# File 'lib/slackdraft/format/alert.rb', line 70 def botlink=(botlink) @botlink = botlink end |
#header=(header) ⇒ Object
Set the alert text
96 97 98 |
# File 'lib/slackdraft/format/alert.rb', line 96 def header=(header) @header = header end |
#parse ⇒ Object
Parse the alert message
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/slackdraft/format/alert.rb', line 22 def parse @title = @service unless @header.nil? @text = @header end = @alert @fallback = @alert unless @bot.nil? = @bot unless @botlink.nil? = @botlink end end unless @severity.nil? add_field("Severity", @severity) end unless @runbook.nil? add_field("Runbook", @runbook) end end |
#runbook(runbook) ⇒ Object Also known as: fix_url
117 118 119 |
# File 'lib/slackdraft/format/alert.rb', line 117 def runbook(runbook) @runbook = runbook end |
#runbook=(runbook) ⇒ Object
Set the severity
114 115 116 |
# File 'lib/slackdraft/format/alert.rb', line 114 def runbook=(runbook) @runbook = runbook end |
#send! ⇒ Object
16 17 18 19 |
# File 'lib/slackdraft/format/alert.rb', line 16 def send! parse super end |
#service(service) ⇒ Object Also known as: system
52 53 54 |
# File 'lib/slackdraft/format/alert.rb', line 52 def service(service) @service = service end |
#service=(service) ⇒ Object Also known as: system=
Set the alert text
49 50 51 |
# File 'lib/slackdraft/format/alert.rb', line 49 def service=(service) @service = service end |
#sev(severity) ⇒ Object Also known as: severity
107 108 109 |
# File 'lib/slackdraft/format/alert.rb', line 107 def sev(severity) @severity = severity end |
#sev=(severity) ⇒ Object Also known as: severity=
Set the severity
104 105 106 |
# File 'lib/slackdraft/format/alert.rb', line 104 def sev=(severity) @severity = severity end |
#type(type) ⇒ Object
83 84 85 |
# File 'lib/slackdraft/format/alert.rb', line 83 def type(type) @type = type end |
#type=(type) ⇒ Object
Set the alert text
80 81 82 |
# File 'lib/slackdraft/format/alert.rb', line 80 def type=(type) @type = type end |