stream-chat-ruby 3.2.0 → 3.4.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 +19 -0
- data/CONTRIBUTING.md +17 -1
- data/Gemfile +4 -2
- data/README.md +39 -13
- data/SECURITY.md +16 -0
- data/lib/stream-chat/channel.rb +1 -1
- data/lib/stream-chat/client.rb +23 -23
- data/lib/stream-chat/version.rb +1 -1
- data/stream-chat.gemspec +0 -4
- metadata +4 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3120569255394b3306b2748c2883707f7c98bff14353f6b0dd8ff7b9bfdcc1d
|
4
|
+
data.tar.gz: 9a715e02897a4ab371a78f8fb31e9669023dd84ae01bd7d5c67a77fa698ccfeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10ff4a6917a0081a33eb92a55d05142f9b97dab0e297a171f4f52122bcd907fcd9a5999673b7b61cedf7fbcf861ee467bb226cf6b0cbe3bc626a3fc35d651f52
|
7
|
+
data.tar.gz: e2dd165c34ec9a570b8e5b8b9e4f36e1922c37909680b104441e9c7816602e96d06cf0376e1507b94d34dd5c10a82daebb4f2837e5e7a5f5a9f31321559d4d86
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
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.4.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.3.0...v3.4.0) (2023-07-19)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* commit message endpoint ([#129](https://github.com/GetStream/stream-chat-ruby/issues/129)) ([09eabb3](https://github.com/GetStream/stream-chat-ruby/commit/09eabb33f4bcfa6f8881dc545060bc5bdd51374e))
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* sorbet type for mark_read function signature ([#130](https://github.com/GetStream/stream-chat-ruby/issues/130)) ([7ea0f51](https://github.com/GetStream/stream-chat-ruby/commit/7ea0f517592c1819e223a65eedb53caa85a92817))
|
16
|
+
|
17
|
+
## [3.3.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.2.0...v3.3.0) (2022-11-17)
|
18
|
+
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* add campaign support ([#124](https://github.com/GetStream/stream-chat-ruby/issues/124)) ([d7a935f](https://github.com/GetStream/stream-chat-ruby/commit/d7a935f7b4459399b82db1d51a541388caeb5e68))
|
23
|
+
|
5
24
|
## [3.2.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.1.0...v3.2.0) (2022-11-17)
|
6
25
|
|
7
26
|
|
data/CONTRIBUTING.md
CHANGED
@@ -14,7 +14,23 @@ $ bundle install --path vendor/bundle
|
|
14
14
|
### Run tests
|
15
15
|
|
16
16
|
```shell
|
17
|
-
$ STREAM_KEY=my_api_key STREAM_SECRET=my_api_secret bundle exec
|
17
|
+
$ STREAM_KEY=my_api_key STREAM_SECRET=my_api_secret bundle exec rspec spec
|
18
|
+
```
|
19
|
+
|
20
|
+
### Run specific test
|
21
|
+
|
22
|
+
Add :focus tag on target test:
|
23
|
+
|
24
|
+
```rb
|
25
|
+
it 'can mark messages as read', :focus do
|
26
|
+
# test something
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
And then run as following:
|
31
|
+
|
32
|
+
```shell
|
33
|
+
$ STREAM_KEY=myapi_key STREAM_SECRET=my_secret STREAM_CHAT_URL=http://127.0.0.1:3030 bundle exec rspec spec --tag focus
|
18
34
|
```
|
19
35
|
|
20
36
|
### Linters and type check
|
data/Gemfile
CHANGED
@@ -8,13 +8,15 @@ group :dev do
|
|
8
8
|
gem 'method_source', '~> 1.0'
|
9
9
|
gem 'pry', '~> 0.14'
|
10
10
|
gem 'pry-doc', '~> 1.3'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'rspec', '~> 3.12'
|
11
13
|
gem 'rubocop', '~> 1.38', require: false
|
12
14
|
gem 'rubocop-ast', '~> 1.23', require: false
|
15
|
+
gem 'simplecov', '~> 0.21.2'
|
16
|
+
gem 'simplecov-console', '~> 0.9.1'
|
13
17
|
gem 'sorbet', '~> 0.5.10539'
|
14
18
|
end
|
15
19
|
|
16
20
|
group :test do
|
17
21
|
gem 'rack', '~> 2.2.4'
|
18
|
-
gem 'simplecov', '~> 0.21.2'
|
19
|
-
gem 'simplecov-console', '~> 0.9.1'
|
20
22
|
end
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ client = StreamChat::Client.new('STREAM_KEY', 'STREAM_SECRET')
|
|
57
57
|
> # Wrong:
|
58
58
|
> user = { "user" => { "id" => "bob-1"}}
|
59
59
|
> # Correct:
|
60
|
-
> user = { :
|
60
|
+
> user = { user: { id: "bob-1" }}
|
61
61
|
> ```
|
62
62
|
|
63
63
|
### Generate a token for client-side usage:
|
@@ -70,14 +70,14 @@ client.create_token('bob-1')
|
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
client.upsert_user({
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
73
|
+
id: 'bob-1',
|
74
|
+
role: 'admin',
|
75
|
+
name: 'Robert Tables'
|
76
76
|
})
|
77
77
|
|
78
78
|
# Batch update is also supported
|
79
|
-
jane = {:
|
80
|
-
june = {:
|
79
|
+
jane = {id: 'jane-1'}
|
80
|
+
june = {id: 'june-1'}
|
81
81
|
client.upsert_users([jane, june])
|
82
82
|
```
|
83
83
|
|
@@ -85,10 +85,10 @@ client.upsert_users([jane, june])
|
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
client.create_channel_type({
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
88
|
+
name: 'livechat',
|
89
|
+
automod: 'disabled',
|
90
|
+
commands: ['ban'],
|
91
|
+
mutes: true
|
92
92
|
})
|
93
93
|
|
94
94
|
channel_types = client.list_channel_types()
|
@@ -109,7 +109,7 @@ chan.add_members(['bob-1', 'jane-77'])
|
|
109
109
|
|
110
110
|
### Reactions
|
111
111
|
```ruby
|
112
|
-
chan.send_reaction(m1['id'], {:
|
112
|
+
chan.send_reaction(m1['id'], {type: 'like'}, 'bob-1')
|
113
113
|
```
|
114
114
|
|
115
115
|
### Moderation
|
@@ -125,7 +125,7 @@ chan.unban_user('bob-1')
|
|
125
125
|
### Messages
|
126
126
|
|
127
127
|
```ruby
|
128
|
-
m1 = chan.send_message({:
|
128
|
+
m1 = chan.send_message({text: 'Hi Jane!'}, 'bob-1')
|
129
129
|
|
130
130
|
deleted_message = client.delete_message(m1['message']['id'])
|
131
131
|
|
@@ -158,13 +158,39 @@ client.delete_blocklist('my_blocker')
|
|
158
158
|
|
159
159
|
```ruby
|
160
160
|
# Register an export
|
161
|
-
response = client.export_channels({:
|
161
|
+
response = client.export_channels({type: 'messaging', id: 'jane'})
|
162
162
|
|
163
163
|
# Check completion
|
164
164
|
status_response = client.get_export_channel_status(response['task_id'])
|
165
165
|
# status_response['status'] == 'pending', 'completed'
|
166
166
|
```
|
167
167
|
|
168
|
+
### Campaigns
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
# Create a user or channel segment
|
172
|
+
client.create_segment({ name: 'test', type: 'user', filter: { uniq: 'a flag on users' } })
|
173
|
+
|
174
|
+
# Create a campaign that uses the segment
|
175
|
+
client.create_campaign({
|
176
|
+
name: 'test',
|
177
|
+
text: 'Hi',
|
178
|
+
sender_id: campaign_sender,
|
179
|
+
segment_id: segment_id,
|
180
|
+
channel_type: 'messaging'
|
181
|
+
})
|
182
|
+
|
183
|
+
# Schedule the campaign
|
184
|
+
client.schedule_campaign(campaign_id, Time.now.to_i)
|
185
|
+
|
186
|
+
# Query the campaign to check the status
|
187
|
+
response = client.query_campaigns(filter_conditions: { id: campaign_id })
|
188
|
+
response['campaigns'][0]['status'] == 'completed'
|
189
|
+
|
190
|
+
# Read sent information
|
191
|
+
client.query_recipients(filter_conditions: { campaign_id: campaign_id })
|
192
|
+
```
|
193
|
+
|
168
194
|
### Rate limits
|
169
195
|
|
170
196
|
```ruby
|
data/SECURITY.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Reporting a Vulnerability
|
2
|
+
At Stream we are committed to the security of our Software. We appreciate your efforts in disclosing vulnerabilities responsibly and we will make every effort to acknowledge your contributions.
|
3
|
+
|
4
|
+
Report security vulnerabilities at the following email address:
|
5
|
+
```
|
6
|
+
[security@getstream.io](mailto:security@getstream.io)
|
7
|
+
```
|
8
|
+
Alternatively it is also possible to open a new issue in the affected repository, tagging it with the `security` tag.
|
9
|
+
|
10
|
+
A team member will acknowledge the vulnerability and will follow-up with more detailed information. A representative of the security team will be in touch if more information is needed.
|
11
|
+
|
12
|
+
# Information to include in a report
|
13
|
+
While we appreciate any information that you are willing to provide, please make sure to include the following:
|
14
|
+
* Which repository is affected
|
15
|
+
* Which branch, if relevant
|
16
|
+
* Be as descriptive as possible, the team will replicate the vulnerability before working on a fix.
|
data/lib/stream-chat/channel.rb
CHANGED
@@ -219,7 +219,7 @@ module StreamChat
|
|
219
219
|
end
|
220
220
|
|
221
221
|
# Sends the mark read event for this user, only works if the `read_events` setting is enabled.
|
222
|
-
sig { params(user_id: String, options:
|
222
|
+
sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
223
223
|
def mark_read(user_id, **options)
|
224
224
|
payload = add_user_id(options, user_id)
|
225
225
|
@client.post("#{url}/read", data: payload)
|
data/lib/stream-chat/client.rb
CHANGED
@@ -361,6 +361,12 @@ module StreamChat
|
|
361
361
|
update_message_partial(message_id, updates, user_id: user_id)
|
362
362
|
end
|
363
363
|
|
364
|
+
# commits a message.
|
365
|
+
sig { params(message_id: String).returns(StreamChat::StreamResponse) }
|
366
|
+
def commit_message(message_id)
|
367
|
+
post("messages/#{message_id}/commit")
|
368
|
+
end
|
369
|
+
|
364
370
|
# Updates a message. Fully overwrites a message.
|
365
371
|
# For partial update, use `update_message_partial` method.
|
366
372
|
sig { params(message: StringKeyHash).returns(StreamChat::StreamResponse) }
|
@@ -869,16 +875,10 @@ module StreamChat
|
|
869
875
|
post('campaigns', data: { campaign: campaign })
|
870
876
|
end
|
871
877
|
|
872
|
-
#
|
873
|
-
sig { params(
|
874
|
-
def
|
875
|
-
get(
|
876
|
-
end
|
877
|
-
|
878
|
-
# Lists all campaigns. Options dictionary can contain 'offset' and 'limit' keys for pagination.
|
879
|
-
sig { params(options: StringKeyHash).returns(StreamChat::StreamResponse) }
|
880
|
-
def list_campaigns(options)
|
881
|
-
get('campaigns', params: options)
|
878
|
+
# Queries campaigns similar to query_channels or query_users.
|
879
|
+
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
880
|
+
def query_campaigns(**params)
|
881
|
+
get('campaigns', params: { payload: params.to_json })
|
882
882
|
end
|
883
883
|
|
884
884
|
# Updates a campaign.
|
@@ -894,9 +894,9 @@ module StreamChat
|
|
894
894
|
end
|
895
895
|
|
896
896
|
# Schedules a campaign.
|
897
|
-
sig { params(campaign_id: String,
|
898
|
-
def schedule_campaign(campaign_id,
|
899
|
-
patch("campaigns/#{campaign_id}/schedule", data: {
|
897
|
+
sig { params(campaign_id: String, scheduled_for: Integer).returns(StreamChat::StreamResponse) }
|
898
|
+
def schedule_campaign(campaign_id, scheduled_for)
|
899
|
+
patch("campaigns/#{campaign_id}/schedule", data: { scheduled_for: scheduled_for })
|
900
900
|
end
|
901
901
|
|
902
902
|
# Stops a campaign.
|
@@ -923,16 +923,10 @@ module StreamChat
|
|
923
923
|
post('segments', data: { segment: segment })
|
924
924
|
end
|
925
925
|
|
926
|
-
#
|
927
|
-
sig { params(
|
928
|
-
def
|
929
|
-
get(
|
930
|
-
end
|
931
|
-
|
932
|
-
# Lists all campaign segments. Options dictionary can contain 'offset' and 'limit' keys for pagination.
|
933
|
-
sig { params(options: StringKeyHash).returns(StreamChat::StreamResponse) }
|
934
|
-
def list_segments(options)
|
935
|
-
get('segments', params: options)
|
926
|
+
# Queries campaign segments.
|
927
|
+
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
928
|
+
def query_segments(**params)
|
929
|
+
get('segments', params: { payload: params.to_json })
|
936
930
|
end
|
937
931
|
|
938
932
|
# Updates a campaign segment.
|
@@ -947,6 +941,12 @@ module StreamChat
|
|
947
941
|
delete("segments/#{segment_id}")
|
948
942
|
end
|
949
943
|
|
944
|
+
# Queries campaign recipients.
|
945
|
+
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
946
|
+
def query_recipients(**params)
|
947
|
+
get('recipients', params: { payload: params.to_json })
|
948
|
+
end
|
949
|
+
|
950
950
|
private
|
951
951
|
|
952
952
|
sig { returns(T::Hash[String, String]) }
|
data/lib/stream-chat/version.rb
CHANGED
data/stream-chat.gemspec
CHANGED
@@ -32,8 +32,4 @@ Gem::Specification.new do |gem|
|
|
32
32
|
gem.add_dependency 'jwt', '~> 2.3'
|
33
33
|
gem.add_dependency 'net-http-persistent', '~> 4.0'
|
34
34
|
gem.add_dependency 'sorbet-runtime', '~> 0.5.10539'
|
35
|
-
gem.add_development_dependency 'rake', '~> 13.0'
|
36
|
-
gem.add_development_dependency 'rspec', '~> 3.12'
|
37
|
-
gem.add_development_dependency 'simplecov', '~> 0.21.2'
|
38
|
-
gem.add_development_dependency 'simplecov-console', '~> 0.9.1'
|
39
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: 3.
|
4
|
+
version: 3.4.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:
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -94,62 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.5.10539
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rake
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '13.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '13.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.12'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.12'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 0.21.2
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 0.21.2
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: simplecov-console
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.9.1
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.9.1
|
153
97
|
description: Ruby client for Stream Chat.
|
154
98
|
email: support@getstream.io
|
155
99
|
executables: []
|
@@ -166,6 +110,7 @@ files:
|
|
166
110
|
- PULL_REQUEST_TEMPLATE.md
|
167
111
|
- README.md
|
168
112
|
- Rakefile
|
113
|
+
- SECURITY.md
|
169
114
|
- lib/stream-chat.rb
|
170
115
|
- lib/stream-chat/channel.rb
|
171
116
|
- lib/stream-chat/client.rb
|
@@ -200,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
145
|
- !ruby/object:Gem::Version
|
201
146
|
version: '0'
|
202
147
|
requirements: []
|
203
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.3.5
|
204
149
|
signing_key:
|
205
150
|
specification_version: 4
|
206
151
|
summary: The low level client for serverside calls for Stream Chat.
|