Class: Lita::Adapters::Slack Private

Inherits:
Adapter
  • Object
show all
Defined in:
lib/lita/adapters/slack.rb,
lib/lita/adapters/slack/api.rb,
lib/lita/adapters/slack/slack_im.rb,
lib/lita/adapters/slack/team_data.rb,
lib/lita/adapters/slack/attachment.rb,
lib/lita/adapters/slack/event_loop.rb,
lib/lita/adapters/slack/im_mapping.rb,
lib/lita/adapters/slack/slack_user.rb,
lib/lita/adapters/slack/chat_service.rb,
lib/lita/adapters/slack/room_creator.rb,
lib/lita/adapters/slack/user_creator.rb,
lib/lita/adapters/slack/slack_channel.rb,
lib/lita/adapters/slack/rtm_connection.rb,
lib/lita/adapters/slack/message_handler.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: API, Attachment, ChatService, EventLoop, IMMapping, MessageHandler, RTMConnection, RoomCreator, SlackChannel, SlackIM, SlackUser, TeamData, UserCreator

Instance Method Summary collapse

Instance Method Details

#chat_serviceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provides an object for Slack-specific features.



14
15
16
# File 'lib/lita/adapters/slack.rb', line 14

def chat_service
  ChatService.new(config)
end

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Starts the connection.



19
20
21
22
23
24
# File 'lib/lita/adapters/slack.rb', line 19

def run
  return if rtm_connection

  @rtm_connection = RTMConnection.build(robot, config)
  rtm_connection.run
end

#send_messages(target, strings) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
29
30
# File 'lib/lita/adapters/slack.rb', line 26

def send_messages(target, strings)
  return unless rtm_connection

  rtm_connection.send_messages(channel_for(target), strings)
end

#set_topic(target, topic) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
35
36
# File 'lib/lita/adapters/slack.rb', line 32

def set_topic(target, topic)
  channel = target.room
  Lita.logger.debug("Setting topic for channel #{channel}: #{topic}")
  API.new(config).set_topic(channel, topic)
end

#shut_downObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
42
43
# File 'lib/lita/adapters/slack.rb', line 38

def shut_down
  return unless rtm_connection

  rtm_connection.shut_down
  robot.trigger(:disconnected)
end