Business intelligence made simple
Get return value from Slack API [skip ci]
Andrew Kaneb1e8d2bddce5
diff --git a/lib/blazer/slack_notifier.rb b/lib/blazer/slack_notifier.rbindex 6b87d179..8a03d5f0 100644--- a/lib/blazer/slack_notifier.rb+++ b/lib/blazer/slack_notifier.rb@@ -67,15 +67,18 @@ module BlazerBlazer::Engine.routes.url_helpers.query_url(id, ActionMailer::Base.default_url_options)end+ # TODO use return valuedef self.post(payload)if Blazer.slack_webhook_url.present?- post_api(Blazer.slack_webhook_url, payload, {})+ response = post_api(Blazer.slack_webhook_url, payload, {})+ response.is_a?(Net::HTTPSuccess) && response.body == "ok"elseheaders = {"Authorization" => "Bearer #{Blazer.slack_oauth_token}","Content-type" => "application/json"}- post_api("https://slack.com/api/chat.postMessage", payload, headers)+ response = post_api("https://slack.com/api/chat.postMessage", payload, headers)+ response.is_a?(Net::HTTPSuccess) && (JSON.parse(response.body)["ok"] rescue false)endend