Module: RongCloud::Services::Group

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

Overview

Instance Method Summary collapse

Instance Method Details

#block_group_member(user_id, group_id, minute) ⇒ Object



40
41
42
# File 'lib/rong_cloud/services/group.rb', line 40

def block_group_member(user_id, group_id, minute)
  request("/group/user/gag/add", userId: user_id, groupId: group_id, minute: minute)
end

#blocked_group_members(group_id) ⇒ Object



48
49
50
# File 'lib/rong_cloud/services/group.rb', line 48

def blocked_group_members(group_id)
  request("/group/user/gag/list", groupId: group_id)
end

#create_group(user_id, group_id, group_name) ⇒ Object



16
17
18
# File 'lib/rong_cloud/services/group.rb', line 16

def create_group(user_id, group_id, group_name)
  request("/group/create", userId: user_id, groupId: group_id, groupName: group_name)
end

#dismiss_group(user_id, group_id) ⇒ Object



28
29
30
# File 'lib/rong_cloud/services/group.rb', line 28

def dismiss_group(user_id, group_id)
  request("/group/dismiss", userId: user_id, groupId: group_id)
end

#group_members(group_id) ⇒ Object



36
37
38
# File 'lib/rong_cloud/services/group.rb', line 36

def group_members(group_id)
  request("/group/user/query", groupId: group_id)
end

#join_group(user_id, group_id, group_name) ⇒ Object



20
21
22
# File 'lib/rong_cloud/services/group.rb', line 20

def join_group(user_id, group_id, group_name)
  request("/group/join", userId: user_id, groupId: group_id, groupName: group_name)
end

#quit_group(user_id, group_id) ⇒ Object



24
25
26
# File 'lib/rong_cloud/services/group.rb', line 24

def quit_group(user_id, group_id)
  request("/group/quit", userId: user_id, groupId: group_id)
end

#refresh_group(group_id, group_name) ⇒ Object



32
33
34
# File 'lib/rong_cloud/services/group.rb', line 32

def refresh_group(group_id, group_name)
  request("/group/refresh", groupId: group_id, groupName: group_name)
end

#sync_group(user_id, groups) ⇒ Object

Parameters:

  • user_id (String)

    user id

  • groups (Hash)

    store group id as hash key, while group name as value, e.g. { 132 => “欢天喜地一家亲” }



7
8
9
10
11
12
13
14
# File 'lib/rong_cloud/services/group.rb', line 7

def sync_group(user_id, groups)
  params = {userId: user_id}
  groups.each do |id, name|
    params["group[#{id}]"] = name
  end

  request("/group/sync", params)
end

#unblock_group_member(user_id, group_id) ⇒ Object



44
45
46
# File 'lib/rong_cloud/services/group.rb', line 44

def unblock_group_member(user_id, group_id)
  request("/group/user/gag/rollback", userId: user_id, groupId: group_id)
end