stream-chat-ruby 2.1.0 → 2.2.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: 9b1c2b73dbb2e8e0e65aaa47da051ad41694ae5faf6c1d6d1de9e368d9f6bea6
4
- data.tar.gz: 45a43c071349a05ce38a9df5840182ce299f3c41942c351dfb033aad314bba32
3
+ metadata.gz: 431753dd911d42b0ca289bc4ca1b35f0043dca65d0bc846bb1af6128c491f386
4
+ data.tar.gz: 7f48350204e9bad4de4a975c2d88339934e8cf195c7b38fc876a22bdd9139c63
5
5
  SHA512:
6
- metadata.gz: 37f5d1762e3185a5a92698b0e3ea9f8358d21a5d90c9683387b29a8b64e31e6548d1ac3090bf111b83175e1a228ecf6ed711123e9b080ea01332de5d8d33a9d4
7
- data.tar.gz: 68eb7fee75f01cae1d684fd4c9f51354914656193e4681d2d8a398659613f45bbf37f2322874d01e12f41a395f9a6f68431586a36b1c7094ccf770d85012c3eb
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
@@ -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
- [![Build Status](https://travis-ci.com/GetStream/stream-chat-ruby.svg?branch=master)](https://travis-ci.com/GetStream/stream-chat-ruby) [![Gem Version](https://badge.fury.io/rb/stream-chat-ruby.svg)](http://badge.fury.io/rb/stream-chat-ruby)
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.6, 2.5, 2.4, 2.3)
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).
@@ -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 = !params.nil? ? 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
 
@@ -26,5 +26,6 @@ module StreamChat
26
26
  end
27
27
  end
28
28
  end
29
+
29
30
  class StreamChannelException < StandardError; end
30
31
  end
@@ -3,5 +3,5 @@
3
3
  # lib/version.rb
4
4
 
5
5
  module StreamChat
6
- VERSION = '2.1.0'
6
+ VERSION = '2.2.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.1.0
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: 2020-10-05 00:00:00.000000000 Z
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
@@ -1,10 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem update bundler
4
- rvm:
5
- - 2.5
6
- - 2.6
7
- - 2.7
8
- script:
9
- - bundle exec rake rubocop
10
- - bundle exec rake test