class SlackRespondent::ClientWrapper

Attributes

aliases[RW]
client[R]
names[RW]

Public Class Methods

new() click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 9
def initialize
  @name = []

  response = client.auth_test

  SlackRespondent.configure do |config|
    config.url = response.url
    config.team = response.team
    config.team_id = response.team_id
    config.user = response.user
    config.user_id = response.user_id
    logger.info "Welcome #{response.user} to the #{response.team} team."
  end
end

Public Instance Methods

name() click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 42
def name
  SlackRespondent.config.user || (self.self && self.self.name)
end
name?(name) click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 34
def name?(name)
  name && names.include?(name.downcase)
end
say(options = {}) click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 50
def say(options = {})
  filtered_options = options.slice(:channel, :text, :attachments)
  client.chat_postMessage(filtered_options)
end
url() click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 46
def url
  SlackRespondent.config.url
end
user_id() click to toggle source
# File lib/slack_respondent/client_wrapper.rb, line 38
def user_id
  names.first
end