class StandupMD::Post::Adapters::Slack
Posts standup entries to Slack using the chat.postMessage Web API.
Constants
Public Instance Methods
Source
# File lib/standup_md/post/adapters/slack.rb, line 35 def post(message) channel = message.channel || options[:channel] token = ENV[token_env] return failure(message, channel, "No Slack channel configured") if blank?(channel) return failure(message, channel, "Missing Slack token in $#{token_env}") if blank?(token) response = perform_request(channel, message.text, token) parsed = parse_response(response.body) return success(message, channel, response, parsed) if response.is_a?(Net::HTTPSuccess) && parsed["ok"] failure(message, channel, error_message(response, parsed), parsed) rescue => e failure(message, channel, e.message) end
Sends a message to Slack.
@param message [StandupMD::Post::Message]
@return [StandupMD::Post::Result]