All the examples in the Ruby SDK use an older way ...
# support
t
All the examples in the Ruby SDK use an older way to prefix with a colon on prop names/symbols. However, AFAIK, in Ruby 1.9, a new syntax was introduced for hash keys using a colon after the key. So instead of an example like this:
Copy code
:userId => '1hKOmRA4GRlm',
:traits => {
  :email => "alex@example.com", 
  :createdAt => "2023-07-24T00:00:00Z",
  :subscribe => true,
},
:context => {:ip => '10.81.20.10'},
it should be possible instead to define like this:
Copy code
userId: '1hKOmRA4GRlm',
traits: {
  email: "alex@example.com", 
  createdAt: "2023-07-24T00:00:00Z",
  subscribe: true,
},
context: {ip: '10.81.20.10'},
I wanted to check if this second method is supported by rudderstack? The gemspec specifies Rudderstack requires >= 2.0 but I wanted to make sure before making this assumption: https://github.com/rudderlabs/rudder-sdk-ruby/blob/74e6a0281286cebaebfd9e16b6e5cbf3ea3a055a/rudder-sdk-ruby.gemspec#L16C36-L16C39
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
k
CC <!subteam^S04QT1G74Q3|@sdk-team>
Hey @thankful-gpu-70135, Let me check on this and get back to you
CC @lemon-hydrogen-98120
l
Yes, you should be send like this:
Copy code
analytics.identify(
  user_id: '1hKOmRA4GRlm',
  traits: {
    email: "alex@example.com",
    createdAt: "2023-07-24T00:00:00Z",
    subscribe: true
  },
  context: { ip: '10.81.20.10' }
)
t
@lemon-hydrogen-98120 Does this also mean the initial init can be done like this ?
Copy code
require 'rudder-sdk-ruby'

analytics = Rudder::Analytics.new(
  write_key: 'WRITE_KEY',
  data_plane_url: 'DATA_PLANE_URL',
  gzip: true
)
l
Yes.
t
Recommend updating the docs. Most would prefer to use the regular json notation
k
Sure, we will do it @thankful-gpu-70135