stream-chat-ruby 2.11.3 → 2.15.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 +33 -0
- data/lib/stream-chat/channel.rb +2 -2
- data/lib/stream-chat/client.rb +51 -2
- data/lib/stream-chat/version.rb +1 -1
- data/stream-chat.gemspec +1 -0
- metadata +5 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: '0188b515566df9e25d6e029ed012f7a2336dbedb4c21813290e665d3f2c5c614'
         | 
| 4 | 
            +
              data.tar.gz: efb67ea25cd0bd37a96da63767903143b1615ad4d9836d665c51aa378bf67437
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 16b6f96446839731c186b90aa14d267dfb0256ced2c836fef04f83376dffc894f1fcb799644383999e6bf5221c79cf527068a1e0cd117460054b64684679af05
         | 
| 7 | 
            +
              data.tar.gz: 6fdd966d7323e50ec7ab699a380402536e5b9930864341b17d4c077fe4eae5e070527aa7a42bd0414cb97e37118fbbe5f06200c05be6452074d8f4b27da7e6ec
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,36 @@ | |
| 1 | 
            +
            ## November 25th, 2021 - 2.15.0
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            - Add configuration support for channel truncate
         | 
| 4 | 
            +
              - truncated_at: to truncate channel up to given time
         | 
| 5 | 
            +
              - message: a system message to be added via truncation
         | 
| 6 | 
            +
              - skip_push: don't send a push notification for system message
         | 
| 7 | 
            +
              - hard_delete: true if truncation should delete messages instead of hiding
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## November 24th, 2021 - 2.14.0
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Add new flags for export channels
         | 
| 12 | 
            +
              - clear_deleted_message_text (default: false)
         | 
| 13 | 
            +
              - include_truncated_messages (default: false)
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## November 17th, 2021 - 2.13.0
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            - Add support for shadow banning user
         | 
| 18 | 
            +
              - shadow_ban
         | 
| 19 | 
            +
              - remove_shadow_ban
         | 
| 20 | 
            +
            - Add support for pinning messages
         | 
| 21 | 
            +
              - pin_message
         | 
| 22 | 
            +
              - unpin_message
         | 
| 23 | 
            +
            - Add support for partial updating messages
         | 
| 24 | 
            +
              - update_message_partial
         | 
| 25 | 
            +
            - Add support for updating channel ownership for Deleted Users
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            ## November 1st, 2021 - 2.12.0
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            - Add support for async endpoints
         | 
| 30 | 
            +
              - get_task
         | 
| 31 | 
            +
              - delete_channels
         | 
| 32 | 
            +
              - delete_users
         | 
| 33 | 
            +
             | 
| 1 34 | 
             
            ## October 22nd, 2021 - 2.11.3
         | 
| 2 35 |  | 
| 3 36 | 
             
            - Don't log the entire response when creating exception
         | 
    
        data/lib/stream-chat/channel.rb
    CHANGED
    
    
    
        data/lib/stream-chat/client.rb
    CHANGED
    
    | @@ -12,6 +12,8 @@ require 'stream-chat/util' | |
| 12 12 |  | 
| 13 13 | 
             
            module StreamChat
         | 
| 14 14 | 
             
              DEFAULT_BLOCKLIST = 'profanity_en_2020_v1'
         | 
| 15 | 
            +
              SOFT_DELETE = 'soft'
         | 
| 16 | 
            +
              HARD_DELETE = 'hard'
         | 
| 15 17 |  | 
| 16 18 | 
             
              class Client
         | 
| 17 19 | 
             
                BASE_URL = 'https://chat.stream-io-api.com'
         | 
| @@ -158,6 +160,16 @@ module StreamChat | |
| 158 160 | 
             
                  delete('moderation/ban', params: params)
         | 
| 159 161 | 
             
                end
         | 
| 160 162 |  | 
| 163 | 
            +
                def shadow_ban(target_id, **options)
         | 
| 164 | 
            +
                  payload = { target_user_id: target_id, shadow: true }.merge(options)
         | 
| 165 | 
            +
                  post('moderation/ban', data: payload)
         | 
| 166 | 
            +
                end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                def remove_shadow_ban(target_id, **options)
         | 
| 169 | 
            +
                  params = { target_user_id: target_id, shadow: true }.merge(options)
         | 
| 170 | 
            +
                  delete('moderation/ban', params: params)
         | 
| 171 | 
            +
                end
         | 
| 172 | 
            +
             | 
| 161 173 | 
             
                def mute_user(target_id, user_id)
         | 
| 162 174 | 
             
                  payload = { target_id: target_id, user_id: user_id }
         | 
| 163 175 | 
             
                  post('moderation/mute', data: payload)
         | 
| @@ -173,12 +185,37 @@ module StreamChat | |
| 173 185 | 
             
                  post('channels/read', data: payload)
         | 
| 174 186 | 
             
                end
         | 
| 175 187 |  | 
| 188 | 
            +
                def pin_message(message_id, user_id, expiration: nil)
         | 
| 189 | 
            +
                  updates = {
         | 
| 190 | 
            +
                    set: {
         | 
| 191 | 
            +
                      pinned: true,
         | 
| 192 | 
            +
                      pin_expires: expiration
         | 
| 193 | 
            +
                    }
         | 
| 194 | 
            +
                  }
         | 
| 195 | 
            +
                  update_message_partial(message_id, updates, user_id: user_id)
         | 
| 196 | 
            +
                end
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                def unpin_message(message_id, user_id)
         | 
| 199 | 
            +
                  updates = {
         | 
| 200 | 
            +
                    set: {
         | 
| 201 | 
            +
                      pinned: false
         | 
| 202 | 
            +
                    }
         | 
| 203 | 
            +
                  }
         | 
| 204 | 
            +
                  update_message_partial(message_id, updates, user_id: user_id)
         | 
| 205 | 
            +
                end
         | 
| 206 | 
            +
             | 
| 176 207 | 
             
                def update_message(message)
         | 
| 177 208 | 
             
                  raise ArgumentError 'message must have an id' unless message.key? 'id'
         | 
| 178 209 |  | 
| 179 210 | 
             
                  post("messages/#{message['id']}", data: { message: message })
         | 
| 180 211 | 
             
                end
         | 
| 181 212 |  | 
| 213 | 
            +
                def update_message_partial(message_id, updates, user_id: nil, **options)
         | 
| 214 | 
            +
                  params = updates.merge(options)
         | 
| 215 | 
            +
                  params['user'] = { id: user_id } if user_id
         | 
| 216 | 
            +
                  put("messages/#{message_id}", data: params)
         | 
| 217 | 
            +
                end
         | 
| 218 | 
            +
             | 
| 182 219 | 
             
                def delete_message(message_id)
         | 
| 183 220 | 
             
                  delete("messages/#{message_id}")
         | 
| 184 221 | 
             
                end
         | 
| @@ -285,14 +322,26 @@ module StreamChat | |
| 285 322 | 
             
                  delete("blocklists/#{name}")
         | 
| 286 323 | 
             
                end
         | 
| 287 324 |  | 
| 288 | 
            -
                def export_channels(*channels)
         | 
| 289 | 
            -
                  post('export_channels', data: { channels: channels })
         | 
| 325 | 
            +
                def export_channels(*channels, **options)
         | 
| 326 | 
            +
                  post('export_channels', data: { channels: channels, **options })
         | 
| 290 327 | 
             
                end
         | 
| 291 328 |  | 
| 292 329 | 
             
                def get_export_channel_status(task_id)
         | 
| 293 330 | 
             
                  get("export_channels/#{task_id}")
         | 
| 294 331 | 
             
                end
         | 
| 295 332 |  | 
| 333 | 
            +
                def get_task(task_id)
         | 
| 334 | 
            +
                  get("tasks/#{task_id}")
         | 
| 335 | 
            +
                end
         | 
| 336 | 
            +
             | 
| 337 | 
            +
                def delete_users(user_ids, user: SOFT_DELETE, messages: nil, conversations: nil)
         | 
| 338 | 
            +
                  post('users/delete', data: { user_ids: user_ids, user: user, messages: messages, conversations: conversations })
         | 
| 339 | 
            +
                end
         | 
| 340 | 
            +
             | 
| 341 | 
            +
                def delete_channels(cids, hard_delete: false)
         | 
| 342 | 
            +
                  post('channels/delete', data: { cids: cids, hard_delete: hard_delete })
         | 
| 343 | 
            +
                end
         | 
| 344 | 
            +
             | 
| 296 345 | 
             
                def revoke_tokens(before)
         | 
| 297 346 | 
             
                  before = before.rfc3339 if before.instance_of?(DateTime)
         | 
| 298 347 | 
             
                  update_app_settings({ 'revoke_tokens_issued_before' => before })
         | 
    
        data/lib/stream-chat/version.rb
    CHANGED
    
    
    
        data/stream-chat.gemspec
    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: 2. | 
| 4 | 
            +
              version: 2.15.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mircea Cosbuc
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021- | 
| 11 | 
            +
            date: 2021-11-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         | 
| @@ -105,7 +105,8 @@ files: | |
| 105 105 | 
             
            - stream-chat.gemspec
         | 
| 106 106 | 
             
            homepage: http://github.com/GetStream/stream-chat-ruby
         | 
| 107 107 | 
             
            licenses: []
         | 
| 108 | 
            -
            metadata: | 
| 108 | 
            +
            metadata:
         | 
| 109 | 
            +
              rubygems_mfa_required: 'true'
         | 
| 109 110 | 
             
            post_install_message: 
         | 
| 110 111 | 
             
            rdoc_options: []
         | 
| 111 112 | 
             
            require_paths:
         | 
| @@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 121 122 | 
             
                - !ruby/object:Gem::Version
         | 
| 122 123 | 
             
                  version: '0'
         | 
| 123 124 | 
             
            requirements: []
         | 
| 124 | 
            -
            rubygems_version: 3. | 
| 125 | 
            +
            rubygems_version: 3.1.2
         | 
| 125 126 | 
             
            signing_key: 
         | 
| 126 127 | 
             
            specification_version: 4
         | 
| 127 128 | 
             
            summary: The low level client for serverside calls for Stream Chat.
         |