Class: Octobot::SlackAgent::Notifier
- Inherits:
-
Object
- Object
- Octobot::SlackAgent::Notifier
- Defined in:
- lib/octobot/slack_agent/notifier.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#icon_emoji ⇒ Object
Returns the value of attribute icon_emoji.
-
#username ⇒ Object
Returns the value of attribute username.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Instance Method Summary collapse
- #error(params) ⇒ Object
-
#initialize(webhook_url, username = 'octobot', icon_emoji = nil) ⇒ Notifier
constructor
A new instance of Notifier.
- #send(params) ⇒ Object
- #send_attachments(attachments) ⇒ Object
- #success(params) ⇒ Object
- #warn(params) ⇒ Object
Constructor Details
#initialize(webhook_url, username = 'octobot', icon_emoji = nil) ⇒ Notifier
Returns a new instance of Notifier.
14 15 16 17 18 |
# File 'lib/octobot/slack_agent/notifier.rb', line 14 def initialize(webhook_url, username='octobot', icon_emoji=nil) @webhook_url = webhook_url @username = username @icon_emoji = icon_emoji end |
Instance Attribute Details
#icon_emoji ⇒ Object
Returns the value of attribute icon_emoji.
12 13 14 |
# File 'lib/octobot/slack_agent/notifier.rb', line 12 def icon_emoji @icon_emoji end |
#username ⇒ Object
Returns the value of attribute username.
12 13 14 |
# File 'lib/octobot/slack_agent/notifier.rb', line 12 def username @username end |
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
12 13 14 |
# File 'lib/octobot/slack_agent/notifier.rb', line 12 def webhook_url @webhook_url end |
Instance Method Details
#error(params) ⇒ Object
28 29 30 |
# File 'lib/octobot/slack_agent/notifier.rb', line 28 def error(params) [ (params, DANGER) ] end |
#send(params) ⇒ Object
36 37 38 |
# File 'lib/octobot/slack_agent/notifier.rb', line 36 def send(params) send_request(base_params.merge(params)) end |
#send_attachments(attachments) ⇒ Object
32 33 34 |
# File 'lib/octobot/slack_agent/notifier.rb', line 32 def () send attachments: end |
#success(params) ⇒ Object
20 21 22 |
# File 'lib/octobot/slack_agent/notifier.rb', line 20 def success(params) [ (params, GOOD) ] end |
#warn(params) ⇒ Object
24 25 26 |
# File 'lib/octobot/slack_agent/notifier.rb', line 24 def warn(params) [ (params, WARNING) ] end |