lib/hipbot/adapters/hipchat.rb in hipbot-1.0.3 vs lib/hipbot/adapters/hipchat.rb in hipbot-1.0.4

- old
+ new

@@ -1,53 +1,10 @@ +require 'hipbot/adapters/xmpp' +require 'hipbot/adapters/hipchat/client' + module Hipbot module Adapters - class Hipchat - attr_accessor :client - - def start! - self.client = Initializer.new.client - end - - def restart! - start! - end - - def invite_to_room(room, users) - client.invite(user_ids(users), room.id) - end - - def kick_from_room(room, users) - client.kick(user_ids(users), room.id) - end - - def send_to_room(room, message) - client.send_message(:groupchat, room.id, message) - end - - def send_to_user(user, message) - client.send_message(:chat, user.id, message) - end - - def set_topic(room, topic) - client.send_message(:groupchat, room.id, nil, topic) - end - - def set_presence(status, type) - client.set_presence(type, nil, status) - end - - def join_room(room) - client.join(room.id) - end - - def leave_room(room, reason = '') - client.exit(room.id, reason) - end - - protected - - def user_ids users - Array(users).map(&:id) - end + class Hipchat < XMPP + include Hipbot::Adaptable end end end