stream-chat-ruby 2.5.0 → 2.6.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 +3 -0
- data/README.md +12 -0
- data/lib/stream-chat/client.rb +12 -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: e7f6c91605363e141dcbaeaf6818c8fb8b32266c6afc652a84785c488a4d5227
|
4
|
+
data.tar.gz: eeeaec08c0c1eb776010740264b056689c9bb32983dbdf89a434e2527c9c928e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e2fd98ecab0fb43f91141e175d71677248cb0e5869184b91e6d5d1b182610953f3e0762396cdc8a2f663d949fd26449e336157c58dcd8c0b3a4a0c96a9d2e2
|
7
|
+
data.tar.gz: 07f07ffd865cb2b9efbf89ca2827e7e49f949c1b045102a2ce70a6654590079217bc60d8f0709989d3cbc71ac109ec4cbacf32dc856aa43bc2c18bb60712d04f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -189,6 +189,18 @@ status_response = client.get_export_channel_status(response['task_id'])
|
|
189
189
|
# status_response['status'] == 'pending', 'completed'
|
190
190
|
```
|
191
191
|
|
192
|
+
### Rate limits
|
193
|
+
```ruby
|
194
|
+
# Get all rate limits
|
195
|
+
limits = client.get_rate_limits
|
196
|
+
|
197
|
+
# Get rate limits for specific platform(s)
|
198
|
+
limits = client.get_rate_limits(server_side: true)
|
199
|
+
|
200
|
+
# Get rate limits for specific platforms and endpoints
|
201
|
+
limits = client.get_rate_limits(android: true, ios: true, endpoints: ['QueryChannels', 'SendMessage'])
|
202
|
+
```
|
203
|
+
|
192
204
|
### Example Rails application
|
193
205
|
|
194
206
|
See [an example rails application using the Ruby SDK](https://github.com/GetStream/rails-chat-example).
|
data/lib/stream-chat/client.rb
CHANGED
@@ -232,6 +232,17 @@ module StreamChat
|
|
232
232
|
get('devices', params: { user_id: user_id })
|
233
233
|
end
|
234
234
|
|
235
|
+
def get_rate_limits(server_side: false, android: false, ios: false, web: false, endpoints: [])
|
236
|
+
params = {}
|
237
|
+
params['server_side'] = server_side if server_side
|
238
|
+
params['android'] = android if android
|
239
|
+
params['ios'] = ios if ios
|
240
|
+
params['web'] = web if web
|
241
|
+
params['endpoints'] = endpoints.join(',') unless endpoints.empty?
|
242
|
+
|
243
|
+
get('rate_limits', params: params)
|
244
|
+
end
|
245
|
+
|
235
246
|
def verify_webhook(request_body, x_signature)
|
236
247
|
signature = OpenSSL::HMAC.hexdigest('SHA256', @api_secret, request_body)
|
237
248
|
signature == x_signature
|
@@ -342,7 +353,7 @@ module StreamChat
|
|
342
353
|
headers['stream-auth-type'] = 'jwt'
|
343
354
|
url = [@base_url, relative_url].join('/')
|
344
355
|
params = params.nil? ? {} : params
|
345
|
-
params =
|
356
|
+
params = (get_default_params.merge(params).sort_by { |k, _v| k.to_s }).to_h
|
346
357
|
url = "#{url}?#{URI.encode_www_form(params)}"
|
347
358
|
|
348
359
|
body = data.to_json if %w[patch post put].include? method.to_s
|
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.6.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-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|