getstream-ruby 13.0.0 → 13.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 879877285f5786c16df7ee41c1b6679d24419d50a2378d27b5a0f8e4e8504df8
4
- data.tar.gz: 061bb101ac8283d7923b0d63447ec76e0d26419cb9a33d67b46cf09983faead7
3
+ metadata.gz: c527b48d9d6723fabe2aa05cf56c611a0dd0155a4a0c88cf26dc8f089c609617
4
+ data.tar.gz: 66dc5b45e716a2222873658c3f31db9858af9db575ca5659a104ca235c829756
5
5
  SHA512:
6
- metadata.gz: ff77fbdff1e097ff18d263db6d9ffefbaaca8978d570366e6f86f14dad89fbd0fcf4646d73ae04cb784ba3babbd57548e4b71046d59088101887d0a9c042fa11
7
- data.tar.gz: 1f88a3dd091de8620f23b3dd5ce0e8132f8317037cf77abf6c5ff6272c38af0db73342fe7b5835f4c5478513a76f3ae9135e0487fd3bd8a9e4d972af9e8df335
6
+ metadata.gz: 409ce155c646c76cde5d67a831dcf6a83612e85753585fc7554861e631f82f29553e2a16fba58885b83d008e207f57827b99b8330006dce17df93b270e3e69e0
7
+ data.tar.gz: b95dc22f1cebfa3a567510708b8640118cf348cfd8eec75a365febf7bd2c574a63f694f1a0d17eff8dac5c91d7187d39a2ca4063fb14a3dfeb78f3155c564999
data/README.md CHANGED
@@ -22,6 +22,10 @@ Or install it yourself as:
22
22
  $ gem install getstream-ruby
23
23
  ```
24
24
 
25
+ ## Upgrading from v12?
26
+
27
+ See [v12 → v13](MIGRATION_v12_to_v13.md). HTTP JSON is unchanged. `stop_campaign`, `commit_message`, and `get_activity` changed arguments. Named enum fields are still strings.
28
+
25
29
  ## Migrating from stream-chat-ruby?
26
30
 
27
31
  If you are currently using [`stream-chat-ruby`](https://github.com/GetStream/stream-chat-ruby), we have a detailed migration guide with side-by-side code examples for common Chat use cases. See the [Migration Guide](docs/migration-from-stream-chat-ruby/README.md).
@@ -15,6 +15,7 @@ require_relative 'generated/moderation_client'
15
15
  require_relative 'generated/chat_client'
16
16
  require_relative 'generated/video_client'
17
17
  require_relative 'extensions/moderation_extensions'
18
+ require_relative 'extensions/chat_extensions'
18
19
  require_relative 'generated/feed'
19
20
  require_relative 'generated/webhook'
20
21
  require_relative 'generated/models/api_error'
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GetStream
4
+
5
+ module Generated
6
+
7
+ class ChatClient
8
+
9
+ # The generated name of the fork message map method changes from fork_message_i_ds to
10
+ # fork_message_ids in a later regeneration. Keep both names working on either side of it.
11
+ if method_defined?(:fork_message_i_ds) && !method_defined?(:fork_message_ids)
12
+ alias fork_message_ids fork_message_i_ds
13
+ elsif method_defined?(:fork_message_ids) && !method_defined?(:fork_message_i_ds)
14
+ # @deprecated Use {#fork_message_ids} instead.
15
+ alias fork_message_i_ds fork_message_ids
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -3,6 +3,7 @@
3
3
  require 'base64'
4
4
  require 'json'
5
5
  require 'openssl'
6
+ require 'stringio'
6
7
  require 'time'
7
8
  require 'zlib'
8
9
  require_relative 'models/activity_added_event'
@@ -234,6 +235,14 @@ module StreamChat
234
235
  GZIP_MAGIC = "\x1F\x8B".b.freeze
235
236
  private_constant :GZIP_MAGIC
236
237
 
238
+ class << self
239
+ # Caps the decompressed size of a gzip webhook body. gunzip_payload runs
240
+ # before the signature check, so without a cap an unsigned gzip bomb could
241
+ # exhaust memory. Raise it if your events are larger.
242
+ attr_accessor :max_payload_bytes
243
+ end
244
+ self.max_payload_bytes = 10 * 1024 * 1024
245
+
237
246
  # Webhook event type constants
238
247
  EVENT_TYPE_WILDCARD = '*'
239
248
  EVENT_TYPE_APPEAL_ACCEPTED = 'appeal.accepted'
@@ -887,14 +896,19 @@ module StreamChat
887
896
  # @param body [String] raw body (binary-safe)
888
897
  # @return [String] decompressed body, or the original body if not gzip-prefixed
889
898
  # @raise [InvalidWebhookError] if body has the gzip magic prefix but
890
- # isn't a valid gzip stream
899
+ # isn't a valid gzip stream, or decompresses to more than
900
+ # {max_payload_bytes}
891
901
  def self.gunzip_payload(body)
892
902
  raise InvalidWebhookError, "#{InvalidWebhookError::INVALID_JSON}: body must be a String" unless body.is_a?(String)
893
903
 
894
904
  bytes = body.b
895
905
  return bytes if bytes.bytesize < 2 || bytes.byteslice(0, 2) != GZIP_MAGIC
896
906
 
897
- Zlib.gunzip(bytes)
907
+ limit = max_payload_bytes
908
+ out = Zlib::GzipReader.wrap(StringIO.new(bytes)) { |gz| gz.read(limit + 1) } || ''.b
909
+ raise InvalidWebhookError, "#{InvalidWebhookError::GZIP_FAILED}: payload exceeds #{limit} bytes" if out.bytesize > limit
910
+
911
+ out
898
912
  rescue Zlib::Error => e
899
913
  raise InvalidWebhookError, "#{InvalidWebhookError::GZIP_FAILED}: #{e.message}"
900
914
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GetStreamRuby
4
4
 
5
- VERSION = '13.0.0'
5
+ VERSION = '13.1.0'
6
6
 
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getstream-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.0
4
+ version: 13.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-02 00:00:00.000000000 Z
11
+ date: 2026-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -135,6 +135,7 @@ files:
135
135
  - lib/getstream_ruby/configuration.rb
136
136
  - lib/getstream_ruby/error_mapping.rb
137
137
  - lib/getstream_ruby/errors.rb
138
+ - lib/getstream_ruby/extensions/chat_extensions.rb
138
139
  - lib/getstream_ruby/extensions/moderation_extensions.rb
139
140
  - lib/getstream_ruby/generated/base_model.rb
140
141
  - lib/getstream_ruby/generated/chat_client.rb