keolo / mixpanel_client

Ruby interface to the Mixpanel Data API
MIT License
148 stars 72 forks source link

Doesn't work in ruby 1.9 #1

Closed chrisvariety closed 14 years ago

chrisvariety commented 14 years ago

"Invalid request signature"

The issue is because the library calls to_s on an array. Here's some testing in ruby 1.8.6:

  irb(main):001:0> ['a','b'].to_s
  => "ab"

Here's the same in ruby 1.9.1:

  irb(main):001:0> ['a','b'].to_s
  => "[\"a\", \"b\"]"

So, if we change the line

  Digest::MD5.hexdigest(args.map{|k,v| "#{k}=#{v}"}.sort.to_s + api_secret)

to:

  Digest::MD5.hexdigest(args.map{|k,v| "#{k}=#{v}"}.sort.join('') + api_secret)

Everything is happy. I would fork and all that, but I am way too lazy.

keolo commented 14 years ago

Thanks Chris. Your change has been applied. I'm also going to remove the note about forking in the README. It's the default when creating gems with Jeweler but it sounds pretty douchey ... especially for small changes. Anyway, thanks for finding that. I haven't tested in 1.9 yet so let me know if there are any other issues.