lib/smart_todo/dispatchers/slack.rb
# Make a Slack API call to dispatch the message to the user or channel
#
# @raise [SlackClient::Error] in case the Slack API returns an error
#   other than `users_not_found`
#
# @param [String] the assignee handle string
# @return [Hash] the Slack response
Make a Slack API call to dispatch the message to the user or channel
Make a Slack API call to dispatch the message to the user or channel
def dispatch_one(assignee)
        user = slack_user_or_channel(assignee)
        client.post_message(user.dig("user", "id"), slack_message(user, assignee))
      rescue SlackClient::Error => error
        if ["users_not_found", "channel_not_found"].include?(error.error_code)
          user = { "user" => { "id" => @options[:fallback_channel] }, "fallback" => true }
        else
          raise(error)
        end
        client.post_message(user.dig("user", "id"), slack_message(user, assignee))
      end
def dispatch_one ( assignee ) user = slack_user_or_channel ( assignee ) client . post_message ( user . dig ( "user" , "id" ) , slack_message ( user , assignee ) ) rescue SlackClient :: Error => error if [ "users_not_found" , "channel_not_found" ] . include? ( error . error_code ) user = { "user" => { "id" => @options [ :fallback_channel ] } , "fallback" => true } else raise ( error ) end client . post_message ( user . dig ( "user" , "id" ) , slack_message ( user , assignee ) ) end
Make a Slack API call to dispatch the message to the user or channel
Make a Slack API call to dispatch the message to the user or channel
the Slack response
the Slack response
Hash
[SlackClient::Error] in case the Slack API returns an error other than `users_not_found`
[ SlackClient :: Error ] in case the Slack API returns an error other than ` users_not_found `
assignee
the assignee handle string
the assignee handle string