Class: SportNginAwsAuditor::NotifySlack
- Inherits:
-
Object
- Object
- SportNginAwsAuditor::NotifySlack
- Defined in:
- lib/sport_ngin_aws_auditor/notify_slack.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#icon_emoji ⇒ Object
Returns the value of attribute icon_emoji.
-
#icon_url ⇒ Object
Returns the value of attribute icon_url.
-
#text ⇒ Object
Returns the value of attribute text.
-
#username ⇒ Object
Returns the value of attribute username.
-
#webhook ⇒ Object
Returns the value of attribute webhook.
Instance Method Summary collapse
-
#initialize(text) ⇒ NotifySlack
constructor
A new instance of NotifySlack.
- #perform ⇒ Object
Constructor Details
#initialize(text) ⇒ NotifySlack
Returns a new instance of NotifySlack.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 7 def initialize(text) self.text = text if SportNginAwsAuditor::Config.slack self.channel = SportNginAwsAuditor::Config.slack[:channel] self.username = SportNginAwsAuditor::Config.slack[:username] self.webhook = SportNginAwsAuditor::Config.slack[:webhook] self.icon_url = SportNginAwsAuditor::Config.slack[:icon_url] else puts "To use Slack, you must provide a separate config file. See the README for more information." end end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def channel @channel end |
#icon_emoji ⇒ Object
Returns the value of attribute icon_emoji.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def icon_emoji @icon_emoji end |
#icon_url ⇒ Object
Returns the value of attribute icon_url.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def icon_url @icon_url end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def text @text end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def username @username end |
#webhook ⇒ Object
Returns the value of attribute webhook.
5 6 7 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 5 def webhook @webhook end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sport_ngin_aws_auditor/notify_slack.rb', line 19 def perform if SportNginAwsAuditor::Config.slack = {webhook: webhook, channel: channel, username: username, icon_url: icon_url, http_options: {open_timeout: 10} } Slack::Notifier.new(webhook, ).ping(text) end end |