stream-chat-ruby 2.1.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/.github/workflows/ci.yml +26 -0
- data/CHANGELOG.md +23 -2
- data/README.md +53 -4
- data/lib/stream-chat/channel.rb +41 -14
- data/lib/stream-chat/client.rb +59 -41
- data/lib/stream-chat/errors.rb +1 -0
- data/lib/stream-chat/util.rb +11 -0
- data/lib/stream-chat/version.rb +1 -1
- metadata +4 -3
- data/.travis.yml +0 -10
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
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
11
|
+
name: Ruby ${{ matrix.ruby }} sample
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: ${{ matrix.ruby }}
|
17
|
+
|
18
|
+
- env:
|
19
|
+
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
|
20
|
+
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
|
21
|
+
BLOCKLIST: ${{ matrix.ruby == '2.7' }}
|
22
|
+
run: |
|
23
|
+
gem install bundler
|
24
|
+
bundle install --jobs 4 --retry 3
|
25
|
+
bundle exec rake rubocop
|
26
|
+
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
## March 9th, 2021 - 2.6.0
|
2
|
+
- Add get_rate_limits endpoint
|
3
|
+
|
4
|
+
## February 3rd, 2021 - 2.5.0
|
5
|
+
- Add channel partial update
|
6
|
+
- Increase convenience in query members
|
7
|
+
- Improve internal symbol conversions
|
8
|
+
|
9
|
+
## January 20th, 2021 - 2.4.0
|
10
|
+
- Add query_members to channel
|
11
|
+
- Use post endpoint for query channels instead of get
|
12
|
+
- Extract common code for sorting into a helper for query calls
|
13
|
+
|
14
|
+
## January 5th, 2021 - 2.3.0
|
15
|
+
- Add check SQS helper
|
16
|
+
|
17
|
+
## January 4th, 2021 - 2.2.0
|
18
|
+
- Add support for export channels
|
19
|
+
- Improve readme for blocklist and export channels
|
20
|
+
- Improve running tests for multiple versions of ruby
|
21
|
+
- Fix issues from the latest version of rubocop
|
22
|
+
- Move to GitHub Actions
|
23
|
+
|
1
24
|
## October 5th, 2020 - 2.1.0
|
2
25
|
- Add support for blocklist
|
3
26
|
|
@@ -15,13 +38,11 @@
|
|
15
38
|
- Fixed few minor issues
|
16
39
|
|
17
40
|
## Oct 27th, 2019 - 1.1.0
|
18
|
-
|
19
41
|
- Mark gems use for testing as development dependencies
|
20
42
|
- Added `send_file`, `send_image`, `delete_file`, `delete_image`
|
21
43
|
- Added `invite_members`
|
22
44
|
|
23
45
|
## Oct 19th, 2019 - 1.0.0
|
24
|
-
|
25
46
|
- Added `channel.hide` and `channel.show`
|
26
47
|
- Added `client.flag_message` and `client.unflag_message`
|
27
48
|
- Added `client.flag_user` and `client.unflag_user`
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# stream-chat-ruby
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![build](https://github.com/GetStream/stream-chat-ruby/workflows/build/badge.svg)](https://github.com/GetStream/stream-chat-ruby/actions) [![Gem Version](https://badge.fury.io/rb/stream-chat-ruby.svg)](http://badge.fury.io/rb/stream-chat-ruby)
|
4
4
|
|
5
5
|
stream-chat-ruby is the official Ruby client for [Stream chat](https://getstream.io/chat/) a service for building chat applications.
|
6
6
|
|
@@ -14,7 +14,7 @@ Android SDK libraries (https://getstream.io/chat/).
|
|
14
14
|
|
15
15
|
stream-chat-ruby supports:
|
16
16
|
|
17
|
-
- Ruby (2.
|
17
|
+
- Ruby (2.7, 2.6, 2.5)
|
18
18
|
|
19
19
|
#### Install
|
20
20
|
|
@@ -28,15 +28,16 @@ gem install stream-chat-ruby
|
|
28
28
|
|
29
29
|
### Supported features
|
30
30
|
|
31
|
-
- Chat channels
|
31
|
+
- Chat channel type, channels and members
|
32
32
|
- Messages
|
33
|
-
- Chat channel types
|
34
33
|
- User management
|
35
34
|
- Moderation API
|
36
35
|
- Push configuration
|
37
36
|
- User devices
|
38
37
|
- User search
|
39
38
|
- Channel search
|
39
|
+
- Blocklists
|
40
|
+
- Export channels
|
40
41
|
|
41
42
|
### Import
|
42
43
|
|
@@ -129,6 +130,17 @@ chan.unban_user('bob-1')
|
|
129
130
|
|
130
131
|
# Query channel state
|
131
132
|
chan.query({'messages' => { 'limit' => 10, 'id_lte' => m1['id']}})
|
133
|
+
|
134
|
+
# Update metadata (overwrite)
|
135
|
+
chan.update({'motd' => 'one apple a day....'})
|
136
|
+
|
137
|
+
# Update partial
|
138
|
+
# 1. key-value pairs to set
|
139
|
+
# 2. keys to unset (remove)
|
140
|
+
chan.update_partial({color: 'blue', age: 30}, ['motd'])
|
141
|
+
|
142
|
+
# Query channel members
|
143
|
+
chan.query_members({name: {'$autocomplete': 'test'}}, sort: {last_created_at: -1}, offset: 5, limit: 5)
|
132
144
|
```
|
133
145
|
|
134
146
|
### Messages
|
@@ -152,6 +164,43 @@ client.get_devices('jane-77')
|
|
152
164
|
client.remove_device(jane_phone['id'], jane_phone['user_id'])
|
153
165
|
```
|
154
166
|
|
167
|
+
### Blocklists
|
168
|
+
```ruby
|
169
|
+
# Create a blocklist
|
170
|
+
client.create_blocklist('my_blocker', %w[fudge cream sugar])
|
171
|
+
|
172
|
+
# Enable it on messaging channel type
|
173
|
+
client.update_channel_type('messaging', blocklist: 'my_blocker', blocklist_behavior: 'block')
|
174
|
+
|
175
|
+
# Get the details of the blocklist
|
176
|
+
client.get_blocklist('my_blocker')
|
177
|
+
|
178
|
+
# Delete the blocklist
|
179
|
+
client.delete_blocklist('my_blocker')
|
180
|
+
```
|
181
|
+
|
182
|
+
### Export Channels
|
183
|
+
```ruby
|
184
|
+
# Register an export
|
185
|
+
response = client.export_channels({type: 'messaging', id: 'jane'})
|
186
|
+
|
187
|
+
# Check completion
|
188
|
+
status_response = client.get_export_channel_status(response['task_id'])
|
189
|
+
# status_response['status'] == 'pending', 'completed'
|
190
|
+
```
|
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
|
+
|
155
204
|
### Example Rails application
|
156
205
|
|
157
206
|
See [an example rails application using the Ruby SDK](https://github.com/GetStream/rails-chat-example).
|
data/lib/stream-chat/channel.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'stream-chat/errors'
|
4
|
+
require 'stream-chat/util'
|
4
5
|
|
5
6
|
module StreamChat
|
6
7
|
class Channel # rubocop:todo Metrics/ClassLength # rubocop:todo Style/Documentation
|
7
8
|
attr_reader :id
|
8
9
|
attr_reader :channel_type
|
9
10
|
attr_reader :custom_data
|
11
|
+
attr_reader :members
|
10
12
|
|
11
13
|
def initialize(client, channel_type, channel_id = nil, custom_data = nil)
|
12
14
|
@channel_type = channel_type
|
@@ -23,7 +25,7 @@ module StreamChat
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def send_message(message, user_id)
|
26
|
-
payload = {
|
28
|
+
payload = { message: add_user_id(message, user_id) }
|
27
29
|
@client.post("#{url}/message", data: payload)
|
28
30
|
end
|
29
31
|
|
@@ -33,24 +35,24 @@ module StreamChat
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def send_reaction(message_id, reaction, user_id)
|
36
|
-
payload = {
|
38
|
+
payload = { reaction: add_user_id(reaction, user_id) }
|
37
39
|
@client.post("messages/#{message_id}/reaction", data: payload)
|
38
40
|
end
|
39
41
|
|
40
42
|
def delete_reaction(message_id, reaction_type, user_id)
|
41
43
|
@client.delete(
|
42
44
|
"messages/#{message_id}/reaction/#{reaction_type}",
|
43
|
-
params: {
|
45
|
+
params: { user_id: user_id }
|
44
46
|
)
|
45
47
|
end
|
46
48
|
|
47
49
|
def create(user_id)
|
48
|
-
@custom_data['created_by'] = {
|
50
|
+
@custom_data['created_by'] = { id: user_id }
|
49
51
|
query(watch: false, state: false, presence: false)
|
50
52
|
end
|
51
53
|
|
52
54
|
def query(**options)
|
53
|
-
payload = {
|
55
|
+
payload = { state: true, data: @custom_data }.merge(options)
|
54
56
|
url = "channels/#{@channel_type}"
|
55
57
|
url = "#{url}/#{@id}" unless @id.nil?
|
56
58
|
|
@@ -59,11 +61,36 @@ module StreamChat
|
|
59
61
|
state
|
60
62
|
end
|
61
63
|
|
64
|
+
def query_members(filter_conditions = {}, sort: nil, **options)
|
65
|
+
params = {}.merge(options).merge({
|
66
|
+
id: @id,
|
67
|
+
type: @channel_type,
|
68
|
+
filter_conditions: filter_conditions,
|
69
|
+
sort: get_sort_fields(sort)
|
70
|
+
})
|
71
|
+
|
72
|
+
if @id == '' && @members.length.positive?
|
73
|
+
params['members'] = []
|
74
|
+
@members&.each do |m|
|
75
|
+
params['members'] << m['user'].nil? ? m['user_id'] : m['user']['id']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
@client.get('members', params: { payload: params.to_json })
|
80
|
+
end
|
81
|
+
|
62
82
|
def update(channel_data, update_message = nil)
|
63
|
-
payload = {
|
83
|
+
payload = { data: channel_data, message: update_message }
|
64
84
|
@client.post(url, data: payload)
|
65
85
|
end
|
66
86
|
|
87
|
+
def update_partial(set = nil, unset = nil)
|
88
|
+
raise StreamChannelException 'set or unset is needed' if set.nil? && unset.nil?
|
89
|
+
|
90
|
+
payload = { set: set, unset: unset }
|
91
|
+
@client.patch(url, data: payload)
|
92
|
+
end
|
93
|
+
|
67
94
|
def delete
|
68
95
|
@client.delete(url)
|
69
96
|
end
|
@@ -73,23 +100,23 @@ module StreamChat
|
|
73
100
|
end
|
74
101
|
|
75
102
|
def add_members(user_ids)
|
76
|
-
@client.post(url, data: {
|
103
|
+
@client.post(url, data: { add_members: user_ids })
|
77
104
|
end
|
78
105
|
|
79
106
|
def invite_members(user_ids)
|
80
|
-
@client.post(url, data: {
|
107
|
+
@client.post(url, data: { invites: user_ids })
|
81
108
|
end
|
82
109
|
|
83
110
|
def add_moderators(user_ids)
|
84
|
-
@client.post(url, data: {
|
111
|
+
@client.post(url, data: { add_moderators: user_ids })
|
85
112
|
end
|
86
113
|
|
87
114
|
def remove_members(user_ids)
|
88
|
-
@client.post(url, data: {
|
115
|
+
@client.post(url, data: { remove_members: user_ids })
|
89
116
|
end
|
90
117
|
|
91
118
|
def demote_moderators(user_ids)
|
92
|
-
@client.post(url, data: {
|
119
|
+
@client.post(url, data: { demote_moderators: user_ids })
|
93
120
|
end
|
94
121
|
|
95
122
|
def mark_read(user_id, **options)
|
@@ -130,17 +157,17 @@ module StreamChat
|
|
130
157
|
end
|
131
158
|
|
132
159
|
def delete_file(url)
|
133
|
-
@client.delete("#{self.url}/file", params: {
|
160
|
+
@client.delete("#{self.url}/file", params: { url: url })
|
134
161
|
end
|
135
162
|
|
136
163
|
def delete_image(url)
|
137
|
-
@client.delete("#{self.url}/image", params: {
|
164
|
+
@client.delete("#{self.url}/image", params: { url: url })
|
138
165
|
end
|
139
166
|
|
140
167
|
private
|
141
168
|
|
142
169
|
def add_user_id(payload, user_id)
|
143
|
-
payload.merge({
|
170
|
+
payload.merge({ user: { id: user_id } })
|
144
171
|
end
|
145
172
|
end
|
146
173
|
end
|
data/lib/stream-chat/client.rb
CHANGED
@@ -7,8 +7,11 @@ require 'jwt'
|
|
7
7
|
require 'stream-chat/channel'
|
8
8
|
require 'stream-chat/errors'
|
9
9
|
require 'stream-chat/version'
|
10
|
+
require 'stream-chat/util'
|
10
11
|
|
11
12
|
module StreamChat
|
13
|
+
DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
|
14
|
+
|
12
15
|
class Client
|
13
16
|
BASE_URL = 'https://chat-us-east-1.stream-io-api.com'
|
14
17
|
|
@@ -57,22 +60,22 @@ module StreamChat
|
|
57
60
|
end
|
58
61
|
|
59
62
|
def flag_message(id, **options)
|
60
|
-
payload = {
|
63
|
+
payload = { target_message_id: id }.merge(options)
|
61
64
|
post('moderation/flag', data: payload)
|
62
65
|
end
|
63
66
|
|
64
67
|
def unflag_message(id, **options)
|
65
|
-
payload = {
|
68
|
+
payload = { target_message_id: id }.merge(options)
|
66
69
|
post('moderation/unflag', data: payload)
|
67
70
|
end
|
68
71
|
|
69
72
|
def flag_user(id, **options)
|
70
|
-
payload = {
|
73
|
+
payload = { target_user_id: id }.merge(options)
|
71
74
|
post('moderation/flag', data: payload)
|
72
75
|
end
|
73
76
|
|
74
77
|
def unflag_user(id, **options)
|
75
|
-
payload = {
|
78
|
+
payload = { target_user_id: id }.merge(options)
|
76
79
|
post('moderation/unflag', data: payload)
|
77
80
|
end
|
78
81
|
|
@@ -82,11 +85,11 @@ module StreamChat
|
|
82
85
|
|
83
86
|
def search(filter_conditions, query, **options)
|
84
87
|
params = options.merge({
|
85
|
-
|
86
|
-
|
88
|
+
filter_conditions: filter_conditions,
|
89
|
+
query: query
|
87
90
|
})
|
88
91
|
|
89
|
-
get('search', params: {
|
92
|
+
get('search', params: { payload: params.to_json })
|
90
93
|
end
|
91
94
|
|
92
95
|
def update_users(users)
|
@@ -97,7 +100,7 @@ module StreamChat
|
|
97
100
|
|
98
101
|
payload[id] = user
|
99
102
|
end
|
100
|
-
post('users', data: {
|
103
|
+
post('users', data: { users: payload })
|
101
104
|
end
|
102
105
|
|
103
106
|
def update_user(user)
|
@@ -105,7 +108,7 @@ module StreamChat
|
|
105
108
|
end
|
106
109
|
|
107
110
|
def update_users_partial(updates)
|
108
|
-
patch('users', data: {
|
111
|
+
patch('users', data: { users: updates })
|
109
112
|
end
|
110
113
|
|
111
114
|
def update_user_partial(update)
|
@@ -129,34 +132,34 @@ module StreamChat
|
|
129
132
|
end
|
130
133
|
|
131
134
|
def ban_user(target_id, **options)
|
132
|
-
payload = {
|
135
|
+
payload = { target_user_id: target_id }.merge(options)
|
133
136
|
post('moderation/ban', data: payload)
|
134
137
|
end
|
135
138
|
|
136
139
|
def unban_user(target_id, **options)
|
137
|
-
params = {
|
140
|
+
params = { target_user_id: target_id }.merge(options)
|
138
141
|
delete('moderation/ban', params: params)
|
139
142
|
end
|
140
143
|
|
141
144
|
def mute_user(target_id, user_id)
|
142
|
-
payload = {
|
145
|
+
payload = { target_id: target_id, user_id: user_id }
|
143
146
|
post('moderation/mute', data: payload)
|
144
147
|
end
|
145
148
|
|
146
149
|
def unmute_user(target_id, user_id)
|
147
|
-
payload = {
|
150
|
+
payload = { target_id: target_id, user_id: user_id }
|
148
151
|
post('moderation/unmute', data: payload)
|
149
152
|
end
|
150
153
|
|
151
154
|
def mark_all_read(user_id)
|
152
|
-
payload = {
|
155
|
+
payload = { user: { id: user_id } }
|
153
156
|
post('channels/read', data: payload)
|
154
157
|
end
|
155
158
|
|
156
159
|
def update_message(message)
|
157
160
|
raise ArgumentError 'message must have an id' unless message.key? 'id'
|
158
161
|
|
159
|
-
post("messages/#{message['id']}", data: {
|
162
|
+
post("messages/#{message['id']}", data: { message: message })
|
160
163
|
end
|
161
164
|
|
162
165
|
def delete_message(message_id)
|
@@ -164,28 +167,20 @@ module StreamChat
|
|
164
167
|
end
|
165
168
|
|
166
169
|
def query_users(filter_conditions, sort: nil, **options)
|
167
|
-
sort_fields = []
|
168
|
-
sort&.each do |k, v|
|
169
|
-
sort_fields << { "field": k, "direction": v }
|
170
|
-
end
|
171
170
|
params = options.merge({
|
172
|
-
|
173
|
-
|
171
|
+
filter_conditions: filter_conditions,
|
172
|
+
sort: get_sort_fields(sort)
|
174
173
|
})
|
175
|
-
get('users', params: {
|
174
|
+
get('users', params: { payload: params.to_json })
|
176
175
|
end
|
177
176
|
|
178
177
|
def query_channels(filter_conditions, sort: nil, **options)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
"filter_conditions": filter_conditions,
|
186
|
-
"sort": sort_fields
|
187
|
-
})
|
188
|
-
get('channels', params: { "payload": params.to_json })
|
178
|
+
data = { state: true, watch: false, presence: false }
|
179
|
+
data = data.merge(options).merge({
|
180
|
+
filter_conditions: filter_conditions,
|
181
|
+
sort: get_sort_fields(sort)
|
182
|
+
})
|
183
|
+
post('channels', data: data)
|
189
184
|
end
|
190
185
|
|
191
186
|
def create_channel_type(data)
|
@@ -223,18 +218,29 @@ module StreamChat
|
|
223
218
|
|
224
219
|
def add_device(device_id, push_provider, user_id)
|
225
220
|
post('devices', data: {
|
226
|
-
|
227
|
-
|
228
|
-
|
221
|
+
id: device_id,
|
222
|
+
push_provider: push_provider,
|
223
|
+
user_id: user_id
|
229
224
|
})
|
230
225
|
end
|
231
226
|
|
232
227
|
def delete_device(device_id, user_id)
|
233
|
-
delete('devices', params: {
|
228
|
+
delete('devices', params: { id: device_id, user_id: user_id })
|
234
229
|
end
|
235
230
|
|
236
231
|
def get_devices(user_id)
|
237
|
-
get('devices', params: {
|
232
|
+
get('devices', params: { user_id: user_id })
|
233
|
+
end
|
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)
|
238
244
|
end
|
239
245
|
|
240
246
|
def verify_webhook(request_body, x_signature)
|
@@ -251,17 +257,25 @@ module StreamChat
|
|
251
257
|
end
|
252
258
|
|
253
259
|
def create_blocklist(name, words)
|
254
|
-
post('blocklists', data: {
|
260
|
+
post('blocklists', data: { name: name, words: words })
|
255
261
|
end
|
256
262
|
|
257
263
|
def update_blocklist(name, words)
|
258
|
-
put("blocklists/#{name}", data: {
|
264
|
+
put("blocklists/#{name}", data: { words: words })
|
259
265
|
end
|
260
266
|
|
261
267
|
def delete_blocklist(name)
|
262
268
|
delete("blocklists/#{name}")
|
263
269
|
end
|
264
270
|
|
271
|
+
def export_channels(*channels)
|
272
|
+
post('export_channels', data: { channels: channels })
|
273
|
+
end
|
274
|
+
|
275
|
+
def get_export_channel_status(task_id)
|
276
|
+
get("export_channels/#{task_id}")
|
277
|
+
end
|
278
|
+
|
265
279
|
def put(relative_url, params: nil, data: nil)
|
266
280
|
make_http_request(:put, relative_url, params: params, data: data)
|
267
281
|
end
|
@@ -301,6 +315,10 @@ module StreamChat
|
|
301
315
|
parse_response(response)
|
302
316
|
end
|
303
317
|
|
318
|
+
def check_sqs(sqs_key = nil, sqs_secret = nil, sqs_url = nil)
|
319
|
+
post('check_sqs', data: { sqs_key: sqs_key, sqs_secret: sqs_secret, sqs_url: sqs_url })
|
320
|
+
end
|
321
|
+
|
304
322
|
private
|
305
323
|
|
306
324
|
def get_default_params
|
@@ -334,8 +352,8 @@ module StreamChat
|
|
334
352
|
headers['Authorization'] = @auth_token
|
335
353
|
headers['stream-auth-type'] = 'jwt'
|
336
354
|
url = [@base_url, relative_url].join('/')
|
337
|
-
params =
|
338
|
-
params =
|
355
|
+
params = params.nil? ? {} : params
|
356
|
+
params = (get_default_params.merge(params).sort_by { |k, _v| k.to_s }).to_h
|
339
357
|
url = "#{url}?#{URI.encode_www_form(params)}"
|
340
358
|
|
341
359
|
body = data.to_json if %w[patch post put].include? method.to_s
|
data/lib/stream-chat/errors.rb
CHANGED
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:
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,9 +86,9 @@ executables: []
|
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
|
+
- ".github/workflows/ci.yml"
|
89
90
|
- ".gitignore"
|
90
91
|
- ".rubocop.yml"
|
91
|
-
- ".travis.yml"
|
92
92
|
- CHANGELOG.md
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/stream-chat/channel.rb
|
100
100
|
- lib/stream-chat/client.rb
|
101
101
|
- lib/stream-chat/errors.rb
|
102
|
+
- lib/stream-chat/util.rb
|
102
103
|
- lib/stream-chat/version.rb
|
103
104
|
- stream-chat.gemspec
|
104
105
|
homepage: http://github.com/GetStream/stream-chat-ruby
|