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.



18
19
20
# File 'lib/lita/adapters/slack.rb', line 18

def chat_service
  ChatService.new(config)
end

#mention_format(name) ⇒ 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.



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

def mention_format(name)
  "@#{name}"
end

#roster(target) ⇒ 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.

Returns UID(s) in an Array or String for: Channels, MPIMs, IMs



36
37
38
39
# File 'lib/lita/adapters/slack.rb', line 36

def roster(target)
  api = API.new(config)
  room_roster target.id, api
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.



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

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.



41
42
43
44
# File 'lib/lita/adapters/slack.rb', line 41

def send_messages(target, strings)
  api = API.new(config)
  api.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.



46
47
48
49
50
# File 'lib/lita/adapters/slack.rb', line 46

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.



52
53
54
55
56
57
# File 'lib/lita/adapters/slack.rb', line 52

def shut_down
  return unless rtm_connection

  rtm_connection.shut_down
  robot.trigger(:disconnected)
end