Coder Social home page Coder Social logo

mixpanel_client's Introduction

Mixpanel Data API Client

Gem Version Code Climate

Ruby access to the Mixpanel web analytics tool.

Mixpanel Data API Reference

Installation

gem install mixpanel_client

or if you use a Gemfile

gem 'mixpanel_client'

Usage

require 'rubygems'
require 'mixpanel_client'

client = Mixpanel::Client.new(
  api_secret: 'changeme'
  timeout: 240, # Default is 60 seconds, increase to reduce timeout errors.

  # Optional URI overrides (e.g. https://developer.mixpanel.com/reference/overview)
  base_uri: 'api-eu.mixpanel.com',
  data_uri: 'example-data.com',
  import_uri: 'example-import.com'
)

data = client.request(
  'events/properties',
  event:     'Product Clicked',
  name:      'product-clicked',
  values:    '["value1", "value2"]',
  type:      'unique',
  unit:      'day',
  limit:      5,
  from_date: '2013-12-1', #<- Date range
  to_date:   '2014-3-1'   #<-
)

The API also supports passing a time interval rather than an explicit date range.

data = client.request(
  'events/properties',
  event:    'Product Clicked',
  name:     'product-clicked',
  values:   '["value1", "value2"]',
  type:     'unique',
  unit:     'day',
  limit:     5,
  interval: 7 #<- Interval
)

Use the Import API to specify a time in the past. You'll need to include your API token in the data (docs).

To import, encode the data as JSON and use Base64. Encode the data like this:

data_to_import = {
    'event' => 'firstLogin', 
    'properties' => {
        'distinct_id' => guid, 
        'time' => time_as_integer_seconds_since_epoch, 
        'token' => api_token
    }
}
encoded_data = Base64.encode64(data_to_import.to_json)

Then make a request to the API with the given API key, passing in the encoded data:

data = client.request('import', {:data => encoded_data, :api_key => api_key})

You can only import one event at a time.

Parallel

The option to make parallel requests has been removed (in v5) so that there are no runtime dependencies.

Development

List of rake tasks.

rake -T

Run specs.

rake spec

Run external specs.

cp config/mixpanel.template.yml config/mixpanel.yml
vi config/mixpanel.yml
rake spec:externals

Run rubocop and fix offences.

rubocop

Changelog

Changelog

Collaborators and Maintainers

Contributors

Copyright

Copyright (c) 2009+ Keolo Keagy. See license for details.

mixpanel_client's People

Contributors

alpinegizmo avatar bderusha avatar burnettk avatar chaosfreak avatar ctborg avatar darrennix avatar hebo avatar jasonlogsdon avatar keolo avatar kranzky avatar mferrier avatar pearsons avatar pwim avatar rgabo avatar rodxavier avatar seodma avatar vaicine avatar whatthewhat avatar wizardofcrowds avatar yaotti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixpanel_client's Issues

Allow for control of timeouts

When running a large data export using the 'export' endpoint, I am happy to wait several minutes as stated in the export docs:

This endpoint uses gzip to compress the transfer; as a result, raw exports should not be processed until the file is received in its entirety. While this process is normally quick and results in a smaller file size, some large exports can take a few minutes to generate. Ensure the timeout set on the receiving client is large enough to account for this process (e.g. larger than 60 seconds).

But the default timeout in mixpanel_client is set to a default of 60-70 seconds. When running a large query, after 60-70 seconds I get this error /Users/csalvato/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/net/protocol.rb:146:inrescue in rbuf_fill': Timeout::Error (Timeout::Error)`

For reference, here is the query:

mixpanel_data = client.request('export', 
                                from_date: "2014-12-17",
                                to_date: "2015-12-28",
                                event: ["Completed Order"]) 

This is about a year's worth of events...so it's a lot. But even with 3 months of events I sometimes hit the timeouts, and we are loading exponentially more events into Mixpanel each month.

Is there any way to increase the timeout period for calls?

Filter by Properties

This lib is good for basic queries but it'd be GREAT if we could filter by additional properties :)

For instance, it'd be great if I could query something like the following:

data = @client.request(
  'events/properties',
  event: @event,
  name: @name,
  filter: ['organizer_id'],
  type: 'unique',
  unit: 'day',
  interval: 7,
  limit: 10
)

Refactor specs

  • Use new expect syntax and other best practices
  • Use VCR instead of external specs
  • Hardcode mixpanel test account credentials

SSL Error calling client request

When I run this code requesting data from mixpanel, I get this error. I have updated openssl, reinstalled ruby with rvm, added the ca-cert.pem to my SSL_CERT_FILE and nothing has worked.

client = Mixpanel::Client.new(api_key: 'API_KEY', api_secret: 'API_SECRET') client.request('export', { event: ['EVENT'] , 'where' => 'properties["metric_id"]==1432346', from_date: '2016-06-13', to_date: '2016-06-13'})

Errors:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

from /Users/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/http.rb:920:in `connect'

Please Allow Timezone Property

According to Mixpanel you can pass in a timezone that will relate to the mp_timezone property. If you could just allow timezone to be passed in to the client.request call that'd be great.

If you don't have time please let me know and I'll fork the repo.

Thanks again.
Jason

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Would like to submit pull request but getting "Permission denied"

I'd like to submit a pull request for a feature enhancement that I wrote. However, when I try to run git push origin my-local-branch, I get an error remote: Permission to keolo/mixpanel_client.git denied to ChaosFreak.. I have submitted branches in the past with no problem. Is there something I'm doing wrong?

JSON error when Mixpanel API is down

When the Mixpanel API is down for maintenance or whatever, API requests return HTML instead of JSON, causing json.parse to fail and the resulting error to bubble up to my application.

Can we tweak the MP API or put all mixpanel_client related errors in one namespace so I have only one thing to catch in my app?

Error

exception type JSON::ParserError

743: unexpected token at '<html> <head> <title>Mixpanel | Real-time Web Analytics, Funnel Analysis</title> [...] Your real-time analytics will be back soon. [...]</html> '

'Uninitalized Constant Typhoeus' with parallel execution

I caught a bug while running parallel requests on a Gem cloned and built manually from master

/usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:100:in prepare_parallel_request': uninitialized constant Typhoeus (NameError)
    from /usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:59:in `make_parallel_request'
    from /usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:55:in `request'
    from mixpanel-client.rb:19:in `execute'
    from mixpanel-client.rb:63:in `block (2 levels) in <main>'
    from mixpanel-client.rb:61:in `each'
    from mixpanel-client.rb:61:in `block in <main>'
    from mixpanel-client.rb:52:in `each'
    from mixpanel-client.rb:52:in `<main>'

my Ruby Version is

ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

It looks like client.rb might need to require typhoeus by some means. The workaround I have was to install the typhoeus gem and require it manually from my client script.

require 'mixpanel_client'
require 'typhoeus'

I'll fork and have a look at patching shortly.

Thanks!

Error when starting thin server: `const_missing_from_s3_library': uninitialized constant Mixpanel::Tracker::Middleware

Hi,

While trying to start thin, I receive this error (in full below). Does anyone have a suggestion for me? Thanks!

/Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:212:in const_missing_from_s3_library': uninitialized constant Mixpanel::Tracker::Middleware (NameError) from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:229:inblock in constantize'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:in each' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/activesupport-3.2.3/lib/active_support/inflector/methods.rb:228:inconstantize'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:24:in klass' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:43:inbuild'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:113:in block in build' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:113:ineach'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:113:in inject' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/actionpack-3.2.3/lib/action_dispatch/middleware/stack.rb:113:inbuild'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/engine.rb:470:in app' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/application/finisher.rb:31:inblock in module:Finisher'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/initializable.rb:30:in instance_exec' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/initializable.rb:30:inrun'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/initializable.rb:55:in block in run_initializers' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/initializable.rb:54:ineach'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/initializable.rb:54:in run_initializers' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/application.rb:136:ininitialize!'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in method_missing' from /Users/ghanpatel/Marqueed_Tintin/config/environment.rb:5:in<top (required)>'
from /Users/ghanpatel/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /Users/ghanpatel/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /Users/ghanpatel/Marqueed_Tintin/config.ru:7:in block in <main>' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/rack-1.4.1/lib/rack/builder.rb:51:ininstance_eval'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/rack-1.4.1/lib/rack/builder.rb:51:in initialize' from /Users/ghanpatel/Marqueed_Tintin/config.ru:1:innew'
from /Users/ghanpatel/Marqueed_Tintin/config.ru:1:in <main>' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:ineval'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in load' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/rack/adapter/loader.rb:42:infor'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/thin/controllers/controller.rb:169:in load_adapter' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/thin/controllers/controller.rb:73:instart'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/thin/runner.rb:187:in run_command' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/lib/thin/runner.rb:152:inrun!'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/gems/thin-1.5.0/bin/thin:6:in <top (required)>' from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/bin/thin:23:inload'
from /Users/ghanpatel/.rvm/gems/ruby-1.9.3-p327@marqueed/bin/thin:23:in `

'

IOError On Large Responses

When the query returns a large response, the client bombs and throws an IOError. This is caused from line 22 of file uri.rb

::URI.parse(uri).read

For large reads, this causes a problem. Perhaps use the open method that lets you process the file in piecemeal instead.

Of course then this will have to refactored as well (client.rb:55):

  else
    response = URI.get(@uri)
    response = %Q|[#{response.split("\n").join(',')}]| if resource == 'export'
    Utils.to_hash(response, @format)
  end

As this tries to process the entire contents at once.

"odd number list for Hash" when trying 'usage' example on Mac OS X 10.8.2

I am a Ruby novice, so I hope this isn't a dumb question.

I have a Mac OS X 10.8.2 and am using the pre-installed ruby 1.8.7; when I try to run the usage example, I am getting some errors relating to the hash:

macmini:Ruby jishaq$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

macmini:Ruby jishaq$ cat usageExample.rb 
#!/usr/bin/env ruby

require 'rubygems'
require 'mixpanel_client'

config = {api_key: 'changeme', api_secret: 'changeme'}
client = Mixpanel::Client.new(config)

data = client.request('events/properties', {
  event:     'splash features',
  name:      'feature',
  values:    '["uno", "dos"]',
  type:      'unique',
  unit:      'day',
  interval:   7,
  limit:      5,
})

puts data.inspect   

macmini:Ruby jishaq$ ./usageExample.rb 
./usageExample.rb:6: odd number list for Hash
config = {api_key: 'changeme', api_secret: 'changeme'}
                  ^
./usageExample.rb:6: syntax error, unexpected ':', expecting '}'
config = {api_key: 'changeme', api_secret: 'changeme'}
                  ^
./usageExample.rb:6: syntax error, unexpected ',', expecting $end
config = {api_key: 'changeme', api_secret: 'changeme'}
                              ^
macmini:Ruby jishaq$ 

It seems that ruby 1.8.7 doesn't support the hash syntax with the ':' character for creating symbols, so I tried to rejigger the usage example, but it fails elsewhere:

macmini:Ruby jishaq$ cat usageExample2.rb 
#!/usr/bin/env ruby

require 'rubygems'
require 'mixpanel_client'

config = {'api_key' => 'changeme', 'api_secret' => 'changeme'}
client = Mixpanel::Client.new(config)

data = client.request('events/properties', {
  'event' =>     'splash features',
  'name' =>      'feature',
  'values' =>    '["uno", "dos"]',
  'type' =>     'unique',
  'unit' =>      'day',
  'interval' =>   7,
  'limit' =>      5,
})

puts data.inspect   

macmini:Ruby jishaq$ ./usageExample2.rb 
/Library/Ruby/Gems/1.8/gems/mixpanel_client-3.1.0/lib/mixpanel/utils.rb:17:in `+': can't convert nil into String (TypeError)
    from /Library/Ruby/Gems/1.8/gems/mixpanel_client-3.1.0/lib/mixpanel/utils.rb:17:in `generate_signature'
    from /Library/Ruby/Gems/1.8/gems/mixpanel_client-3.1.0/lib/mixpanel/client.rb:98:in `normalize_options'
    from /Library/Ruby/Gems/1.8/gems/mixpanel_client-3.1.0/lib/mixpanel/client.rb:50:in `request'
    from ./usageExample2.rb:9
macmini:Ruby jishaq$ 

In utils.rb:17, I am guessing the "nil" in question would be api_secret value:

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

My guess is that mixpanel_client is simply not compatible with ruby 1.8.7 due to its use of the 'symbol' concept with hash tables.

I tried to upgrade to a newer version of ruby (2.0.0) on my mac using rvm, but it was fraught with openssl-related errors, so I gave up and removed (imploded) it and am back to stock 1.8.7.

Any suggestions are appreciated. Thanks very much for your time.

Request events with People properties

Hi,

We can only retrieve events with Event properties. Maybe it's a Mixpanel Data API limitation but that would be interesting to use People properties in "name" attribute as well.

Faraday dependency very old

When installing the gem, one often hits the following:

Bundler could not find compatible versions for gem "faraday":
  In Gemfile:
    mixpanel-client (>= 0) ruby depends on
      faraday (~> 0.8.0) ruby

    twitter (~> 5.7.1) ruby depends on
      faraday (0.9.0)

I recommend either bumping up the locked version of typhoeus or removing the version lock entirely.

Error in documentation

Just a quick note to let you know there is an error regards requesting event properties in the documentation. The mixpanel documentation states the following for the event parameter in properties requests:

Event: The event that you wish to get data for. Note: this is a single event name, not an array.

I was following your example as a template and was stumped a bit by this so just thought you might want to update ๐Ÿ˜ƒ

Dockerize

Dockerize to have a consistent environment for development and testing.

Answers API "format" issue.

When calling the Answers API ('engage/answers' endpoint) the API throws an error:

"Mixpanel::HTTPError: unknown param: format"

I can easily resolve this by monkey patching the Client class but it would be ideal if the API did not pass the format param on calls to the answers API. I will try to find time to fix this but wanted to post the issue here in the meantime in case others run into the same thing.

For calls to the answers api this is what I'm doing for now in my script.

module Mixpanel
  class Client
    def normalize_options(options)
      normalized_options = options.dup
      normalized_options
        .merge!(
          api_key: @api_key,
          expire: options[:expire] ? options[:expire].to_i : Time.now.to_i + 600
        ).merge!(
          sig: Utils.generate_signature(normalized_options, @api_secret)
        )
    end
  end
end

Events named "Notification Opened" & "Notification Opened" return incorrect values

Example:

config = {api_key: KEY, api_secret: SECRET}
client = Mixpanel::Client.new(config)
client.request('events', { event: ["Notification Sent"], type: "unique", unit: "month", interval: 3 })

=> {"legend_size"=>1,
 "data"=>
  {"series"=>["2013-03-01", "2013-04-01", "2013-05-01"],
   "values"=>
    {"Notification Sent"=>
      {"2013-04-01"=>0, "2013-05-01"=>0, "2013-03-01"=>0}}}}

All other events are returning correct data for me.

Parallel requests

Determine if parallel requests should be abstracted to another gem, leave as is, or force every request to use hydra?

Help with parallel request

Any idea in how to handle Mixpanel::HTTPError: too many export requests in progress for this project while making parallel requests?

I'm using the last version of mix panel_client

Backtrace

	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/mixpanel_client-4.1.6/lib/mixpanel/client.rb:130:in `block in prepare_parallel_request'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/request/callbacks.rb:129:in `call'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/request/callbacks.rb:129:in `block in execute_callbacks'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/request/callbacks.rb:128:in `map'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/request/callbacks.rb:128:in `execute_callbacks'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/request/operations.rb:35:in `finish'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/easy_factory.rb:105:in `block in set_callback'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/easy/response_callbacks.rb:65:in `call'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/easy/response_callbacks.rb:65:in `block in complete'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/easy/response_callbacks.rb:65:in `each'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/easy/response_callbacks.rb:65:in `complete'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/multi/operations.rb:148:in `check'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/multi/operations.rb:161:in `run'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/ethon-0.6.3/lib/ethon/multi/operations.rb:43:in `perform'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/hydra/runnable.rb:21:in `run'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/typhoeus-0.6.7/lib/typhoeus/hydra/memoizable.rb:51:in `run'
	from /Users/ruben/.rvm/gems/ruby-1.9.3-p547/gems/mixpanel_client-4.1.6/lib/mixpanel/client.rb:139:in `run_parallel_requests'

Doesn't work in ruby 1.9

"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.

NoMemoryError when exporting huge events

Hi, I'm having a problem when I try to export a very large number of events

client.request('export', from_date: from_date, to_date: to_date).each do |event|
  file.puts(event.to_json)
end

We get:

2015-04-09T16:46:00.705Z 1 TID-otovfis9w WARN: failed to allocate memory
2015-04-09T16:46:00.705Z 1 TID-otovfis9w WARN: /usr/src/app/vendor/bundle/ruby/2.2.0/gems/mixpanel_client-4.1.1/lib/mixpanel/client.rb:69:in `make_normal_request'

I think it's because the HTTP body of the response is to big to be stored in memory at once.
There should be a way to stream or chunk the output.

What do you think ?

got Overwrite the executable when 'gem update'

Is it normal? Should I overwrite them?

gem up
Updating installed gems
Updating mixpanel_client
Fetching: mixpanel_client-3.1.1.gem (100%)
mixpanel_client's executable "autospec" conflicts with rspec-core
Overwrite the executable? [yN]  n
ERROR:  Error installing mixpanel_client:
        "autospec" from mixpanel_client conflicts with installed executable from rspec-core

Bundle won't install mixpanel_client

After failing to 'sudo gem install mixpanel_client", I've manually put the gem in my Gemfile.
gem 'mixpanel-client', :git => 'git://github.com/keolo/mixpanel_client.git'

After running bundle install, mixpanel_client cannot be found
bundle install
Updating git://github.com/keolo/mixpanel_client.git
Fetching source index for http://rubygems.org/
Could not find gem 'mixpanel-client (>= 0) ruby' in git://github.com/keolo/mixpanel_client.git (at master).
Source does not contain any versions of 'mixpanel-client (>= 0) ruby'

I'm on rails 3.1.1 and in ruby 1.9.2

error occured while installing typheous -v 0.3.3 , and Bundler cannot continue.

Hi,

I am facing this error while doing bundle install.

An error occurred while installing typhoeus (0.3.3), and Bundler cannot continue.
Make sure that gem install typhoeus -v '0.3.3' succeeds before bundling.

typheous 0.3.3 is an older version and it is deprecated and I could not install it. Can anyone please help.

Thanks.

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.