stream-chat-ruby 2.9.0 → 2.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/ci.yml +4 -5
- data/CHANGELOG.md +20 -0
- data/lib/stream-chat/channel.rb +2 -2
- data/lib/stream-chat/client.rb +38 -10
- data/lib/stream-chat/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fe612ee0891b1f564057942d1f9ff74de3b1cf423dc3985e24ab45c87ef8687
|
4
|
+
data.tar.gz: 8ea59fb71fcae04419b9a55d7466e3da2da8eee70d7fc1fccedd60037f5d7672
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164fb93106e15822aa2bb1a7561b2f5e24bcb94b09782851dfefbf0a05584b15d3a07a4190403c26a31e251f6b9b9d2ebd6c2853312a253a7dcad6ddd3f430cc
|
7
|
+
data.tar.gz: 1e2a0b04c1eac20184c68d24dd10554acb064b61f2d732341184747131721e8f3dd74a6455e7acf958313af1be076c33bdc414f382e4b8d7932c1acb45a06ac8
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @ffenix113
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
name:
|
1
|
+
name: test
|
2
2
|
|
3
3
|
on: [pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
6
|
+
test:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
max-parallel: 1
|
@@ -12,15 +12,14 @@ jobs:
|
|
12
12
|
name: Ruby ${{ matrix.ruby }}
|
13
13
|
steps:
|
14
14
|
- uses: actions/checkout@v2
|
15
|
-
- uses:
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
17
|
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
18
19
|
|
19
20
|
- env:
|
20
21
|
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
|
21
22
|
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
|
22
23
|
run: |
|
23
|
-
gem install bundler
|
24
|
-
bundle install --jobs 4 --retry 3
|
25
24
|
bundle exec rake rubocop
|
26
25
|
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## October 5th, 2021 - 2.11.2
|
2
|
+
|
3
|
+
- Add Codeowners file
|
4
|
+
- Fix StreamChannelException raises
|
5
|
+
- Fix rubocop linting error
|
6
|
+
- Fix channel export test
|
7
|
+
- Update Github action
|
8
|
+
|
9
|
+
## August 23rd, 2021 - 2.11.1
|
10
|
+
|
11
|
+
- Use edge as base url
|
12
|
+
|
13
|
+
## June 25th, 2021 - 2.11.0
|
14
|
+
|
15
|
+
- Add support for improved search
|
16
|
+
|
17
|
+
## June 4th, 2021 - 2.10.0
|
18
|
+
|
19
|
+
- Add custom command CRUD support
|
20
|
+
|
1
21
|
## May 31st, 2021 - 2.9.0
|
2
22
|
|
3
23
|
- Add support for app and user level token revoke
|
data/lib/stream-chat/channel.rb
CHANGED
@@ -19,7 +19,7 @@ module StreamChat
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def url
|
22
|
-
raise StreamChannelException 'channel does not have an id' if @id.nil?
|
22
|
+
raise StreamChannelException, 'channel does not have an id' if @id.nil?
|
23
23
|
|
24
24
|
"channels/#{@channel_type}/#{@id}"
|
25
25
|
end
|
@@ -85,7 +85,7 @@ module StreamChat
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def update_partial(set = nil, unset = nil)
|
88
|
-
raise StreamChannelException 'set or unset is needed' if set.nil? && unset.nil?
|
88
|
+
raise StreamChannelException, 'set or unset is needed' if set.nil? && unset.nil?
|
89
89
|
|
90
90
|
payload = { set: set, unset: unset }
|
91
91
|
@client.patch(url, data: payload)
|
data/lib/stream-chat/client.rb
CHANGED
@@ -14,7 +14,7 @@ module StreamChat
|
|
14
14
|
DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
|
15
15
|
|
16
16
|
class Client
|
17
|
-
BASE_URL = 'https://chat
|
17
|
+
BASE_URL = 'https://chat.stream-io-api.com'
|
18
18
|
|
19
19
|
attr_reader :api_key
|
20
20
|
attr_reader :api_secret
|
@@ -92,13 +92,21 @@ module StreamChat
|
|
92
92
|
get("messages/#{id}")
|
93
93
|
end
|
94
94
|
|
95
|
-
def search(filter_conditions, query, **options)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
})
|
95
|
+
def search(filter_conditions, query, sort: nil, **options)
|
96
|
+
offset = options[:offset]
|
97
|
+
next_value = options[:next]
|
98
|
+
raise ArgumentError, 'cannot use offset with next or sort parameters' if offset&.positive? && (next_value || (!sort.nil? && !sort.empty?))
|
100
99
|
|
101
|
-
|
100
|
+
to_merge = {
|
101
|
+
filter_conditions: filter_conditions,
|
102
|
+
sort: get_sort_fields(sort)
|
103
|
+
}
|
104
|
+
if query.is_a? String
|
105
|
+
to_merge[:query] = query
|
106
|
+
else
|
107
|
+
to_merge[:message_filter_conditions] = query
|
108
|
+
end
|
109
|
+
get('search', params: { payload: options.merge(to_merge).to_json })
|
102
110
|
end
|
103
111
|
|
104
112
|
def update_users(users)
|
@@ -352,6 +360,26 @@ module StreamChat
|
|
352
360
|
post('check_sqs', data: { sqs_key: sqs_key, sqs_secret: sqs_secret, sqs_url: sqs_url })
|
353
361
|
end
|
354
362
|
|
363
|
+
def create_command(command)
|
364
|
+
post('commands', data: command)
|
365
|
+
end
|
366
|
+
|
367
|
+
def get_command(name)
|
368
|
+
get("commands/#{name}")
|
369
|
+
end
|
370
|
+
|
371
|
+
def update_command(name, command)
|
372
|
+
put("commands/#{name}", data: command)
|
373
|
+
end
|
374
|
+
|
375
|
+
def delete_command(name)
|
376
|
+
delete("commands/#{name}")
|
377
|
+
end
|
378
|
+
|
379
|
+
def list_commands
|
380
|
+
get('commands')
|
381
|
+
end
|
382
|
+
|
355
383
|
private
|
356
384
|
|
357
385
|
def get_default_params
|
@@ -364,8 +392,8 @@ module StreamChat
|
|
364
392
|
|
365
393
|
def get_default_headers
|
366
394
|
{
|
367
|
-
|
368
|
-
|
395
|
+
'Content-Type': 'application/json',
|
396
|
+
'X-Stream-Client': get_user_agent
|
369
397
|
}
|
370
398
|
end
|
371
399
|
|
@@ -385,7 +413,7 @@ module StreamChat
|
|
385
413
|
headers['Authorization'] = @auth_token
|
386
414
|
headers['stream-auth-type'] = 'jwt'
|
387
415
|
url = [@base_url, relative_url].join('/')
|
388
|
-
params =
|
416
|
+
params = {} if params.nil?
|
389
417
|
params = (get_default_params.merge(params).sort_by { |k, _v| k.to_s }).to_h
|
390
418
|
url = "#{url}?#{URI.encode_www_form(params)}"
|
391
419
|
|
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.11.2
|
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-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,6 +86,7 @@ executables: []
|
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
|
+
- ".github/CODEOWNERS"
|
89
90
|
- ".github/workflows/ci.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rubocop.yml"
|
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
124
|
+
rubygems_version: 3.0.3
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: The low level client for serverside calls for Stream Chat.
|