stream-chat-ruby 2.16.0 → 2.17.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: 145d6248ef8e3ba19eabf0a6faaeeb75b944cfc4a0c21fb056fbf53a2b938990
4
- data.tar.gz: 0000d699ce54ced068043adbb1f9f54c1f136be0ebf87d08df162202ee7e2ae8
3
+ metadata.gz: b89ec4be90e50aefec0c944f7dcd33ea5cca18b709f431467f20e44a303b7bfe
4
+ data.tar.gz: a94ca94e1c4144f9bdc699d694a55f88ab1a1f46306941ffa912573af45a2bb7
5
5
  SHA512:
6
- metadata.gz: 83857f5388fdf6b40c80c972a0d5c721d230d593edf243a282b76d181643cd0ab3e6337b00dda5c78846958542d4fc18e9f635450f85b66dc4442dc703e96c06
7
- data.tar.gz: 6686e2291b956bcfcdcdd95c233c225ee5d46be8fe06e529a49ffc5b11b3546553690f3bd647f1b9784312d0c1ff9615cbc98316f414b076c02a4853ec09e256
6
+ metadata.gz: b9a030a478585db63eaccc77cfe5375610afe83c2a4858f6e5f3965ad0802f08a2eba9a949f66bc3bf7e89dd8b8211098d782e9096b83b1ed946a3a113704d72
7
+ data.tar.gz: b7d4e530a4a5599fce27c56d18b2689980a5aae0153290aa0065bf9e2efde674555693c3ebfb19a27eeba28f238b80814b5679afb8fb81dd1c0062a0ec0d46bd
@@ -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
21
- - env:
28
+
29
+ - run: bundle exec rake test
30
+ env:
22
31
  STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
23
32
  STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
24
33
  STREAM_CHAT_API_HOST: ${{ secrets.STREAM_CHAT_API_HOST }}
25
- run: bundle exec rake test
@@ -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
- # .ruby-version
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,8 +1,19 @@
1
- ## December 1st, 2021 - 2.16.0
1
+ # Changelog
2
2
 
3
- - Add permissions v2 APIs
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
4
 
5
- ## November 25th, 2021 - 2.15.0
5
+ ## [2.17.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.16.0...v2.17.0) (2022-01-14)
6
+
7
+
8
+ ### Features
9
+
10
+ * 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))
11
+
12
+ ## [2.16.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.15.0...v2.16.0) (2021-12-01)
13
+
14
+ - Add permissions v2 APIs by @ffenix113 in #62
15
+
16
+ ## [2.15.0](https://github.com/GetStream/stream-chat-ruby/compare/v2.14.0...v2.15.0) (2021-11-25)
6
17
 
7
18
  - Add configuration support for channel truncate
8
19
  - truncated_at: to truncate channel up to given time
data/Gemfile CHANGED
@@ -13,6 +13,7 @@ end
13
13
 
14
14
  group :test do
15
15
  gem 'faraday'
16
+ gem 'faraday-multipart'
16
17
  gem 'rack'
17
18
  gem 'simplecov'
18
19
  end
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 (3.0, 2.7, 2.6, 2.5)
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
- - Update CHANGELOG
224
- - Update the version in `lib/stream-chat/version.rb`
225
- - Commit and push to GitHub
226
- - Build the gem with `bundle exec rake build`
227
- - Publish the gem with `bundle exec rake release`
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.
@@ -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
- @client.post(url, data: { add_members: user_ids })
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)
@@ -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(file, content_type)
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
@@ -3,5 +3,5 @@
3
3
  # lib/version.rb
4
4
 
5
5
  module StreamChat
6
- VERSION = '2.16.0'
6
+ VERSION = '2.17.0'
7
7
  end
@@ -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
@@ -23,5 +23,5 @@ Gem::Specification.new do |gem|
23
23
  gem.add_development_dependency 'rake'
24
24
  gem.add_development_dependency 'rspec'
25
25
  gem.add_development_dependency 'simplecov'
26
- gem.metadata['rubygems_mfa_required'] = 'true'
26
+ gem.metadata['rubygems_mfa_required'] = 'false'
27
27
  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.16.0
4
+ version: 2.17.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-12-01 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -88,8 +88,11 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - ".github/CODEOWNERS"
90
90
  - ".github/workflows/ci.yml"
91
+ - ".github/workflows/initiate_release.yml"
92
+ - ".github/workflows/release.yml"
91
93
  - ".gitignore"
92
94
  - ".rubocop.yml"
95
+ - ".versionrc.js"
93
96
  - CHANGELOG.md
94
97
  - Gemfile
95
98
  - LICENSE
@@ -102,11 +105,12 @@ files:
102
105
  - lib/stream-chat/errors.rb
103
106
  - lib/stream-chat/util.rb
104
107
  - lib/stream-chat/version.rb
108
+ - scripts/get_changelog_diff.js
105
109
  - stream-chat.gemspec
106
110
  homepage: http://github.com/GetStream/stream-chat-ruby
107
111
  licenses: []
108
112
  metadata:
109
- rubygems_mfa_required: 'true'
113
+ rubygems_mfa_required: 'false'
110
114
  post_install_message:
111
115
  rdoc_options: []
112
116
  require_paths:
@@ -122,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
126
  - !ruby/object:Gem::Version
123
127
  version: '0'
124
128
  requirements: []
125
- rubygems_version: 3.0.3
129
+ rubygems_version: 3.1.2
126
130
  signing_key:
127
131
  specification_version: 4
128
132
  summary: The low level client for serverside calls for Stream Chat.