Closed nateberkopec closed 12 years ago
Looks interesting. I'll take a closer look hopefully this week. Would you know enough to write a spec for this (using rspec)?
Sure! I'll write up a spec this week.
You can now pass arbitrary options to MixpanelClient#request including 'on' and 'where'. I think this satisfies your requirement?
In our Rails app, each User instance has it's own instance of MixpanelClient, because we use the Data Export API to give our Users data specific to them.
So, our request looked something like this:
So, that would pull down the data for EVERY user. Obviously, this is pretty inefficient if you've got a ton of users, and we wanted to pull down just one user's mixpanel events.
So, my solution was to add an optional hash to the MixpanelClient when it's instantiated, which can then be accessed inside of its request blocks:
I'm pretty new to Ruby and contributing to open source, so if there's a better way of doing this, please let me know! The syntax (especially self.options[:username] seems kind of ugly anyway.