[CHA-2585] add migration guide from stream-chat-ruby#37
[CHA-2585] add migration guide from stream-chat-ruby#37
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive migration guide for users transitioning from the stream-chat-ruby SDK to the new getstream-ruby SDK. The guide is organized into a main README with an overview and six topic-specific sub-guides covering setup/auth, users, channels, messages/reactions, moderation, and devices. A link to the migration guide is also added to the main project README.
Changes:
- Added a main migration guide README (
docs/migration-from-stream-chat-ruby/README.md) with a high-level comparison table and a quick before/after example - Added six topic-specific migration guides (01 through 06) with side-by-side code examples for every common operation
- Updated the project
README.mdto link to the new migration guide
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Added a "Migrating from stream-chat-ruby?" section with a link to the migration guide |
| docs/migration-from-stream-chat-ruby/README.md | Main migration overview with key differences table, quick example, and links to sub-guides |
| docs/migration-from-stream-chat-ruby/01-setup-and-auth.md | Setup, client instantiation, env vars, and token generation migration guide |
| docs/migration-from-stream-chat-ruby/02-users.md | User operations migration guide (upsert, query, partial update, deactivate, delete) |
| docs/migration-from-stream-chat-ruby/03-channels.md | Channel operations migration guide (create, query, members, update, delete) |
| docs/migration-from-stream-chat-ruby/04-messages-and-reactions.md | Messages and reactions migration guide (send, get, update, delete, reactions) |
| docs/migration-from-stream-chat-ruby/05-moderation.md | Moderation operations migration guide (ban, unban, mute, shadow ban, moderators) |
| docs/migration-from-stream-chat-ruby/06-devices.md | Device management migration guide (add, list, delete devices) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
|
|
||
| response = client.chat.delete_reaction(message_id, 'like', user_id: 'bob-1') |
There was a problem hiding this comment.
The delete_reaction method in the actual SDK uses a positional parameter for user_id, not a keyword argument. The method signature is def delete_reaction(_id, _type, user_id = nil) (see lib/getstream_ruby/generated/chat_client.rb:1045). Using user_id: 'bob-1' (keyword syntax) would pass a hash as the third positional argument. The example should use client.chat.delete_reaction(message_id, 'like', 'bob-1') instead.
| | Hard delete | `client.hard_delete_message(id)` | `client.chat.delete_message(id, hard: true)` | | ||
| | Send reaction | `chan.send_reaction(msg_id, hash, uid)` | `client.chat.send_reaction(msg_id, SendReactionRequest)` | | ||
| | Get reactions | `chan.get_reactions(msg_id)` | `client.chat.get_reactions(msg_id)` | | ||
| | Delete reaction | `chan.delete_reaction(msg_id, type, uid)` | `client.chat.delete_reaction(msg_id, type, user_id:)` | |
There was a problem hiding this comment.
The summary table entries for "Hard delete" and "Delete reaction" use keyword argument syntax (hard: true, user_id:) but the actual SDK methods use positional parameters. delete_message is def delete_message(_id, hard = nil, ...) and delete_reaction is def delete_reaction(_id, _type, user_id = nil). These should show positional arguments instead.
| response = client.common.list_devices(user_id: 'jane-1') | ||
| devices = response['devices'] |
There was a problem hiding this comment.
The list_devices method in the actual SDK uses a positional parameter, not a keyword argument. The method signature is def list_devices(user_id = nil) (see lib/getstream_ruby/generated/common_client.rb:217). Calling it with user_id: 'jane-1' (keyword syntax) on Ruby 3.3 would pass a hash {user_id: 'jane-1'} as the positional argument instead of the string 'jane-1', leading to incorrect behavior. The example should use client.common.list_devices('jane-1') instead.
|
|
||
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
|
|
||
| client.common.delete_device('apns-device-token', user_id: 'jane-1') |
There was a problem hiding this comment.
The delete_device method in the actual SDK uses positional parameters, not keyword arguments. The method signature is def delete_device(_id, user_id = nil) (see lib/getstream_ruby/generated/common_client.rb:198). Calling it with user_id: 'jane-1' (keyword syntax) on Ruby 3.3 would pass a hash as the positional argument instead of the string value. The example should use client.common.delete_device('apns-device-token', 'jane-1') instead.
|
|
||
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
|
|
||
| client.chat.delete_channel('messaging', 'general', hard_delete: false) |
There was a problem hiding this comment.
The delete_channel method in the actual SDK uses a positional parameter, not a keyword argument. The method signature is def delete_channel(_type, _id, hard_delete = nil) (see lib/getstream_ruby/generated/chat_client.rb:213). Using hard_delete: false (keyword syntax) on Ruby 3.3 would pass a hash {hard_delete: false} as the positional argument instead of the boolean value. The example should use client.chat.delete_channel('messaging', 'general', false) instead.
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
| token = client.create_token('bob-1') | ||
| ``` | ||
|
|
||
| **Key changes:** | ||
| - Method name is the same (`create_token`), only the client initialization differs | ||
|
|
||
| ### Token With Expiration | ||
|
|
||
| **Before (stream-chat-ruby):** | ||
|
|
||
| ```ruby | ||
| require 'stream-chat' | ||
|
|
||
| client = StreamChat::Client.new('STREAM_KEY', 'STREAM_SECRET') | ||
|
|
||
| # Expiration and issued-at are Unix timestamps | ||
| token = client.create_token( | ||
| 'bob-1', | ||
| exp: (Time.now + 3600).to_i, | ||
| iat: Time.now.to_i, | ||
| ) | ||
| ``` | ||
|
|
||
| **After (getstream-ruby):** | ||
|
|
||
| ```ruby | ||
| require 'getstream_ruby' | ||
|
|
||
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
|
|
||
| # Expiration is a duration in seconds (relative, not absolute) | ||
| token = client.create_token('bob-1', expiration: 3600) |
There was a problem hiding this comment.
The create_token method does not exist on the GetStreamRuby::Client class. I searched the entire lib/ directory and found no method definition matching create_token or any token-generation method. The migration guide shows client.create_token('bob-1') and client.create_token('bob-1', expiration: 3600) as valid new SDK calls, but these methods are not implemented. Either this section documents a method that hasn't been added yet, or the method name/location is different. Please verify and update these examples to match the actual SDK API.
| | Remove members | `chan.remove_members(user_ids)` | `client.chat.update_channel(type, id, UpdateChannelRequest(remove_members:))` | | ||
| | Full update | `chan.update(data)` | `client.chat.update_channel(type, id, UpdateChannelRequest)` | | ||
| | Partial update | `chan.update_partial(set:, unset:)` | `client.chat.update_channel_partial(type, id, UpdateChannelPartialRequest)` | | ||
| | Delete channel | `chan.delete` | `client.chat.delete_channel(type, id, hard_delete:)` | |
There was a problem hiding this comment.
The summary table entry for "Delete channel" shows hard_delete: as a keyword argument, but the actual method signature is def delete_channel(_type, _id, hard_delete = nil) with a positional parameter. This should be client.chat.delete_channel(type, id, hard_delete) without the colon.
| | Delete channel | `chan.delete` | `client.chat.delete_channel(type, id, hard_delete:)` | | |
| | Delete channel | `chan.delete` | `client.chat.delete_channel(type, id, hard_delete)` | |
| | List devices | `client.get_devices(uid)` | `client.common.list_devices(user_id:)` | | ||
| | Delete device | `client.remove_device(id, uid)` | `client.common.delete_device(id, user_id:)` | |
There was a problem hiding this comment.
Consistent with the issues in the code examples above, the summary table entries for "List devices" and "Delete device" show keyword argument syntax (user_id:) but the actual SDK methods use positional parameters. Should be client.common.list_devices(uid) and client.common.delete_device(id, uid) respectively.
| client.chat.delete_message(message_id) | ||
|
|
||
| # Hard delete | ||
| client.chat.delete_message(message_id, hard: true) |
There was a problem hiding this comment.
The delete_message method in the actual SDK uses a positional parameter, not a keyword argument. The method signature is def delete_message(_id, hard = nil, deleted_by = nil, delete_for_me = nil) (see lib/getstream_ruby/generated/chat_client.rb:880). Using hard: true (keyword syntax) on Ruby 3.3 would pass a hash {hard: true} as the positional argument instead of the boolean. The example should use client.chat.delete_message(message_id, true) instead.
| client.chat.delete_message(message_id, hard: true) | |
| client.chat.delete_message(message_id, true) |
|
|
||
| client = GetStreamRuby.manual(api_key: 'STREAM_KEY', api_secret: 'STREAM_SECRET') | ||
|
|
||
| response = client.chat.get_reactions(message_id, limit: 10, offset: 0) |
There was a problem hiding this comment.
The get_reactions method in the actual SDK uses positional parameters, not keyword arguments. The method signature is def get_reactions(_id, limit = nil, offset = nil) (see lib/getstream_ruby/generated/chat_client.rb:1068). Using limit: 10, offset: 0 (keyword syntax) would pass a hash as the second positional argument. The example should use client.chat.get_reactions(message_id, 10, 0) instead.
No description provided.