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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cff8888b576ad92ca17c3275504e585b1490e3935e7d86595aad795dfea67a7d
4
- data.tar.gz: 8aa309ce84be59f966edee13e0e8957f863f59c535bc8df9d41d90484e8b1cb5
3
+ metadata.gz: e7f6c91605363e141dcbaeaf6818c8fb8b32266c6afc652a84785c488a4d5227
4
+ data.tar.gz: eeeaec08c0c1eb776010740264b056689c9bb32983dbdf89a434e2527c9c928e
5
5
  SHA512:
6
- metadata.gz: 9ca7b965ba2ca2fdffcb3ff667d93a1081e5aa15f40d3aeb9a167c945f26e54d3e773e826ca583c445c0da02acb5f67f3c450d7fc3fce98fcb958acd7e9077cf
7
- data.tar.gz: 98b040deb4906b952d393244fb228843e77d669481104fa0ca75512cdcaacfccd75d8733c9ade31854366ab066ff6c58a54d2ff3c89e6c590d5a8c9fdc17c888
6
+ metadata.gz: a4e2fd98ecab0fb43f91141e175d71677248cb0e5869184b91e6d5d1b182610953f3e0762396cdc8a2f663d949fd26449e336157c58dcd8c0b3a4a0c96a9d2e2
7
+ data.tar.gz: 07f07ffd865cb2b9efbf89ca2827e7e49f949c1b045102a2ce70a6654590079217bc60d8f0709989d3cbc71ac109ec4cbacf32dc856aa43bc2c18bb60712d04f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## March 9th, 2021 - 2.6.0
2
+ - Add get_rate_limits endpoint
3
+
1
4
  ## February 3rd, 2021 - 2.5.0
2
5
  - Add channel partial update
3
6
  - Increase convenience in query members
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).
@@ -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 = Hash[get_default_params.merge(params).sort_by { |k, _v| k.to_s }]
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
@@ -3,5 +3,5 @@
3
3
  # lib/version.rb
4
4
 
5
5
  module StreamChat
6
- VERSION = '2.5.0'
6
+ VERSION = '2.6.0'
7
7
  end
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.5.0
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-02-02 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday