stream-chat-ruby 3.15.0 → 3.16.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/CHANGELOG.md +3 -1
- data/CONTRIBUTING.md +28 -1
- data/Makefile +50 -0
- data/README.md +23 -0
- data/lib/stream-chat/client.rb +52 -2
- 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: abe37f40d0bab27e95a353d06e16746c6bf581d6b17e007963572cabac0e1ad3
|
4
|
+
data.tar.gz: 2c0e8cd83b7a9d30982469efe54612526d7ea83c3c71d8a8b3ac76748b8be988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8151d017630003390f49c4b067b941e31ff4cd95190f934f8c4b51b05392d01b687b6129b2c7a45d30eb4f1196bd3c729a95ef0a912f00f8aa579c7b22a508da
|
7
|
+
data.tar.gz: 492cbf78fc3b4eebb89771d9ff5a3a45160e05bdfbaf7fe72ea2e97d04db0ffd7d426499883d089e14fa1f475b414a68a211d1c9a9343e723c33c54ddc2d85e8
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
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
|
+
## [3.16.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.15.0...v3.16.0) (2025-06-18)
|
6
|
+
|
5
7
|
## [3.15.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.14.0...v3.15.0) (2025-06-06)
|
6
8
|
|
7
9
|
## [3.14.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.13.0...v3.14.0) (2025-04-07)
|
@@ -350,4 +352,4 @@ before continuing with v3.0.0 of this library.
|
|
350
352
|
- Added `client.search`
|
351
353
|
- Added `client.update_users_partial`
|
352
354
|
- Added `client.update_user_partial`
|
353
|
-
- Added `client.reactivate_user`
|
355
|
+
- Added `client.reactivate_user`
|
data/CONTRIBUTING.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# :recycle: Contributing
|
3
2
|
|
4
3
|
We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details.
|
@@ -63,6 +62,34 @@ Recommended settings:
|
|
63
62
|
}
|
64
63
|
```
|
65
64
|
|
65
|
+
For Docker-based development, you can use:
|
66
|
+
|
67
|
+
```shell
|
68
|
+
$ make lint_with_docker # Run linters in Docker
|
69
|
+
$ make lint-fix_with_docker # Fix linting issues in Docker
|
70
|
+
$ make test_with_docker # Run tests in Docker
|
71
|
+
$ make check_with_docker # Run both linters and tests in Docker
|
72
|
+
$ make sorbet_with_docker # Run Sorbet type checker in Docker
|
73
|
+
```
|
74
|
+
|
75
|
+
You can customize the Ruby version used in Docker by setting the RUBY_VERSION variable:
|
76
|
+
|
77
|
+
```shell
|
78
|
+
$ RUBY_VERSION=3.1 make test_with_docker
|
79
|
+
```
|
80
|
+
|
81
|
+
By default, the API client connects to the production Stream Chat API. You can override this by setting the STREAM_CHAT_URL environment variable:
|
82
|
+
|
83
|
+
```shell
|
84
|
+
$ STREAM_CHAT_URL=http://localhost:3030 make test
|
85
|
+
```
|
86
|
+
|
87
|
+
When running tests in Docker, the `test_with_docker` command automatically sets up networking to allow the Docker container to access services running on your host machine via `host.docker.internal`. This is particularly useful for connecting to a local Stream Chat server:
|
88
|
+
|
89
|
+
```shell
|
90
|
+
$ STREAM_CHAT_URL=http://host.docker.internal:3030 make test_with_docker
|
91
|
+
```
|
92
|
+
|
66
93
|
### Commit message convention
|
67
94
|
|
68
95
|
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.
|
data/Makefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
STREAM_KEY ?= NOT_EXIST
|
2
|
+
STREAM_SECRET ?= NOT_EXIST
|
3
|
+
RUBY_VERSION ?= 3.0
|
4
|
+
STREAM_CHAT_URL ?= https://chat.stream-io-api.com
|
5
|
+
|
6
|
+
# These targets are not files
|
7
|
+
.PHONY: help check test lint lint-fix test_with_docker lint_with_docker lint-fix_with_docker
|
8
|
+
|
9
|
+
help: ## Display this help message
|
10
|
+
@echo "Please use \`make <target>\` where <target> is one of"
|
11
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; \
|
12
|
+
{printf "\033[36m%-40s\033[0m %s\n", $$1, $$2}'
|
13
|
+
|
14
|
+
lint: ## Run linters
|
15
|
+
bundle exec rubocop
|
16
|
+
|
17
|
+
lint-fix: ## Fix linting issues
|
18
|
+
bundle exec rubocop -a
|
19
|
+
|
20
|
+
test: ## Run tests
|
21
|
+
STREAM_KEY=$(STREAM_KEY) STREAM_SECRET=$(STREAM_SECRET) bundle exec rspec
|
22
|
+
|
23
|
+
check: lint test ## Run linters + tests
|
24
|
+
|
25
|
+
console: ## Start a console with the gem loaded
|
26
|
+
bundle exec rake console
|
27
|
+
|
28
|
+
lint_with_docker: ## Run linters in Docker (set RUBY_VERSION to change Ruby version)
|
29
|
+
docker run -t -i -w /code -v $(PWD):/code ruby:$(RUBY_VERSION) sh -c "gem install bundler && bundle install && bundle exec rubocop"
|
30
|
+
|
31
|
+
lint-fix_with_docker: ## Fix linting issues in Docker (set RUBY_VERSION to change Ruby version)
|
32
|
+
docker run -t -i -w /code -v $(PWD):/code ruby:$(RUBY_VERSION) sh -c "gem install bundler && bundle install && bundle exec rubocop -a"
|
33
|
+
|
34
|
+
test_with_docker: ## Run tests in Docker (set RUBY_VERSION to change Ruby version)
|
35
|
+
docker run -t -i -w /code -v $(PWD):/code --add-host=host.docker.internal:host-gateway -e STREAM_KEY=$(STREAM_KEY) -e STREAM_SECRET=$(STREAM_SECRET) -e "STREAM_CHAT_URL=http://host.docker.internal:3030" ruby:$(RUBY_VERSION) sh -c "gem install bundler && bundle install && bundle exec rspec"
|
36
|
+
|
37
|
+
check_with_docker: lint_with_docker test_with_docker ## Run linters + tests in Docker (set RUBY_VERSION to change Ruby version)
|
38
|
+
|
39
|
+
sorbet: ## Run Sorbet type checker
|
40
|
+
bundle exec srb tc
|
41
|
+
|
42
|
+
sorbet_with_docker: ## Run Sorbet type checker in Docker (set RUBY_VERSION to change Ruby version)
|
43
|
+
docker run -t -i -w /code -v $(PWD):/code ruby:$(RUBY_VERSION) sh -c "gem install bundler && bundle install && bundle exec srb tc"
|
44
|
+
|
45
|
+
coverage: ## Generate test coverage report
|
46
|
+
COVERAGE=true bundle exec rspec
|
47
|
+
@echo "Coverage report available at ./coverage/index.html"
|
48
|
+
|
49
|
+
reviewdog: ## Run reviewdog for CI
|
50
|
+
bundle exec rubocop --format json | reviewdog -f=rubocop -name=rubocop -reporter=github-pr-review
|
data/README.md
CHANGED
@@ -132,6 +132,29 @@ deleted_message = client.delete_message(m1['message']['id'])
|
|
132
132
|
|
133
133
|
```
|
134
134
|
|
135
|
+
### Reminders
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
# Create a reminder for a message
|
139
|
+
reminder = client.create_reminder(m1['message']['id'], 'bob-1', DateTime.now + 1)
|
140
|
+
|
141
|
+
# Create a reminder without a notification time (just mark for later)
|
142
|
+
reminder = client.create_reminder(m1['message']['id'], 'bob-1')
|
143
|
+
|
144
|
+
# Update a reminder
|
145
|
+
updated_reminder = client.update_reminder(m1['message']['id'], 'bob-1', DateTime.now + 2)
|
146
|
+
|
147
|
+
# Delete a reminder
|
148
|
+
client.delete_reminder(m1['message']['id'], 'bob-1')
|
149
|
+
|
150
|
+
# Query reminders for a user
|
151
|
+
reminders = client.query_reminders('bob-1')
|
152
|
+
|
153
|
+
# Query reminders with filters
|
154
|
+
filter = { 'channel_cid' => 'messaging:bob-and-jane' }
|
155
|
+
reminders = client.query_reminders('bob-1', filter)
|
156
|
+
```
|
157
|
+
|
135
158
|
### Devices
|
136
159
|
|
137
160
|
```ruby
|
data/lib/stream-chat/client.rb
CHANGED
@@ -7,6 +7,7 @@ require 'faraday/multipart'
|
|
7
7
|
require 'faraday/net_http_persistent'
|
8
8
|
require 'jwt'
|
9
9
|
require 'time'
|
10
|
+
require 'date'
|
10
11
|
require 'sorbet-runtime'
|
11
12
|
require 'stream-chat/channel'
|
12
13
|
require 'stream-chat/errors'
|
@@ -688,7 +689,7 @@ module StreamChat
|
|
688
689
|
# Revoke tokens for an application issued since the given date.
|
689
690
|
sig { params(before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
690
691
|
def revoke_tokens(before)
|
691
|
-
before =
|
692
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
692
693
|
update_app_settings({ 'revoke_tokens_issued_before' => before })
|
693
694
|
end
|
694
695
|
|
@@ -701,7 +702,7 @@ module StreamChat
|
|
701
702
|
# Revoke tokens for users issued since.
|
702
703
|
sig { params(user_ids: T::Array[String], before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
703
704
|
def revoke_users_token(user_ids, before)
|
704
|
-
before =
|
705
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
705
706
|
|
706
707
|
updates = []
|
707
708
|
user_ids.map do |user_id|
|
@@ -939,6 +940,55 @@ module StreamChat
|
|
939
940
|
post('threads', data: params)
|
940
941
|
end
|
941
942
|
|
943
|
+
# Creates a reminder for a message.
|
944
|
+
# @param message_id [String] The ID of the message to create a reminder for
|
945
|
+
# @param user_id [String] The ID of the user creating the reminder
|
946
|
+
# @param remind_at [DateTime, nil] When to remind the user (optional)
|
947
|
+
# @return [StreamChat::StreamResponse] API response
|
948
|
+
sig { params(message_id: String, user_id: String, remind_at: T.nilable(DateTime)).returns(StreamChat::StreamResponse) }
|
949
|
+
def create_reminder(message_id, user_id, remind_at = nil)
|
950
|
+
data = { user_id: user_id }
|
951
|
+
data[:remind_at] = remind_at.rfc3339 if remind_at.instance_of?(DateTime)
|
952
|
+
post("messages/#{message_id}/reminders", data: data)
|
953
|
+
end
|
954
|
+
|
955
|
+
# Updates a reminder for a message.
|
956
|
+
# @param message_id [String] The ID of the message with the reminder
|
957
|
+
# @param user_id [String] The ID of the user who owns the reminder
|
958
|
+
# @param remind_at [DateTime, nil] When to remind the user (optional)
|
959
|
+
# @return [StreamChat::StreamResponse] API response
|
960
|
+
sig { params(message_id: String, user_id: String, remind_at: T.nilable(DateTime)).returns(StreamChat::StreamResponse) }
|
961
|
+
def update_reminder(message_id, user_id, remind_at = nil)
|
962
|
+
data = { user_id: user_id }
|
963
|
+
data[:remind_at] = remind_at.rfc3339 if remind_at
|
964
|
+
patch("messages/#{message_id}/reminders", data: data)
|
965
|
+
end
|
966
|
+
|
967
|
+
# Deletes a reminder for a message.
|
968
|
+
# @param message_id [String] The ID of the message with the reminder
|
969
|
+
# @param user_id [String] The ID of the user who owns the reminder
|
970
|
+
# @return [StreamChat::StreamResponse] API response
|
971
|
+
sig { params(message_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
972
|
+
def delete_reminder(message_id, user_id)
|
973
|
+
delete("messages/#{message_id}/reminders", params: { user_id: user_id })
|
974
|
+
end
|
975
|
+
|
976
|
+
# Queries reminders based on filter conditions.
|
977
|
+
# @param user_id [String] The ID of the user whose reminders to query
|
978
|
+
# @param filter_conditions [Hash] Conditions to filter reminders
|
979
|
+
# @param sort [Array<Hash>, nil] Sort parameters (default: [{ field: 'remind_at', direction: 1 }])
|
980
|
+
# @param options [Hash] Additional query options like limit, offset
|
981
|
+
# @return [StreamChat::StreamResponse] API response with reminders
|
982
|
+
sig { params(user_id: String, filter_conditions: T::Hash[T.untyped, T.untyped], sort: T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
983
|
+
def query_reminders(user_id, filter_conditions = {}, sort: nil, **options)
|
984
|
+
params = options.merge({
|
985
|
+
filter_conditions: filter_conditions,
|
986
|
+
sort: sort || [{ field: 'remind_at', direction: 1 }],
|
987
|
+
user_id: user_id
|
988
|
+
})
|
989
|
+
post('reminders/query', data: params)
|
990
|
+
end
|
991
|
+
|
942
992
|
private
|
943
993
|
|
944
994
|
sig { returns(T::Hash[String, String]) }
|
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: 3.
|
4
|
+
version: 3.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getstream.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- CONTRIBUTING.md
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE
|
110
|
+
- Makefile
|
110
111
|
- PULL_REQUEST_TEMPLATE.md
|
111
112
|
- README.md
|
112
113
|
- Rakefile
|