stream-chat-ruby 3.15.0 → 3.17.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 +5 -1
- data/CONTRIBUTING.md +28 -1
- data/Makefile +50 -0
- data/README.md +23 -0
- data/lib/stream-chat/client.rb +59 -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: 1931489e635ef2e2a3f052c55bd01063d013571745721e37e6dfdee96d86ce84
|
4
|
+
data.tar.gz: 020ebe362659ec374a3d45db80815cffa696f00dfca0ff1b57d329496d5762ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ea03f3fe7831cd3f2424d937a75b27e98077e03aea57fd029105af3c5be15fc4c46bb7895a19960d8ba25c4dd9e5fef020ec670e5e4417d8b3a3c5889f147a
|
7
|
+
data.tar.gz: 1e7c7a0b52920e7b3cd6a36b20503f46d0f02cedca6cf34cfb6ab25f443bfbc42f621cafd8ad45381796fc4f3106f78d1f7dc61a08e41a6cf78a1612eea53ca7
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
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.17.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.16.0...v3.17.0) (2025-06-25)
|
6
|
+
|
7
|
+
## [3.16.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.15.0...v3.16.0) (2025-06-18)
|
8
|
+
|
5
9
|
## [3.15.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.14.0...v3.15.0) (2025-06-06)
|
6
10
|
|
7
11
|
## [3.14.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.13.0...v3.14.0) (2025-04-07)
|
@@ -350,4 +354,4 @@ before continuing with v3.0.0 of this library.
|
|
350
354
|
- Added `client.search`
|
351
355
|
- Added `client.update_users_partial`
|
352
356
|
- Added `client.update_user_partial`
|
353
|
-
- Added `client.reactivate_user`
|
357
|
+
- 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'
|
@@ -418,6 +419,13 @@ module StreamChat
|
|
418
419
|
delete("messages/#{message_id}", params: options)
|
419
420
|
end
|
420
421
|
|
422
|
+
# Un-deletes a message.
|
423
|
+
sig { params(message_id: String, undeleted_by: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
424
|
+
def undelete_message(message_id, undeleted_by, **options)
|
425
|
+
payload = { undeleted_by: undeleted_by }.merge(options)
|
426
|
+
post("messages/#{message_id}/undelete", data: payload)
|
427
|
+
end
|
428
|
+
|
421
429
|
# Queries banned users.
|
422
430
|
#
|
423
431
|
# Banned users can be retrieved in different ways:
|
@@ -688,7 +696,7 @@ module StreamChat
|
|
688
696
|
# Revoke tokens for an application issued since the given date.
|
689
697
|
sig { params(before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
690
698
|
def revoke_tokens(before)
|
691
|
-
before =
|
699
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
692
700
|
update_app_settings({ 'revoke_tokens_issued_before' => before })
|
693
701
|
end
|
694
702
|
|
@@ -701,7 +709,7 @@ module StreamChat
|
|
701
709
|
# Revoke tokens for users issued since.
|
702
710
|
sig { params(user_ids: T::Array[String], before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
703
711
|
def revoke_users_token(user_ids, before)
|
704
|
-
before =
|
712
|
+
before = before.rfc3339 if before.instance_of?(DateTime)
|
705
713
|
|
706
714
|
updates = []
|
707
715
|
user_ids.map do |user_id|
|
@@ -939,6 +947,55 @@ module StreamChat
|
|
939
947
|
post('threads', data: params)
|
940
948
|
end
|
941
949
|
|
950
|
+
# Creates a reminder for a message.
|
951
|
+
# @param message_id [String] The ID of the message to create a reminder for
|
952
|
+
# @param user_id [String] The ID of the user creating the reminder
|
953
|
+
# @param remind_at [DateTime, nil] When to remind the user (optional)
|
954
|
+
# @return [StreamChat::StreamResponse] API response
|
955
|
+
sig { params(message_id: String, user_id: String, remind_at: T.nilable(DateTime)).returns(StreamChat::StreamResponse) }
|
956
|
+
def create_reminder(message_id, user_id, remind_at = nil)
|
957
|
+
data = { user_id: user_id }
|
958
|
+
data[:remind_at] = remind_at.rfc3339 if remind_at.instance_of?(DateTime)
|
959
|
+
post("messages/#{message_id}/reminders", data: data)
|
960
|
+
end
|
961
|
+
|
962
|
+
# Updates a reminder for a message.
|
963
|
+
# @param message_id [String] The ID of the message with the reminder
|
964
|
+
# @param user_id [String] The ID of the user who owns the reminder
|
965
|
+
# @param remind_at [DateTime, nil] When to remind the user (optional)
|
966
|
+
# @return [StreamChat::StreamResponse] API response
|
967
|
+
sig { params(message_id: String, user_id: String, remind_at: T.nilable(DateTime)).returns(StreamChat::StreamResponse) }
|
968
|
+
def update_reminder(message_id, user_id, remind_at = nil)
|
969
|
+
data = { user_id: user_id }
|
970
|
+
data[:remind_at] = remind_at.rfc3339 if remind_at
|
971
|
+
patch("messages/#{message_id}/reminders", data: data)
|
972
|
+
end
|
973
|
+
|
974
|
+
# Deletes a reminder for a message.
|
975
|
+
# @param message_id [String] The ID of the message with the reminder
|
976
|
+
# @param user_id [String] The ID of the user who owns the reminder
|
977
|
+
# @return [StreamChat::StreamResponse] API response
|
978
|
+
sig { params(message_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
979
|
+
def delete_reminder(message_id, user_id)
|
980
|
+
delete("messages/#{message_id}/reminders", params: { user_id: user_id })
|
981
|
+
end
|
982
|
+
|
983
|
+
# Queries reminders based on filter conditions.
|
984
|
+
# @param user_id [String] The ID of the user whose reminders to query
|
985
|
+
# @param filter_conditions [Hash] Conditions to filter reminders
|
986
|
+
# @param sort [Array<Hash>, nil] Sort parameters (default: [{ field: 'remind_at', direction: 1 }])
|
987
|
+
# @param options [Hash] Additional query options like limit, offset
|
988
|
+
# @return [StreamChat::StreamResponse] API response with reminders
|
989
|
+
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) }
|
990
|
+
def query_reminders(user_id, filter_conditions = {}, sort: nil, **options)
|
991
|
+
params = options.merge({
|
992
|
+
filter_conditions: filter_conditions,
|
993
|
+
sort: sort || [{ field: 'remind_at', direction: 1 }],
|
994
|
+
user_id: user_id
|
995
|
+
})
|
996
|
+
post('reminders/query', data: params)
|
997
|
+
end
|
998
|
+
|
942
999
|
private
|
943
1000
|
|
944
1001
|
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.17.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-25 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
|