stream-chat-ruby 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +25 -0
- data/CHANGELOG.md +7 -0
- data/README.md +29 -2
- data/lib/stream-chat/client.rb +11 -1
- data/lib/stream-chat/errors.rb +1 -0
- data/lib/stream-chat/version.rb +1 -1
- metadata +3 -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: 431753dd911d42b0ca289bc4ca1b35f0043dca65d0bc846bb1af6128c491f386
|
4
|
+
data.tar.gz: 7f48350204e9bad4de4a975c2d88339934e8cf195c7b38fc876a22bdd9139c63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbf182d9dd41639610ac84a3e34b80a2620b707f4f5ebe67f947b7cffd1cd8b69dd43add8025177958a8be80bb521805ee8c36f564a4059a47723eb935f424b5
|
7
|
+
data.tar.gz: d32a9947b564c61a9918ed72dbbf1ec38e160c754f6105213dd1d3595c53bcb8bacdf75581056d2aea9b6a27635127836fd7688c9b2b8cf0753cde99947e66ef
|
@@ -0,0 +1,25 @@
|
|
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
|
+
run: |
|
22
|
+
gem install bundler
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
bundle exec rake rubocop
|
25
|
+
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## January 4th, 2021 - 2.2.0
|
2
|
+
- Add support for export channels
|
3
|
+
- Improve readme for blocklist and export channels
|
4
|
+
- Improve running tests for multiple versions of ruby
|
5
|
+
- Fix issues from the latest version of rubocop
|
6
|
+
- Move to GitHub Actions
|
7
|
+
|
1
8
|
## October 5th, 2020 - 2.1.0
|
2
9
|
- Add support for blocklist
|
3
10
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# stream-chat-ruby
|
2
2
|
|
3
|
-
[](https://github.com/GetStream/stream-chat-ruby/actions) [](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
|
|
@@ -37,6 +37,8 @@ gem install stream-chat-ruby
|
|
37
37
|
- User devices
|
38
38
|
- User search
|
39
39
|
- Channel search
|
40
|
+
- Blocklists
|
41
|
+
- Export channels
|
40
42
|
|
41
43
|
### Import
|
42
44
|
|
@@ -152,6 +154,31 @@ client.get_devices('jane-77')
|
|
152
154
|
client.remove_device(jane_phone['id'], jane_phone['user_id'])
|
153
155
|
```
|
154
156
|
|
157
|
+
### Blocklists
|
158
|
+
```ruby
|
159
|
+
# Create a blocklist
|
160
|
+
client.create_blocklist('my_blocker', %w[fudge cream sugar])
|
161
|
+
|
162
|
+
# Enable it on messaging channel type
|
163
|
+
client.update_channel_type('messaging', blocklist: 'my_blocker', blocklist_behavior: 'block')
|
164
|
+
|
165
|
+
# Get the details of the blocklist
|
166
|
+
client.get_blocklist('my_blocker')
|
167
|
+
|
168
|
+
# Delete the blocklist
|
169
|
+
client.delete_blocklist('my_blocker')
|
170
|
+
```
|
171
|
+
|
172
|
+
### Export Channels
|
173
|
+
```ruby
|
174
|
+
# Register an export
|
175
|
+
response = client.export_channels({type: 'messaging', id: 'jane'})
|
176
|
+
|
177
|
+
# Check completion
|
178
|
+
status_response = client.get_export_channel_status(response['task_id'])
|
179
|
+
# status_response['status'] == 'pending', 'completed'
|
180
|
+
```
|
181
|
+
|
155
182
|
### Example Rails application
|
156
183
|
|
157
184
|
See [an example rails application using the Ruby SDK](https://github.com/GetStream/rails-chat-example).
|
data/lib/stream-chat/client.rb
CHANGED
@@ -9,6 +9,8 @@ require 'stream-chat/errors'
|
|
9
9
|
require 'stream-chat/version'
|
10
10
|
|
11
11
|
module StreamChat
|
12
|
+
DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
|
13
|
+
|
12
14
|
class Client
|
13
15
|
BASE_URL = 'https://chat-us-east-1.stream-io-api.com'
|
14
16
|
|
@@ -262,6 +264,14 @@ module StreamChat
|
|
262
264
|
delete("blocklists/#{name}")
|
263
265
|
end
|
264
266
|
|
267
|
+
def export_channels(*channels)
|
268
|
+
post('export_channels', data: { "channels": channels })
|
269
|
+
end
|
270
|
+
|
271
|
+
def get_export_channel_status(task_id)
|
272
|
+
get("export_channels/#{task_id}")
|
273
|
+
end
|
274
|
+
|
265
275
|
def put(relative_url, params: nil, data: nil)
|
266
276
|
make_http_request(:put, relative_url, params: params, data: data)
|
267
277
|
end
|
@@ -334,7 +344,7 @@ module StreamChat
|
|
334
344
|
headers['Authorization'] = @auth_token
|
335
345
|
headers['stream-auth-type'] = 'jwt'
|
336
346
|
url = [@base_url, relative_url].join('/')
|
337
|
-
params =
|
347
|
+
params = params.nil? ? {} : params
|
338
348
|
params = Hash[get_default_params.merge(params).sort_by { |k, _v| k.to_s }]
|
339
349
|
url = "#{url}?#{URI.encode_www_form(params)}"
|
340
350
|
|
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.2.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-01-05 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
|