Class: Sendbird::UserApi

Inherits:
Object
  • Object
show all
Extended by:
Client
Defined in:
lib/sendbird/user_api.rb

Constant Summary collapse

ENDPOINT =
'users'.freeze

Constants included from Client

Client::PUBLIC_METHODS

Class Method Summary collapse

Methods included from Client

build_url

Class Method Details

.activate(user_id, body) ⇒ Object



31
32
33
# File 'lib/sendbird/user_api.rb', line 31

def activate(user_id, body)
  put(path: build_url(user_id, 'activate'), body: body)
end

.block(user_id, body) ⇒ Object



35
36
37
# File 'lib/sendbird/user_api.rb', line 35

def block(user_id, body)
  post(path: build_url(user_id, 'block'), body: body)
end

.block_list(user_id, params = {}) ⇒ Object



43
44
45
# File 'lib/sendbird/user_api.rb', line 43

def block_list(user_id, params={})
  get(path: build_url(user_id, 'block'), params: params)
end

.create(body) ⇒ Object



11
12
13
# File 'lib/sendbird/user_api.rb', line 11

def create(body)
  post(path: build_url, body: body)
end

.delete_push_preferences(user_id) ⇒ Object



79
80
81
# File 'lib/sendbird/user_api.rb', line 79

def delete_push_preferences(user_id)
  delete(path: build_url(user_id, 'push_preference'))
end

.destroy(user_id) ⇒ Object



23
24
25
# File 'lib/sendbird/user_api.rb', line 23

def destroy(user_id)
  delete(path: build_url(user_id))
end

.list(params = {}) ⇒ Object



15
16
17
# File 'lib/sendbird/user_api.rb', line 15

def list(params={})
  get(path: build_url, params: params)
end

.mark_as_read_all(user_id) ⇒ Object



47
48
49
# File 'lib/sendbird/user_api.rb', line 47

def mark_as_read_all(user_id)
  put(path: build_url(user_id, 'mark_as_read_all'))
end

.push_preferences(user_id) ⇒ Object



71
72
73
# File 'lib/sendbird/user_api.rb', line 71

def push_preferences(user_id)
  get(path: build_url(user_id, 'push_preference'))
end

.register_apns_token(user_id, token) ⇒ Object



55
56
57
# File 'lib/sendbird/user_api.rb', line 55

def register_apns_token(user_id, token)
  register_token(user_id, 'apns', {apns_device_token: token})
end

.register_gcm_token(user_id, token) ⇒ Object



51
52
53
# File 'lib/sendbird/user_api.rb', line 51

def register_gcm_token(user_id, token)
  register_token(user_id, 'gcm', {gcm_reg_token: token})
end

.unblock(user_id, unblock_user_id) ⇒ Object



39
40
41
# File 'lib/sendbird/user_api.rb', line 39

def unblock(user_id, unblock_user_id)
  delete(path: build_url(user_id, 'block', unblock_user_id))
end

.unread_count(user_id) ⇒ Object



27
28
29
# File 'lib/sendbird/user_api.rb', line 27

def unread_count(user_id)
  get(path: build_url(user_id, 'unread_count'))
end

.unregister_all_device_token(user_id) ⇒ Object



67
68
69
# File 'lib/sendbird/user_api.rb', line 67

def unregister_all_device_token(user_id)
  delete(path: build_url(user_id, 'push'))
end

.unregister_apns_token(user_id, token) ⇒ Object



63
64
65
# File 'lib/sendbird/user_api.rb', line 63

def unregister_apns_token(user_id, token)
  unregister_token(user_id, 'apns', token)
end

.unregister_gcm_token(user_id, token) ⇒ Object



59
60
61
# File 'lib/sendbird/user_api.rb', line 59

def unregister_gcm_token(user_id, token)
  unregister_token(user_id, 'gcm', token)
end

.update(user_id, body) ⇒ Object



19
20
21
# File 'lib/sendbird/user_api.rb', line 19

def update(user_id, body)
  put(path: build_url(user_id), body: body)
end

.update_push_preferences(user_id, body) ⇒ Object



75
76
77
# File 'lib/sendbird/user_api.rb', line 75

def update_push_preferences(user_id, body)
  put(path: build_url(user_id, 'push_preference'), body: body)
end

.view(user_id) ⇒ Object



7
8
9
# File 'lib/sendbird/user_api.rb', line 7

def view(user_id)
  get(path: build_url(user_id))
end