Module: RongCloud::Services::Chatroom

Included in:
RongCloud::Service
Defined in:
lib/rong_cloud/services/chatroom.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#add_chatroom_gag_user(chatroom_id, user_id, minute) ⇒ Object



52
53
54
# 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) ⇒ Object

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



93
94
95
# 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) ⇒ Object



141
142
143
# 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) ⇒ Object



108
109
110
# 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_usersObject



118
119
120
# 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) ⇒ Object



124
125
126
# 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) ⇒ Object



136
137
138
# 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) ⇒ Object



64
65
66
# 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) ⇒ Object

create a new chatroom,support creating multiple ones

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

Parameters:

  • chatrooms (Hash)

    created chatrooms



10
11
12
13
14
15
# 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) ⇒ Object

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

Parameters:

  • chatroom_ids (String, Array)

    one or more chatroom ids



30
31
32
# 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) ⇒ Object

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

Parameters:

  • user_id (String, Array)

    one or more user ids

  • chatroom_id (String)

    the id of the chatroom



22
23
24
# 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_chatroomsObject



151
152
153
# File 'lib/rong_cloud/services/chatroom.rb', line 151

def keepalive_chatrooms
  request("/chatroom/keepalive/query")
end

#query_chatroom(chatroom_ids) ⇒ Object

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

Parameters:

  • chatroom_ids (String, Array)

    one or more chatroom ids



38
39
40
# 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) ⇒ Object



42
43
44
# 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") ⇒ Object

Fetch members list in a specified chatroom

Parameters:

  • chatroom_id (String)

    chatroom id

  • count (String, Fixnum)

    the number of members to fetch, the maximum number is 500

  • order (String) (defaults to: "1")

    order direction based on the time when users join the chatroom, 1 for asc ordering, while 2 for desc ordering



75
76
77
# 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) ⇒ Object



46
47
48
# 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) ⇒ Object

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



98
99
100
# 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) ⇒ Object



146
147
148
# 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) ⇒ Object

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



87
88
89
# 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) ⇒ Object



58
59
60
# 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) ⇒ Object

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



81
82
83
# 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) ⇒ Object



113
114
115
# 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) ⇒ Object



130
131
132
# 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) ⇒ Object

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



103
104
105
# File 'lib/rong_cloud/services/chatroom.rb', line 103

def whitelisted_chatroom_users(chatroom_id)
  request("/chatroom/user/whitelist/query", chatroomId: chatroom_id)
end