Module: Argus::SlackNotifier
- Included in:
- Runner
- Defined in:
- lib/argus/slack.rb
Instance Method Summary collapse
Instance Method Details
#notify(message, color = '#808080') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/argus/slack.rb', line 6 def notify(, color = '#808080') uri = URI.parse(ENV['SLACK_WEBHOOK']) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data( payload: { attachments: [ { text: , color: color.to_s, mrkdwn_in: %w[ text ], #allow link formatting in attachment } ] }.to_json ) http.request(request) end |