Module: RongCloud::Services::User

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

Overview

Instance Method Summary collapse

Instance Method Details

#blacklist_add(user_id, black_user_id) ⇒ Object



39
40
41
# File 'lib/rong_cloud/services/user.rb', line 39

def blacklist_add(user_id, black_user_id)
  request("/user/blacklist/add", userId: user_id, blackUserId: black_user_id)
end

#blacklist_remove(user_id, black_user_id) ⇒ Object



43
44
45
# File 'lib/rong_cloud/services/user.rb', line 43

def blacklist_remove(user_id, black_user_id)
  request("/user/blacklist/remove", userId: user_id, blackUserId: black_user_id)
end

#blacklisted_users(user_id) ⇒ Object



47
48
49
# File 'lib/rong_cloud/services/user.rb', line 47

def blacklisted_users(user_id)
  request("/user/blacklist/query", userId: user_id)
end

#block_user(user_id, minute) ⇒ Object



27
28
29
# File 'lib/rong_cloud/services/user.rb', line 27

def block_user(user_id, minute)
  request("/user/block", { userId: user_id, minute: minute })
end

#blocked_usersObject



35
36
37
# File 'lib/rong_cloud/services/user.rb', line 35

def blocked_users
  request("/user/block/query")
end

#check_online(user_id) ⇒ Object



23
24
25
# File 'lib/rong_cloud/services/user.rb', line 23

def check_online(user_id)
  request("/user/checkOnline", { userId: user_id })
end

#get_token(user_id, name, portrait_uri) ⇒ Hash

Generate a new token to create a new RongCloud user

Parameters:

  • user_id (String)

    user id

  • name (String)

    user name

  • portrait_uri (String)

    the url of user’s avatar

Returns:

  • (Hash)

    the response data



12
13
14
# File 'lib/rong_cloud/services/user.rb', line 12

def get_token(user_id, name, portrait_uri)
  request("/user/getToken", {userId: user_id, name: name, portraitUri: portrait_uri})
end

#refresh_user(user_id, name = nil, portrait_uri = nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/rong_cloud/services/user.rb', line 16

def refresh_user(user_id, name = nil, portrait_uri = nil)
  params = { userId: user_id, name: name, portraitUri: portrait_uri }
  params.reject!{|key, value| value.nil?}

  request("/user/refresh", params)
end

#unblock_user(user_id) ⇒ Object



31
32
33
# File 'lib/rong_cloud/services/user.rb', line 31

def unblock_user(user_id)
  request("/user/unblock", userId: user_id)
end