stream-chat-ruby 2.15.0 → 2.17.2
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 +14 -6
- data/.github/workflows/initiate_release.yml +47 -0
- data/.github/workflows/release.yml +40 -0
- data/.gitignore +2 -1
- data/.rubocop.yml +3 -3
- data/.versionrc.js +16 -0
- data/CHANGELOG.md +28 -1
- data/Gemfile +0 -1
- data/README.md +10 -6
- data/lib/stream-chat/channel.rb +7 -2
- data/lib/stream-chat/client.rb +34 -2
- data/lib/stream-chat/version.rb +1 -1
- data/scripts/get_changelog_diff.js +26 -0
- data/stream-chat.gemspec +9 -1
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 657677c7a41b9b356a92c750e823a3b9689e0a5af3e0e19e3178b443d653a6ed
|
4
|
+
data.tar.gz: 3025aaf97b2508822c27476dd58c053f2d823b6fb30f25ff05cef1cd49590ace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed000d8a280c6fb8334cc0f3bfb20a42300b551ba5c98084ccbe2c2cc4b06deebc90962bcfe4605f91d30a2d1ae2b73c2f193e25540458262b1d88802f9c25f0
|
7
|
+
data.tar.gz: 4cd5063de70c7e26f90f15b1962825cae3121620fa36e0554ac49c9cc3eb4e118629da6af8e2d64596812d74a3d498dbd1562b5f12571b74a85c3beee206c5cc
|
data/.github/workflows/ci.yml
CHANGED
@@ -8,18 +8,26 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
max-parallel: 1
|
10
10
|
matrix:
|
11
|
-
ruby: ['2.5', '2.6', '2.7', '3.0']
|
12
|
-
name: Ruby ${{ matrix.ruby }}
|
11
|
+
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
|
12
|
+
name: 💎 Ruby ${{ matrix.ruby }}
|
13
13
|
steps:
|
14
14
|
- uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
fetch-depth: 0 # gives the commit linter access to previous commits
|
17
|
+
|
18
|
+
- name: Commit message linter
|
19
|
+
if: ${{ matrix.ruby == '2.5' }}
|
20
|
+
uses: wagoid/commitlint-github-action@v4
|
21
|
+
|
15
22
|
- uses: ruby/setup-ruby@v1
|
16
23
|
with:
|
17
24
|
ruby-version: ${{ matrix.ruby }}
|
18
25
|
bundler-cache: true
|
19
26
|
|
20
|
-
-
|
27
|
+
- run: bundle exec rake rubocop
|
28
|
+
|
29
|
+
- run: bundle exec rake test
|
30
|
+
env:
|
21
31
|
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
|
22
32
|
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
|
23
|
-
|
24
|
-
bundle exec rake rubocop
|
25
|
-
bundle exec rake test
|
33
|
+
STREAM_CHAT_API_HOST: ${{ secrets.STREAM_CHAT_API_HOST }}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: Create release PR
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
version:
|
7
|
+
description: "The new version number with 'v' prefix. Example: v1.40.1"
|
8
|
+
required: true
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
init_release:
|
12
|
+
name: 🚀 Create release PR
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
with:
|
17
|
+
fetch-depth: 0 # gives the changelog generator access to all previous commits
|
18
|
+
|
19
|
+
- name: Update CHANGELOG.md, version.rb and push release branch
|
20
|
+
env:
|
21
|
+
VERSION: ${{ github.event.inputs.version }}
|
22
|
+
run: |
|
23
|
+
npx --yes standard-version@9.3.2 --release-as "$VERSION" --skip.tag --skip.commit --tag-prefix=v
|
24
|
+
git config --global user.name 'github-actions'
|
25
|
+
git config --global user.email 'release@getstream.io'
|
26
|
+
git checkout -q -b "release-$VERSION"
|
27
|
+
git commit -am "chore(release): $VERSION"
|
28
|
+
git push -q -u origin "release-$VERSION"
|
29
|
+
|
30
|
+
- name: Get changelog diff
|
31
|
+
uses: actions/github-script@v5
|
32
|
+
with:
|
33
|
+
script: |
|
34
|
+
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
|
35
|
+
core.exportVariable('CHANGELOG', get_change_log_diff())
|
36
|
+
|
37
|
+
- name: Open pull request
|
38
|
+
env:
|
39
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
40
|
+
run: |
|
41
|
+
gh pr create \
|
42
|
+
-t "Release ${{ github.event.inputs.version }}" \
|
43
|
+
-b "# :rocket: ${{ github.event.inputs.version }}
|
44
|
+
Make sure to use squash & merge when merging!
|
45
|
+
Once this is merged, another job will kick off automatically and publish the package.
|
46
|
+
# :memo: Changelog
|
47
|
+
${{ env.CHANGELOG }}"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [closed]
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
Release:
|
11
|
+
name: 🚀 Release
|
12
|
+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
with:
|
17
|
+
fetch-depth: 0
|
18
|
+
|
19
|
+
- uses: actions/github-script@v5
|
20
|
+
with:
|
21
|
+
script: |
|
22
|
+
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
|
23
|
+
core.exportVariable('CHANGELOG', get_change_log_diff())
|
24
|
+
|
25
|
+
// Getting the release version from the PR source branch
|
26
|
+
// Source branch looks like this: release-1.0.0
|
27
|
+
const version = context.payload.pull_request.head.ref.split('-')[1]
|
28
|
+
core.exportVariable('VERSION', version)
|
29
|
+
|
30
|
+
- name: Publish gem
|
31
|
+
uses: dawidd6/action-publish-gem@v1
|
32
|
+
with:
|
33
|
+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
34
|
+
|
35
|
+
- name: Create release on GitHub
|
36
|
+
uses: ncipollo/release-action@v1
|
37
|
+
with:
|
38
|
+
body: ${{ env.CHANGELOG }}
|
39
|
+
tag: ${{ env.VERSION }}
|
40
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
/test/tmp/
|
10
10
|
/test/version_tmp/
|
11
11
|
/tmp/
|
12
|
+
.vscode
|
12
13
|
|
13
14
|
# Used by dotenv library to load environment variables.
|
14
15
|
# .env
|
@@ -43,7 +44,7 @@ build-iPhoneSimulator/
|
|
43
44
|
# for a library or gem, you might want to ignore these files since the code is
|
44
45
|
# intended to run in multiple environments; otherwise, check them in:
|
45
46
|
Gemfile.lock
|
46
|
-
|
47
|
+
.ruby-version
|
47
48
|
# .ruby-gemset
|
48
49
|
|
49
50
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
data/.rubocop.yml
CHANGED
@@ -21,9 +21,6 @@ Metrics/MethodLength:
|
|
21
21
|
Naming/AccessorMethodName:
|
22
22
|
Enabled: false
|
23
23
|
|
24
|
-
Security/Open:
|
25
|
-
Enabled: false
|
26
|
-
|
27
24
|
Style/AccessorGrouping:
|
28
25
|
Enabled: false
|
29
26
|
Style/Documentation:
|
@@ -32,3 +29,6 @@ Style/DoubleCopDisableDirective:
|
|
32
29
|
Enabled: false
|
33
30
|
Style/FrozenStringLiteralComment:
|
34
31
|
Enabled: false
|
32
|
+
|
33
|
+
Gemspec/RequireMFA:
|
34
|
+
Enabled: false
|
data/.versionrc.js
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
const versionFileUpdater = {
|
2
|
+
VERSION_REGEX: /VERSION = '(.+)'/,
|
3
|
+
|
4
|
+
readVersion: function (contents) {
|
5
|
+
const version = this.VERSION_REGEX.exec(contents)[1];
|
6
|
+
return version;
|
7
|
+
},
|
8
|
+
|
9
|
+
writeVersion: function (contents, version) {
|
10
|
+
return contents.replace(this.VERSION_REGEX.exec(contents)[0], `VERSION = '${version}'`);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
module.exports = {
|
15
|
+
bumpFiles: [{ filename: './lib/stream-chat/version.rb', updater: versionFileUpdater }],
|
16
|
+
}
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,31 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
|
+
|
5
|
+
### [2.17.2](https://github.com/GetStream/stream-chat-ruby/compare/v2.17.1...v2.17.2) (2022-01-17)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
* added some new metadata to the gemspec ([#69](https://github.com/GetStream/stream-chat-ruby/issues/69)) ([3e747bc](https://github.com/GetStream/stream-chat-ruby/commit/3e747bcd6aa338b08e136febfb0cf06f29d366b5))
|
9
|
+
|
10
|
+
### [2.17.1](https://github.com/GetStream/stream-chat-ruby/compare/v2.17.0...v2.17.1) (2022-01-17)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* load faraday-mutipart error ([#67](https://github.com/GetStream/stream-chat-ruby/issues/67)) ([55ec107](https://github.com/GetStream/stream-chat-ruby/commit/55ec107fb4d6af887aa562c1e04d90a669c630cb))
|
16
|
+
|
17
|
+
## [2.17.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.16.0...v2.17.0) (2022-01-14)
|
18
|
+
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* add options to add members ([#63](https://github.com/GetStream/stream-chat-ruby/issues/63)) ([89c9fa9](https://github.com/GetStream/stream-chat-ruby/commit/89c9fa98e19565c4b5353077523a1d407e1f10c9))
|
23
|
+
|
24
|
+
## [2.16.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.15.0...v2.16.0) (2021-12-01)
|
25
|
+
|
26
|
+
- Add permissions v2 APIs by @ffenix113 in #62
|
27
|
+
|
28
|
+
## [2.15.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.14.0...v2.15.0) (2021-11-25)
|
2
29
|
|
3
30
|
- Add configuration support for channel truncate
|
4
31
|
- truncated_at: to truncate channel up to given time
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Android SDK libraries (https://getstream.io/chat/).
|
|
14
14
|
|
15
15
|
stream-chat-ruby supports:
|
16
16
|
|
17
|
-
- Ruby (
|
17
|
+
- Ruby (2.5, 2.6, 2.7, 3.0, 3.1)
|
18
18
|
|
19
19
|
#### Install
|
20
20
|
|
@@ -216,12 +216,16 @@ First, make sure you can run the test suite. Tests are run via rspec
|
|
216
216
|
STREAM_CHAT_API_KEY=my_api_key STREAM_CHAT_API_SECRET=my_api_secret bundle exec rake spec
|
217
217
|
```
|
218
218
|
|
219
|
+
This repository follows a commit message convention in order to automatically generate the [CHANGELOG](./CHANGELOG.md). Make sure you follow the rules of [conventional commits](https://www.conventionalcommits.org/) when opening a pull request.
|
220
|
+
|
219
221
|
### Releasing a new version
|
220
222
|
|
221
223
|
In order to release new version you need to be a maintainer of the library.
|
222
224
|
|
223
|
-
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
-
|
225
|
+
- Kick off a job called `initiate_release` ([link](https://github.com/GetStream/stream-chat-ruby/actions/workflows/initiate_release.yml)).
|
226
|
+
|
227
|
+
The job creates a pull request with the changelog. Check if it looks good.
|
228
|
+
|
229
|
+
- Merge the pull request.
|
230
|
+
|
231
|
+
Once the PR is merged, it automatically kicks off another job which will upload the Gem to RubyGems.org and creates a GitHub release.
|
data/lib/stream-chat/channel.rb
CHANGED
@@ -99,8 +99,9 @@ module StreamChat
|
|
99
99
|
@client.post("#{url}/truncate", data: options)
|
100
100
|
end
|
101
101
|
|
102
|
-
def add_members(user_ids)
|
103
|
-
|
102
|
+
def add_members(user_ids, **options)
|
103
|
+
payload = options.merge({ add_members: user_ids })
|
104
|
+
@client.post(url, data: payload)
|
104
105
|
end
|
105
106
|
|
106
107
|
def invite_members(user_ids)
|
@@ -115,6 +116,10 @@ module StreamChat
|
|
115
116
|
@client.post(url, data: { remove_members: user_ids })
|
116
117
|
end
|
117
118
|
|
119
|
+
def assign_roles(members, message = nil)
|
120
|
+
@client.post(url, data: { assign_roles: members, message: message })
|
121
|
+
end
|
122
|
+
|
118
123
|
def demote_moderators(user_ids)
|
119
124
|
@client.post(url, data: { demote_moderators: user_ids })
|
120
125
|
end
|
data/lib/stream-chat/client.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# lib/client.rb
|
4
4
|
require 'open-uri'
|
5
5
|
require 'faraday'
|
6
|
+
require 'faraday/multipart'
|
6
7
|
require 'jwt'
|
7
8
|
require 'time'
|
8
9
|
require 'stream-chat/channel'
|
@@ -389,10 +390,9 @@ module StreamChat
|
|
389
390
|
def send_file(relative_url, file_url, user, content_type = 'application/octet-stream')
|
390
391
|
url = [@base_url, relative_url].join('/')
|
391
392
|
|
392
|
-
file = open(file_url)
|
393
393
|
body = { user: user.to_json }
|
394
394
|
|
395
|
-
body[:file] = Faraday::UploadIO.new(
|
395
|
+
body[:file] = Faraday::UploadIO.new(file_url, content_type)
|
396
396
|
|
397
397
|
response = @conn.post url do |req|
|
398
398
|
req.headers['X-Stream-Client'] = get_user_agent
|
@@ -429,6 +429,38 @@ module StreamChat
|
|
429
429
|
get('commands')
|
430
430
|
end
|
431
431
|
|
432
|
+
def list_permissions
|
433
|
+
get('permissions')
|
434
|
+
end
|
435
|
+
|
436
|
+
def get_permission(id)
|
437
|
+
get("permissions/#{id}")
|
438
|
+
end
|
439
|
+
|
440
|
+
def create_permission(permission)
|
441
|
+
post('permissions', data: permission)
|
442
|
+
end
|
443
|
+
|
444
|
+
def update_permission(id, permission)
|
445
|
+
put("permissions/#{id}", data: permission)
|
446
|
+
end
|
447
|
+
|
448
|
+
def delete_permission(id)
|
449
|
+
delete("permissions/#{id}")
|
450
|
+
end
|
451
|
+
|
452
|
+
def create_role(name)
|
453
|
+
post('roles', data: { name: name })
|
454
|
+
end
|
455
|
+
|
456
|
+
def delete_role(name)
|
457
|
+
delete("roles/#{name}")
|
458
|
+
end
|
459
|
+
|
460
|
+
def list_roles
|
461
|
+
get('roles')
|
462
|
+
end
|
463
|
+
|
432
464
|
private
|
433
465
|
|
434
466
|
def get_default_params
|
data/lib/stream-chat/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
/*
|
2
|
+
Here we're trying to parse the latest changes from CHANGELOG.md file.
|
3
|
+
The changelog looks like this:
|
4
|
+
|
5
|
+
## 0.0.3
|
6
|
+
- Something #3
|
7
|
+
## 0.0.2
|
8
|
+
- Something #2
|
9
|
+
## 0.0.1
|
10
|
+
- Something #1
|
11
|
+
|
12
|
+
In this case we're trying to extract "- Something #3" since that's the latest change.
|
13
|
+
*/
|
14
|
+
module.exports = () => {
|
15
|
+
const fs = require('fs')
|
16
|
+
|
17
|
+
changelog = fs.readFileSync('CHANGELOG.md', 'utf8')
|
18
|
+
releases = changelog.match(/## [?[0-9](.+)/g)
|
19
|
+
|
20
|
+
current_release = changelog.indexOf(releases[0])
|
21
|
+
previous_release = changelog.indexOf(releases[1])
|
22
|
+
|
23
|
+
latest_changes = changelog.substr(current_release, previous_release - current_release)
|
24
|
+
|
25
|
+
return latest_changes
|
26
|
+
}
|
data/stream-chat.gemspec
CHANGED
@@ -17,11 +17,19 @@ Gem::Specification.new do |gem|
|
|
17
17
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
end
|
19
19
|
gem.required_ruby_version = '>=2.5.0'
|
20
|
+
gem.metadata = {
|
21
|
+
'rubygems_mfa_required' => 'false',
|
22
|
+
'homepage_uri' => 'https://getstream.io/chat/docs/',
|
23
|
+
'bug_tracker_uri' => 'https://github.com/GetStream/stream-chat-ruby/issues',
|
24
|
+
'documentation_uri' => 'https://getstream.io/chat/docs/ruby/?language=ruby',
|
25
|
+
'changelog_uri' => 'https://github.com/GetStream/stream-chat-ruby/blob/master/CHANGELOG.md',
|
26
|
+
'source_code_uri' => 'https://github.com/GetStream/stream-chat-ruby'
|
27
|
+
}
|
20
28
|
|
21
29
|
gem.add_dependency 'faraday'
|
30
|
+
gem.add_dependency 'faraday-multipart'
|
22
31
|
gem.add_dependency 'jwt'
|
23
32
|
gem.add_development_dependency 'rake'
|
24
33
|
gem.add_development_dependency 'rspec'
|
25
34
|
gem.add_development_dependency 'simplecov'
|
26
|
-
gem.metadata['rubygems_mfa_required'] = 'true'
|
27
35
|
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.
|
4
|
+
version: 2.17.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:
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-multipart
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: jwt
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,8 +102,11 @@ extra_rdoc_files: []
|
|
88
102
|
files:
|
89
103
|
- ".github/CODEOWNERS"
|
90
104
|
- ".github/workflows/ci.yml"
|
105
|
+
- ".github/workflows/initiate_release.yml"
|
106
|
+
- ".github/workflows/release.yml"
|
91
107
|
- ".gitignore"
|
92
108
|
- ".rubocop.yml"
|
109
|
+
- ".versionrc.js"
|
93
110
|
- CHANGELOG.md
|
94
111
|
- Gemfile
|
95
112
|
- LICENSE
|
@@ -102,11 +119,17 @@ files:
|
|
102
119
|
- lib/stream-chat/errors.rb
|
103
120
|
- lib/stream-chat/util.rb
|
104
121
|
- lib/stream-chat/version.rb
|
122
|
+
- scripts/get_changelog_diff.js
|
105
123
|
- stream-chat.gemspec
|
106
124
|
homepage: http://github.com/GetStream/stream-chat-ruby
|
107
125
|
licenses: []
|
108
126
|
metadata:
|
109
|
-
rubygems_mfa_required: '
|
127
|
+
rubygems_mfa_required: 'false'
|
128
|
+
homepage_uri: https://getstream.io/chat/docs/
|
129
|
+
bug_tracker_uri: https://github.com/GetStream/stream-chat-ruby/issues
|
130
|
+
documentation_uri: https://getstream.io/chat/docs/ruby/?language=ruby
|
131
|
+
changelog_uri: https://github.com/GetStream/stream-chat-ruby/blob/master/CHANGELOG.md
|
132
|
+
source_code_uri: https://github.com/GetStream/stream-chat-ruby
|
110
133
|
post_install_message:
|
111
134
|
rdoc_options: []
|
112
135
|
require_paths:
|