Module: AwsCleaner::Notify
- Defined in:
- lib/aws-cleaner.rb
Class Method Summary collapse
-
.notify_chat(msg, config) ⇒ Object
generic chat notification method.
-
.notify_hipchat(msg, config) ⇒ Object
notify hipchat.
-
.notify_slack(msg, config) ⇒ Object
notify slack.
Class Method Details
.notify_chat(msg, config) ⇒ Object
generic chat notification method
138 139 140 141 142 143 144 |
# File 'lib/aws-cleaner.rb', line 138 def self.notify_chat(msg, config) if config[:hipchat][:enable] notify_hipchat(msg, config) elsif config[:slack][:enable] notify_slack(msg, config) end end |
.notify_hipchat(msg, config) ⇒ Object
notify hipchat
119 120 121 122 123 124 125 126 |
# File 'lib/aws-cleaner.rb', line 119 def self.notify_hipchat(msg, config) hipchat = HipChat::Client.new( config[:hipchat][:api_token], api_version: 'v2' ) room = config[:hipchat][:room] hipchat[room].send('AWS Cleaner', msg) end |
.notify_slack(msg, config) ⇒ Object
notify slack
129 130 131 132 133 134 135 |
# File 'lib/aws-cleaner.rb', line 129 def self.notify_slack(msg, config) slack = Slack::Poster.new(config[:slack][:webhook_url]) slack.channel = config[:slack][:channel] slack.username = config[:slack][:username] ||= 'aws-cleaner' slack.icon_emoji = config[:slack][:icon_emoji] ||= nil slack.(msg) end |