Giter Site home page Giter Site logo

Comments (10)

bogdan-getstream avatar bogdan-getstream commented on June 15, 2024 1

Using symbols as hash keys is preferred in ruby, as they are immutable and not trigger GC.
But on parsing request keys are currently strings, and it's not easy to fix it as it's breaking change for the SDK users.

from stream-chat-ruby.

ffenix113 avatar ffenix113 commented on June 15, 2024 1

@peterdeme can you please also check this issue out when you will have time? Should be a quick one. Thank you.

from stream-chat-ruby.

tbarbugli avatar tbarbugli commented on June 15, 2024

thanks for reporting this, in the meantime can you try client.update_user([user])?

from stream-chat-ruby.

the-bass avatar the-bass commented on June 15, 2024

You mean like

client.update_user([{
  'id' => 'bob-1',
  'role' => 'admin',
  'name' => 'Robert Tables'
}])

?

Gives me

irb(main):004:0> client.update_user([{
irb(main):005:3*   'id' => 'bob-1',
irb(main):006:3*   'role' => 'admin',
irb(main):007:3*   'name' => 'Robert Tables'
irb(main):008:3> }])
Traceback (most recent call last):
        6: from /usr/local/bin/irb:11:in `<main>'
        5: from (irb):4
        4: from /usr/local/bundle/gems/stream-chat-ruby-1.1.0/lib/stream-chat/client.rb:101:in `update_user'
        3: from /usr/local/bundle/gems/stream-chat-ruby-1.1.0/lib/stream-chat/client.rb:94:in `update_users'
        2: from /usr/local/bundle/gems/stream-chat-ruby-1.1.0/lib/stream-chat/client.rb:94:in `each'
        1: from /usr/local/bundle/gems/stream-chat-ruby-1.1.0/lib/stream-chat/client.rb:95:in `block in update_users'
TypeError (no implicit conversion of Symbol into Integer)

from stream-chat-ruby.

keyneston avatar keyneston commented on June 15, 2024

Just recreated this and the following works:

# update a single user
client.update_user({
  :id => 'bob-1',
  :role => 'admin',
  :name => 'Robert Tables'
})

# update multiple users
client.update_users([{
  :id => 'bob-1',
  :role => 'admin',
  :name => 'Robert Tables'
}])

Turns out the keys need to be symbols not strings. I'll update the specific example right away. I'm not sure which other examples have similar problems.

from stream-chat-ruby.

tbarbugli avatar tbarbugli commented on June 15, 2024

@bogdan-d any advice here?

from stream-chat-ruby.

keyneston avatar keyneston commented on June 15, 2024

Copying what I put in #12

I've fixed this specific issue, but there seems to be a lot of inconsistencies here.

Like this one which uses strings.

    def create_channel_type(data)
      if !data.key? "commands" || data["commands"].nil? || data["commands"].empty?
        data["commands"] = ["all"]
      end
      post("channeltypes", data: data)
    end

Easiest fix is to switch to using rails' HashWithIndifferentAccess see here. Although that requires a big import. If we want to avoid that path and just fix the code itself I can't say I'm experienced enough in ruby to know the best way (adding support for both, switching all to one way, or what).

from stream-chat-ruby.

keyneston avatar keyneston commented on June 15, 2024

@tbarbugli can you please unassign me :D it seems I don't have permissions.

from stream-chat-ruby.

ferhatelmas avatar ferhatelmas commented on June 15, 2024

@keyneston 👋🏻 replaced with me 😃

from stream-chat-ruby.

peterdeme avatar peterdeme commented on June 15, 2024

#104

from stream-chat-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.