stream-chat-ruby 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/stream-chat/client.rb +27 -1
- data/lib/stream-chat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e7de9bf8ce95a2bf565ac99b5a686deb0195bb3ec20f2004ec784f84d00ff0
|
4
|
+
data.tar.gz: '0959555927fa04219edc014cac1247cbca8942387360b2099080138ddbd22664'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70608f85204fb4a1c9451fed4f27281579d23c5e558aea25d752735309b62409cdd15986ad6cb1550e65a5e9072fde29b1792fbf16c2dc5fc1c8b020f1f68b96
|
7
|
+
data.tar.gz: 4907cdf3f110e825a47c45f0759684e9bf3ae4449f74ff8546238d60f39e92c611f1f3e8b3fd855dfe2bf06846432968ee7fa56ee46f3cc946b03af63885b121
|
data/CHANGELOG.md
CHANGED
data/lib/stream-chat/client.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'open-uri'
|
5
5
|
require 'faraday'
|
6
6
|
require 'jwt'
|
7
|
+
require 'time'
|
7
8
|
require 'stream-chat/channel'
|
8
9
|
require 'stream-chat/errors'
|
9
10
|
require 'stream-chat/version'
|
@@ -45,9 +46,10 @@ module StreamChat
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
def create_token(user_id, exp = nil)
|
49
|
+
def create_token(user_id, exp = nil, iat = nil)
|
49
50
|
payload = { user_id: user_id }
|
50
51
|
payload['exp'] = exp unless exp.nil?
|
52
|
+
payload['iat'] = iat unless iat.nil?
|
51
53
|
JWT.encode(payload, @api_secret, 'HS256')
|
52
54
|
end
|
53
55
|
|
@@ -283,6 +285,30 @@ module StreamChat
|
|
283
285
|
get("export_channels/#{task_id}")
|
284
286
|
end
|
285
287
|
|
288
|
+
def revoke_tokens(before)
|
289
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
290
|
+
update_app_settings({ 'revoke_tokens_issued_before' => before })
|
291
|
+
end
|
292
|
+
|
293
|
+
def revoke_user_token(user_id, before)
|
294
|
+
revoke_users_token([user_id], before)
|
295
|
+
end
|
296
|
+
|
297
|
+
def revoke_users_token(user_ids, before)
|
298
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
299
|
+
|
300
|
+
updates = []
|
301
|
+
user_ids.each do |user_id|
|
302
|
+
updates.push({
|
303
|
+
'id' => user_id,
|
304
|
+
'set' => {
|
305
|
+
'revoke_tokens_issued_before' => before
|
306
|
+
}
|
307
|
+
})
|
308
|
+
end
|
309
|
+
update_users_partial(updates)
|
310
|
+
end
|
311
|
+
|
286
312
|
def put(relative_url, params: nil, data: nil)
|
287
313
|
make_http_request(:put, relative_url, params: params, data: data)
|
288
314
|
end
|
data/lib/stream-chat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream-chat-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mircea Cosbuc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|