module RongCloud::Services::Chatroom

apis for chatroom www.rongcloud.cn/docs/server.html#聊天室服务

Public Instance Methods

add_chatroom_gag_user(chatroom_id, user_id, minute) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_gag_add

# File lib/rong_cloud/services/chatroom.rb, line 52
def add_chatroom_gag_user(chatroom_id, user_id, minute)
  request("/chatroom/user/gag/add", chatroomId: chatroom_id, userId: user_id, minute: minute)
end
add_chatroom_whitelist(chatroom_id, user_id) click to toggle source

添加聊天室白名单成员 www.rongcloud.cn/docs/server.html#添加聊天室白名单成员_方法

# File lib/rong_cloud/services/chatroom.rb, line 93
def add_chatroom_whitelist(chatroom_id, user_id)
  request("/chatroom/user/whitelist/add", chatroomId: chatroom_id, userId: user_id)
end
add_keepalive_chatroom(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_keepalive_add

# File lib/rong_cloud/services/chatroom.rb, line 141
def add_keepalive_chatroom(chatroom_id)
  request("/chatroom/keepalive/add", chatroomId: chatroom_id)
end
ban_chatroom_user(user_id, minute) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_ban

# File lib/rong_cloud/services/chatroom.rb, line 108
def ban_chatroom_user(user_id, minute)
  request("/chatroom/user/ban/add", userId: user_id, minute: minute)
end
banned_chatroom_users() click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_ban_query

# File lib/rong_cloud/services/chatroom.rb, line 118
def banned_chatroom_users
  request("/chatroom/user/ban/query")
end
block_chatroom_user(chatroom_id, user_id, minute) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_block_add

# File lib/rong_cloud/services/chatroom.rb, line 124
def block_chatroom_user(chatroom_id, user_id, minute)
  request("/chatroom/user/block/add", chatroomId: chatroom_id, userId: user_id, minute: minute)
end
blocked_chatroom_users(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_block_list

# File lib/rong_cloud/services/chatroom.rb, line 136
def blocked_chatroom_users(chatroom_id)
  request("/chatroom/user/block/list", chatroomId: chatroom_id)
end
chatroom_gag_users(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_gag_list

# File lib/rong_cloud/services/chatroom.rb, line 64
def chatroom_gag_users(chatroom_id)
  request("/chatroom/user/gag/list", chatroomId: chatroom_id)
end
create_chatroom(chatrooms) click to toggle source

create a new chatroom,support creating multiple ones

http://www.rongcloud.cn/docs/server.html#创建聊天室_方法

@param chatrooms [Hash] created chatrooms

# File lib/rong_cloud/services/chatroom.rb, line 10
def create_chatroom(chatrooms)
  params = {}
  chatrooms.each { |room_id, room_name| params["chatroom[#{room_id}]"] = room_name }

  request("/chatroom/create", params)
end
destroy_chatroom(chatroom_ids) click to toggle source

dismiss a chatroom www.rongcloud.cn/docs/server.html#销毁聊天室_方法

@param chatroom_ids [String, Array] one or more chatroom ids

# File lib/rong_cloud/services/chatroom.rb, line 30
def destroy_chatroom(chatroom_ids)
  request("/chatroom/destroy", chatroomId: chatroom_ids)
end
join_chatroom(user_id, chatroom_id) click to toggle source

join a chatroom www.rongcloud.cn/docs/server.html#加入聊天室_方法

@param user_id [String, Array] one or more user ids @param chatroom_id [String] the id of the chatroom

# File lib/rong_cloud/services/chatroom.rb, line 22
def join_chatroom(user_id, chatroom_id)
  request("/chatroom/join", userId: user_id, chatroomId: chatroom_id)
end
keepalive_chatrooms() click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_keepalive_query

# File lib/rong_cloud/services/chatroom.rb, line 151
def keepalive_chatrooms
  request("/chatroom/keepalive/query")
end
query_chatroom(chatroom_ids) click to toggle source

Query one or more chatroom details www.rongcloud.cn/docs/server.html#查询聊天室信息_方法

@param chatroom_ids [String, Array] one or more chatroom ids

# File lib/rong_cloud/services/chatroom.rb, line 38
def query_chatroom(chatroom_ids)
  request("/chatroom/query", chatroomId: chatroom_ids)
end
query_chatroom_user_existence(chatroom_id, user_id) click to toggle source
# File lib/rong_cloud/services/chatroom.rb, line 42
def query_chatroom_user_existence(chatroom_id, user_id)
  request("/chatroom/user/exist", chatroomId: chatroom_id, userId: user_id)
end
query_chatroom_users(chatroom_id, count, order = "1") click to toggle source

Fetch members list in a specified chatroom

@param chatroom_id [String] chatroom id @param count [String, Fixnum] the number of members to fetch, the maximum number is 500 @param order [String] order direction based on the time when users join the chatroom,

1 for asc ordering, while 2 for desc ordering
# File lib/rong_cloud/services/chatroom.rb, line 75
def query_chatroom_users(chatroom_id, count, order = "1")
  request("chatroom/user/query", chatroomId: chatroom_id, count: count, order: order)
end
query_chatroom_users_existence(chatroom_id, user_id) click to toggle source
# File lib/rong_cloud/services/chatroom.rb, line 46
def query_chatroom_users_existence(chatroom_id, user_id)
  request("/chatroom/users/exist", chatroomId: chatroom_id, userId: user_id)
end
remove_chatroom_whitelist(chatroom_id, user_id) click to toggle source

www.rongcloud.cn/docs/server.html#移除聊天室白名单成员_方法

# File lib/rong_cloud/services/chatroom.rb, line 98
def remove_chatroom_whitelist(chatroom_id, user_id)
  request("/chatroom/user/whitelist/remove", chatroomId: chatroom_id, userId: user_id)
end
remove_keepalive_chatroom(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_keepalive_remove

# File lib/rong_cloud/services/chatroom.rb, line 146
def remove_keepalive_chatroom(chatroom_id)
  request("/chatroom/keepalive/remove", chatroomId: chatroom_id)
end
resume_chatroom_distribution(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#聊天室消息恢复分发_方法

# File lib/rong_cloud/services/chatroom.rb, line 87
def resume_chatroom_distribution(chatroom_id)
  request("/chatroom/message/resumeDistribution", chatroomId: chatroom_id)
end
rollback_chatroom_gag_user(chatroom_id, user_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_gag_rollback

# File lib/rong_cloud/services/chatroom.rb, line 58
def rollback_chatroom_gag_user(chatroom_id, user_id)
  request("/chatroom/user/gag/rollback", chatroomId: chatroom_id, userId: user_id)
end
stop_chatroom_distribution(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#聊天室消息停止分发_方法

# File lib/rong_cloud/services/chatroom.rb, line 81
def stop_chatroom_distribution(chatroom_id)
  request("/chatroom/message/stopDistribution", chatroomId: chatroom_id)
end
unban_chatroom_user(user_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_ban_remove

# File lib/rong_cloud/services/chatroom.rb, line 113
def unban_chatroom_user(user_id)
  request("/chatroom/user/ban/remove", userId: user_id)
end
unblock_chatroom_user(chatroom_id, user_id) click to toggle source

www.rongcloud.cn/docs/server.html#chatroom_user_block_rollback

# File lib/rong_cloud/services/chatroom.rb, line 130
def unblock_chatroom_user(chatroom_id, user_id)
  request("/chatroom/user/block/rollback", chatroomId: chatroom_id, userId: user_id)
end
whitelisted_chatroom_users(chatroom_id) click to toggle source

www.rongcloud.cn/docs/server.html#查询聊天室白名单成员_方法

# File lib/rong_cloud/services/chatroom.rb, line 103
def whitelisted_chatroom_users(chatroom_id)
  request("/chatroom/user/whitelist/query", chatroomId: chatroom_id)
end