stream-chat-ruby 2.11.0 → 2.12.0
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 +24 -0
- data/lib/stream-chat/channel.rb +2 -2
- data/lib/stream-chat/client.rb +16 -2
- data/lib/stream-chat/errors.rb +11 -1
- data/lib/stream-chat/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ca273c350cdc7bdc45e1bb675745d611c81a1d37c9f810ba1bfe50f81e2f5b
|
4
|
+
data.tar.gz: 654923dd0d2796bef150ea6796200753c6ccfe3c3085a8997d1d540037f0af34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927c84dea77c1cd39149760b30bb59e87205e867244a46b88368e68b375c3681914d079ee5e65075ee692cace35e798f52db343a77d7547873c7d3fd4989d905
|
7
|
+
data.tar.gz: 1b25d0b7064a6d087f557fa45d1c676731382681fe33e7e60a1269b304f219abb80f066cf9fa319bb14cd3bd39f339a0517fa999b92ff90ff2c0dd7aaea823c7
|
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,27 @@
|
|
1
|
+
## November 1st, 2021 - 2.12.0
|
2
|
+
|
3
|
+
- Add support for async endpoints
|
4
|
+
- get_task
|
5
|
+
- delete_channels
|
6
|
+
_ delete_users
|
7
|
+
|
8
|
+
## October 22nd, 2021 - 2.11.3
|
9
|
+
|
10
|
+
- Don't log the entire response when creating exception
|
11
|
+
- Access error details through StreamAPIException class attr_readers
|
12
|
+
|
13
|
+
## October 5th, 2021 - 2.11.2
|
14
|
+
|
15
|
+
- Add Codeowners file
|
16
|
+
- Fix StreamChannelException raises
|
17
|
+
- Fix rubocop linting error
|
18
|
+
- Fix channel export test
|
19
|
+
- Update Github action
|
20
|
+
|
21
|
+
## August 23rd, 2021 - 2.11.1
|
22
|
+
|
23
|
+
- Use edge as base url
|
24
|
+
|
1
25
|
## June 25th, 2021 - 2.11.0
|
2
26
|
|
3
27
|
- Add support for improved search
|
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
@@ -12,9 +12,11 @@ require 'stream-chat/util'
|
|
12
12
|
|
13
13
|
module StreamChat
|
14
14
|
DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
|
15
|
+
SOFT_DELETE = 'soft'
|
16
|
+
HARD_DELETE = 'hard'
|
15
17
|
|
16
18
|
class Client
|
17
|
-
BASE_URL = 'https://chat
|
19
|
+
BASE_URL = 'https://chat.stream-io-api.com'
|
18
20
|
|
19
21
|
attr_reader :api_key
|
20
22
|
attr_reader :api_secret
|
@@ -293,6 +295,18 @@ module StreamChat
|
|
293
295
|
get("export_channels/#{task_id}")
|
294
296
|
end
|
295
297
|
|
298
|
+
def get_task(task_id)
|
299
|
+
get("tasks/#{task_id}")
|
300
|
+
end
|
301
|
+
|
302
|
+
def delete_users(user_ids, user: SOFT_DELETE, messages: nil, conversations: nil)
|
303
|
+
post('users/delete', data: { user_ids: user_ids, user: user, messages: messages, conversations: conversations })
|
304
|
+
end
|
305
|
+
|
306
|
+
def delete_channels(cids, hard_delete: false)
|
307
|
+
post('channels/delete', data: { cids: cids, hard_delete: hard_delete })
|
308
|
+
end
|
309
|
+
|
296
310
|
def revoke_tokens(before)
|
297
311
|
before = before.rfc3339 if before.instance_of?(DateTime)
|
298
312
|
update_app_settings({ 'revoke_tokens_issued_before' => before })
|
@@ -413,7 +427,7 @@ module StreamChat
|
|
413
427
|
headers['Authorization'] = @auth_token
|
414
428
|
headers['stream-auth-type'] = 'jwt'
|
415
429
|
url = [@base_url, relative_url].join('/')
|
416
|
-
params =
|
430
|
+
params = {} if params.nil?
|
417
431
|
params = (get_default_params.merge(params).sort_by { |k, _v| k.to_s }).to_h
|
418
432
|
url = "#{url}?#{URI.encode_www_form(params)}"
|
419
433
|
|
data/lib/stream-chat/errors.rb
CHANGED
@@ -4,10 +4,12 @@
|
|
4
4
|
|
5
5
|
module StreamChat
|
6
6
|
class StreamAPIException < StandardError
|
7
|
+
attr_reader :error_code
|
8
|
+
attr_reader :error_message
|
9
|
+
|
7
10
|
def initialize(response)
|
8
11
|
super()
|
9
12
|
@response = response
|
10
|
-
p response
|
11
13
|
begin
|
12
14
|
parsed_response = JSON.parse(response.body)
|
13
15
|
@json_response = true
|
@@ -25,6 +27,14 @@ module StreamChat
|
|
25
27
|
"StreamChat error HTTP code: #{@response.status}"
|
26
28
|
end
|
27
29
|
end
|
30
|
+
|
31
|
+
def json_response?
|
32
|
+
@json_response
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_s
|
36
|
+
message
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
class StreamChannelException < StandardError; 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.12.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-11-01 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"
|