pusher-chatkit-server 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chatkit/client.rb +28 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '090e2b837228cf73e9cc33db1d20404b694155ea'
|
4
|
+
data.tar.gz: eb240af5dca408381bc645a8a132266ec62aa847
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf46bf908768d6a6490857918113d4544bcd66eafea765446d590f064ac15e9928b58442bd276506501666adaf9ece5024cb7f803155f248543ba9c68c163d00
|
7
|
+
data.tar.gz: bcbccd462f63df55c699db92fc9f3d80a596f78a0ad513bb3292cef88f9f5538b30b669c957cc06821f215acc49dba03c3d9d024d287f36d4872e3a798b9c184
|
data/lib/chatkit/client.rb
CHANGED
@@ -167,6 +167,14 @@ module Chatkit
|
|
167
167
|
assign_role_to_user(user_id, role_name, room_id)
|
168
168
|
end
|
169
169
|
|
170
|
+
def reassign_global_role_to_user(user_id, role_name)
|
171
|
+
reassign_role_for_user(user_id, role_name, nil)
|
172
|
+
end
|
173
|
+
|
174
|
+
def reassign_room_role_to_user(user_id, role_name, room_id)
|
175
|
+
reassign_role_for_user(user_id, role_name, room_id)
|
176
|
+
end
|
177
|
+
|
170
178
|
def get_roles
|
171
179
|
resp = @authorizer_instance.request(
|
172
180
|
method: "GET",
|
@@ -253,14 +261,32 @@ module Chatkit
|
|
253
261
|
)
|
254
262
|
end
|
255
263
|
|
264
|
+
def reassign_role_for_user(user_id, role_name, room_id)
|
265
|
+
body = { name: role_name }
|
266
|
+
|
267
|
+
unless room_id.nil?
|
268
|
+
body[:room_id] = room_id
|
269
|
+
end
|
270
|
+
|
271
|
+
@authorizer_instance.request(
|
272
|
+
method: "PUT",
|
273
|
+
path: "/users/#{user_id}/roles",
|
274
|
+
headers: {
|
275
|
+
"Content-Type": "application/json",
|
276
|
+
},
|
277
|
+
body: body,
|
278
|
+
jwt: generate_access_token(su: true)
|
279
|
+
)
|
280
|
+
end
|
281
|
+
|
256
282
|
def remove_role_for_user(user_id, room_id)
|
257
283
|
options = {
|
258
|
-
method: "
|
284
|
+
method: "DELETE",
|
259
285
|
path: "/users/#{user_id}/roles",
|
260
286
|
headers: {
|
261
287
|
"Content-Type": "application/json",
|
262
288
|
},
|
263
|
-
|
289
|
+
query: { room_id: room_id },
|
264
290
|
jwt: generate_access_token(su: true)
|
265
291
|
}
|
266
292
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pusher-chatkit-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pusher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pusher-platform
|