mixpanel_client 0.5.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,30 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ config/mixpanel.yml
18
+ coverage
19
+ rdoc
20
+ pkg
21
+
22
+ ## PROJECT::SPECIFIC
23
+ test/
24
+ tmp/
25
+
26
+ ## Bundler/Gems
27
+ *.gem
28
+ .bundle
29
+ Gemfile.lock
30
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1,14 @@
1
+ # Create the gemset if it does not exist
2
+ rvm_gemset_create_on_use_flag=1
3
+
4
+ # Switch to default ruby version when exiting directory
5
+ rvm_project_rvmrc_default=1
6
+
7
+ # Use rvm with a specific version of ruby and gemset
8
+ if [[ `ruby -v` =~ '1.8.7' ]]; then
9
+ rvm use ruby-1.8.7
10
+ rvm gemset use mixpanel_client_1.8.7
11
+ else
12
+ rvm use ruby-1.9.2
13
+ rvm gemset use mixpanel_client_1.9.2
14
+ fi
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in mixpanel_client.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -13,7 +13,7 @@ Ruby access to the [Mixpanel](http://mixpanel.com/) web analytics tool.
13
13
  require 'rubygems'
14
14
  require 'mixpanel_client'
15
15
 
16
- client = Mixpanel::Client.new('api_key' => 'changeme', 'api_secret' => 'changeme')
16
+ client = MixpanelClient.new('api_key' => 'changeme', 'api_secret' => 'changeme')
17
17
 
18
18
  data = client.request do
19
19
  resource 'events/retention'
@@ -26,6 +26,17 @@ Ruby access to the [Mixpanel](http://mixpanel.com/) web analytics tool.
26
26
 
27
27
  puts data.inspect
28
28
 
29
+ ## Changelog
30
+
31
+ ### 1.0.0
32
+ * Changed "Mixpanel" class name to "MixpanelClient" to prevent naming collision in other libraries. [a710a84e8ba4b6f018b7](https://github.com/keolo/mixpanel_client/commit/a710a84e8ba4b6f018b7404ab9fabc8f08b4a4f3)
33
+
34
+ ## Collaborators and Maintainers
35
+ [Keolo Keagy](http://github.com/keolo) (Author)
36
+ [Nathan Chong](http://github.com/paramaw)
37
+ [Paul McMahon](http://github.com/pwim)
38
+ [Chad Etzel](http://github.com/jazzychad)
39
+
29
40
  ## Copyright
30
41
 
31
42
  Copyright (c) 2009+ Keolo Keagy. See LICENSE for details.
data/Rakefile CHANGED
@@ -2,23 +2,8 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'metric_fu'
4
4
 
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- gem.name = 'mixpanel_client'
9
- gem.summary = 'Ruby Mixpanel API Client Library'
10
- gem.description = 'Simple ruby client interface to the Mixpanel API.'
11
- gem.email = 'keolo@dreampointmedia.com'
12
- gem.homepage = 'http://github.com/keolo/mixpanel_client'
13
- gem.authors = ['Keolo Keagy']
14
- gem.add_development_dependency 'rspec', '>= 2.4.0'
15
- gem.add_development_dependency 'webmock', '>= 1.6.2'
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts 'Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler'
21
- end
5
+ require 'bundler'
6
+ Bundler::GemHelper.install_tasks
22
7
 
23
8
  require 'rspec/core/rake_task'
24
9
  RSpec::Core::RakeTask.new(:spec) do |spec|
@@ -39,13 +24,13 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
39
24
  spec.rcov = true
40
25
  end
41
26
 
42
- task :spec => :check_dependencies
27
+ task :spec #=> :check_dependencies
43
28
 
44
29
  begin
45
30
  require 'cucumber/rake/task'
46
31
  Cucumber::Rake::Task.new(:features)
47
32
 
48
- task :features => :check_dependencies
33
+ task :features #=> :check_dependencies
49
34
  rescue LoadError
50
35
  task :features do
51
36
  abort 'Cucumber is not available. In order to run features, you must: sudo gem install cucumber'
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby -Ku
2
+
3
+ # Mixpanel API Ruby Client Library
4
+ #
5
+ # Copyright (c) 2009+ Keolo Keagy
6
+ # See LICENSE for details.
7
+ #
8
+ # Inspired by the official mixpanel php and python libraries.
9
+ # http://mixpanel.com/api/docs/guides/api/
10
+
11
+ require 'cgi'
12
+ require 'digest/md5'
13
+ require 'open-uri'
14
+ require 'json' unless defined?(JSON)
15
+
16
+ # Ruby library for the mixpanel.com web service
17
+ class MixpanelClient
18
+ BASE_URI = 'http://mixpanel.com/api'
19
+ API_VERSION = '2.0'
20
+
21
+ # The mixpanel client can be used to easily consume data through the mixpanel API
22
+ OPTIONS = [:resource, :event, :funnel, :name, :type, :unit, :interval, :limit, :format, :bucket]
23
+ attr_reader :uri
24
+ attr_accessor :api_key, :api_secret
25
+
26
+ OPTIONS.each do |option|
27
+ class_eval "
28
+ def #{option}(arg=nil)
29
+ arg ? @#{option} = arg : @#{option}
30
+ end
31
+ "
32
+ end
33
+
34
+ def initialize(config)
35
+ @api_key = config['api_key']
36
+ @api_secret = config['api_secret']
37
+ end
38
+
39
+ def params
40
+ OPTIONS.inject({}) do |params, param|
41
+ option = send(param)
42
+ params.merge!(param => option) if param != :resource && !option.nil?
43
+ params
44
+ end
45
+ end
46
+
47
+ def request(&options)
48
+ reset_options
49
+ instance_eval(&options)
50
+ @uri = URI.mixpanel(resource, normalize_params(params))
51
+ response = URI.get(@uri)
52
+ to_hash(response)
53
+ end
54
+
55
+ def normalize_params(params)
56
+ params.merge!(
57
+ :api_key => @api_key,
58
+ :expire => Time.now.to_i + 600 # Grant this request 10 minutes
59
+ ).merge!(:sig => generate_signature(params))
60
+ end
61
+
62
+ def generate_signature(args)
63
+ Digest::MD5.hexdigest(args.map{|key,val| "#{key}=#{val}"}.sort.join + api_secret)
64
+ end
65
+
66
+ def to_hash(data)
67
+ if @format == 'csv'
68
+ data
69
+ else
70
+ JSON.parse(data)
71
+ end
72
+ end
73
+
74
+ def reset_options
75
+ (OPTIONS - [:resource]).each do |option|
76
+ eval "remove_instance_variable(:@#{option}) if defined?(@#{option})"
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby -Ku
2
+
3
+ # Mixpanel API Ruby Client Library
4
+ #
5
+ # Copyright (c) 2009+ Keolo Keagy
6
+ # See LICENSE for details.
7
+ #
8
+ # Inspired by the official mixpanel php and python libraries.
9
+ # http://mixpanel.com/api/docs/guides/api/
10
+
11
+ # URI related helpers
12
+ class MixpanelClient::URI
13
+ # Create an http error class for us to use
14
+ class HTTPError < StandardError; end
15
+
16
+ def self.mixpanel(resource, params)
17
+ File.join([MixpanelClient::BASE_URI, MixpanelClient::API_VERSION, resource.to_s]) + "?#{self.encode(params)}"
18
+ end
19
+
20
+ def self.encode(params)
21
+ params.map{|key,val| "#{key}=#{CGI.escape(val.to_s)}"}.sort.join('&')
22
+ end
23
+
24
+ def self.get(uri)
25
+ ::URI.parse(uri).read
26
+ rescue OpenURI::HTTPError => error
27
+ raise HTTPError, JSON.parse(error.io.read)['error']
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ class MixpanelClient
2
+ VERSION = '1.0.0'
3
+ end
@@ -1,101 +1,2 @@
1
- #!/usr/bin/env ruby -Ku
2
-
3
- # Mixpanel API Ruby Client Library
4
- #
5
- # Copyright (c) 2009+ Keolo Keagy
6
- # See LICENSE for details.
7
- #
8
- # Inspired by the official mixpanel php and python libraries.
9
- # http://mixpanel.com/api/docs/guides/api/
10
-
11
- require 'cgi'
12
- require 'digest/md5'
13
- require 'open-uri'
14
- require 'json' unless defined?(JSON)
15
-
16
- # Ruby library for the mixpanel.com web service
17
- module Mixpanel
18
- BASE_URI = 'http://mixpanel.com/api'
19
- VERSION = '2.0'
20
-
21
- # The mixpanel client can be used to easily consume data through the mixpanel API
22
- class Client
23
- OPTIONS = [:resource, :event, :funnel, :name, :type, :unit, :interval, :limit, :format, :bucket]
24
- attr_reader :uri
25
- attr_accessor :api_key, :api_secret
26
-
27
- OPTIONS.each do |option|
28
- class_eval "
29
- def #{option}(arg=nil)
30
- arg ? @#{option} = arg : @#{option}
31
- end
32
- "
33
- end
34
-
35
- def initialize(config)
36
- @api_key = config['api_key']
37
- @api_secret = config['api_secret']
38
- end
39
-
40
- def params
41
- OPTIONS.inject({}) do |params, param|
42
- option = send(param)
43
- params.merge!(param => option) if param != :resource && !option.nil?
44
- params
45
- end
46
- end
47
-
48
- def request(&options)
49
- reset_options
50
- instance_eval(&options)
51
- @uri = URI.mixpanel(resource, normalize_params(params))
52
- response = URI.get(@uri)
53
- to_hash(response)
54
- end
55
-
56
- def normalize_params(params)
57
- params.merge!(
58
- :api_key => @api_key,
59
- :expire => Time.now.to_i + 600 # Grant this request 10 minutes
60
- ).merge!(:sig => generate_signature(params))
61
- end
62
-
63
- def generate_signature(args)
64
- Digest::MD5.hexdigest(args.map{|key,val| "#{key}=#{val}"}.sort.join + api_secret)
65
- end
66
-
67
- def to_hash(data)
68
- if @format == 'csv'
69
- data
70
- else
71
- JSON.parse(data)
72
- end
73
- end
74
-
75
- def reset_options
76
- (OPTIONS - [:resource]).each do |option|
77
- eval "remove_instance_variable(:@#{option}) if defined?(@#{option})"
78
- end
79
- end
80
- end
81
-
82
- # URI related helpers
83
- class URI
84
- # Create an http error class for us to use
85
- class HTTPError < StandardError; end
86
-
87
- def self.mixpanel(resource, params)
88
- File.join([BASE_URI, VERSION, resource.to_s]) + "?#{self.encode(params)}"
89
- end
90
-
91
- def self.encode(params)
92
- params.map{|key,val| "#{key}=#{CGI.escape(val.to_s)}"}.sort.join('&')
93
- end
94
-
95
- def self.get(uri)
96
- ::URI.parse(uri).read
97
- rescue OpenURI::HTTPError => error
98
- raise HTTPError, JSON.parse(error.io.read)['error']
99
- end
100
- end
101
- end
1
+ require "#{File.dirname(__FILE__)}/mixpanel_client/mixpanel_client"
2
+ require "#{File.dirname(__FILE__)}/mixpanel_client/mixpanel_client_uri"
@@ -1,60 +1,25 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'mixpanel_client/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{mixpanel_client}
8
- s.version = "0.5.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Keolo Keagy"]
12
- s.date = %q{2011-01-26}
6
+ s.name = 'mixpanel_client'
7
+ s.version = MixpanelClient::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Keolo Keagy']
10
+ s.email = ['keolo@dreampointmedia.com']
11
+ s.homepage = 'http://github.com/keolo/mixpanel_client'
12
+ s.summary = %q{Ruby Mixpanel API Client Library}
13
13
  s.description = %q{Simple ruby client interface to the Mixpanel API.}
14
- s.email = %q{keolo@dreampointmedia.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- "LICENSE",
22
- "README.md",
23
- "Rakefile",
24
- "VERSION",
25
- "config/mixpanel.template.yml",
26
- "lib/mixpanel_client.rb",
27
- "mixpanel_client.gemspec",
28
- "spec/events_externalspec.rb",
29
- "spec/mixpanel_client_spec.rb",
30
- "spec/spec_helper.rb"
31
- ]
32
- s.homepage = %q{http://github.com/keolo/mixpanel_client}
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.6}
35
- s.summary = %q{Ruby Mixpanel API Client Library}
36
- s.test_files = [
37
- "spec/events_externalspec.rb",
38
- "spec/mixpanel_client_spec.rb",
39
- "spec/spec_helper.rb",
40
- "test/manual.rb",
41
- "test/test.rb"
42
- ]
43
14
 
44
- if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
- s.specification_version = 3
15
+ s.rubyforge_project = 'mixpanel_client'
47
16
 
48
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
- s.add_development_dependency(%q<rspec>, [">= 2.4.0"])
50
- s.add_development_dependency(%q<webmock>, [">= 1.6.2"])
51
- else
52
- s.add_dependency(%q<rspec>, [">= 2.4.0"])
53
- s.add_dependency(%q<webmock>, [">= 1.6.2"])
54
- end
55
- else
56
- s.add_dependency(%q<rspec>, [">= 2.4.0"])
57
- s.add_dependency(%q<webmock>, [">= 1.6.2"])
58
- end
59
- end
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ['lib']
60
21
 
22
+ s.add_development_dependency('rspec')
23
+ s.add_development_dependency('webmock')
24
+ s.add_development_dependency('metric_fu')
25
+ end
@@ -7,7 +7,7 @@ describe 'External calls to mixpanel' do
7
7
  before :all do
8
8
  config = YAML.load_file(File.dirname(__FILE__) + '/../config/mixpanel.yml')
9
9
  config.should_not be_nil
10
- @client = Mixpanel::Client.new(config)
10
+ @client = MixpanelClient.new(config)
11
11
  end
12
12
 
13
13
  describe 'Events' do
@@ -17,7 +17,7 @@ describe 'External calls to mixpanel' do
17
17
  resource 'events'
18
18
  end
19
19
  }
20
- data.should raise_error(Mixpanel::URI::HTTPError)
20
+ data.should raise_error(MixpanelClient::URI::HTTPError)
21
21
  end
22
22
 
23
23
  it 'should return events' do
@@ -1,11 +1,12 @@
1
+ # coding: utf-8
1
2
  require 'rubygems'
2
3
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
4
 
4
- describe Mixpanel::Client do
5
+ describe MixpanelClient do
5
6
  before :all do
6
7
  config = {'api_key' => 'test', 'api_secret' => 'test'}
7
- @client = Mixpanel::Client.new(config)
8
- @uri = Regexp.escape(Mixpanel::BASE_URI)
8
+ @client = MixpanelClient.new(config)
9
+ @uri = Regexp.escape(MixpanelClient::BASE_URI)
9
10
  end
10
11
 
11
12
  describe '#request' do
@@ -96,7 +97,7 @@ describe Mixpanel::Client do
96
97
  bucket 'list'
97
98
  end
98
99
 
99
- Mixpanel::Client::OPTIONS.each do |option|
100
+ MixpanelClient::OPTIONS.each do |option|
100
101
  @client.send(option).should_not be_nil
101
102
  end
102
103
 
@@ -104,36 +105,36 @@ describe Mixpanel::Client do
104
105
  resource 'events/properties/top'
105
106
  end
106
107
 
107
- (Mixpanel::Client::OPTIONS - [:resource]).each do |option|
108
+ (MixpanelClient::OPTIONS - [:resource]).each do |option|
108
109
  @client.send(option).should be_nil
109
110
  end
110
111
  end
111
112
  end
112
113
  end
113
114
 
114
- describe Mixpanel::URI do
115
+ describe MixpanelClient::URI do
115
116
  describe '.mixpanel' do
116
117
  it 'should return a properly formatted mixpanel uri as a string (without an endpoint)' do
117
118
  resource, params = ['events', {:c => 'see', :a => 'aye'}]
118
- Mixpanel::URI.mixpanel(resource, params).should == 'http://mixpanel.com/api/2.0/events?a=aye&c=see'
119
+ MixpanelClient::URI.mixpanel(resource, params).should == 'http://mixpanel.com/api/2.0/events?a=aye&c=see'
119
120
  end
120
121
  it 'should return a properly formatted mixpanel uri as a string (with an endpoint)' do
121
122
  resource, params = ['events/top', {:c => 'see', :a => 'aye'}]
122
- Mixpanel::URI.mixpanel(resource, params).should == 'http://mixpanel.com/api/2.0/events/top?a=aye&c=see'
123
+ MixpanelClient::URI.mixpanel(resource, params).should == 'http://mixpanel.com/api/2.0/events/top?a=aye&c=see'
123
124
  end
124
125
  end
125
126
 
126
127
  describe '.encode' do
127
128
  it 'should return a string with url encoded values.' do
128
129
  params = {:hey => '!@#$%^&*()\/"Ü', :soo => "hëllö?"}
129
- Mixpanel::URI.encode(params).should == 'hey=%21%40%23%24%25%5E%26%2A%28%29%5C%2F%22%C3%9C&soo=h%C3%ABll%C3%B6%3F'
130
+ MixpanelClient::URI.encode(params).should == 'hey=%21%40%23%24%25%5E%26%2A%28%29%5C%2F%22%C3%9C&soo=h%C3%ABll%C3%B6%3F'
130
131
  end
131
132
  end
132
133
 
133
134
  describe '.get' do
134
135
  it 'should return a string response' do
135
136
  stub_request(:get, 'http://example.com').to_return(:body => 'something')
136
- Mixpanel::URI.get('http://example.com').should == 'something'
137
+ MixpanelClient::URI.get('http://example.com').should == 'something'
137
138
  end
138
139
  end
139
140
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixpanel_client
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
- - 0
7
- - 5
8
7
  - 1
9
- version: 0.5.1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Keolo Keagy
@@ -14,54 +15,73 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-01-26 00:00:00 -08:00
18
+ date: 2011-03-12 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
- - 2
29
- - 4
30
31
  - 0
31
- version: 2.4.0
32
+ version: "0"
32
33
  type: :development
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
36
  name: webmock
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
43
+ hash: 3
41
44
  segments:
42
- - 1
43
- - 6
44
- - 2
45
- version: 1.6.2
45
+ - 0
46
+ version: "0"
46
47
  type: :development
47
48
  version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: metric_fu
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
48
63
  description: Simple ruby client interface to the Mixpanel API.
49
- email: keolo@dreampointmedia.com
64
+ email:
65
+ - keolo@dreampointmedia.com
50
66
  executables: []
51
67
 
52
68
  extensions: []
53
69
 
54
- extra_rdoc_files:
55
- - LICENSE
56
- - README.md
70
+ extra_rdoc_files: []
71
+
57
72
  files:
58
73
  - .document
74
+ - .gitignore
75
+ - .rvmrc
76
+ - Gemfile
59
77
  - LICENSE
60
78
  - README.md
61
79
  - Rakefile
62
- - VERSION
63
80
  - config/mixpanel.template.yml
64
81
  - lib/mixpanel_client.rb
82
+ - lib/mixpanel_client/mixpanel_client.rb
83
+ - lib/mixpanel_client/mixpanel_client_uri.rb
84
+ - lib/mixpanel_client/version.rb
65
85
  - mixpanel_client.gemspec
66
86
  - spec/events_externalspec.rb
67
87
  - spec/mixpanel_client_spec.rb
@@ -76,23 +96,27 @@ rdoc_options: []
76
96
  require_paths:
77
97
  - lib
78
98
  required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
79
100
  requirements:
80
101
  - - ">="
81
102
  - !ruby/object:Gem::Version
103
+ hash: 3
82
104
  segments:
83
105
  - 0
84
106
  version: "0"
85
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
86
109
  requirements:
87
110
  - - ">="
88
111
  - !ruby/object:Gem::Version
112
+ hash: 3
89
113
  segments:
90
114
  - 0
91
115
  version: "0"
92
116
  requirements: []
93
117
 
94
- rubyforge_project:
95
- rubygems_version: 1.3.6
118
+ rubyforge_project: mixpanel_client
119
+ rubygems_version: 1.6.2
96
120
  signing_key:
97
121
  specification_version: 3
98
122
  summary: Ruby Mixpanel API Client Library
@@ -100,5 +124,3 @@ test_files:
100
124
  - spec/events_externalspec.rb
101
125
  - spec/mixpanel_client_spec.rb
102
126
  - spec/spec_helper.rb
103
- - test/manual.rb
104
- - test/test.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.1
data/test/manual.rb DELETED
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Notes:
4
- # Test URI.mixpanel in browser to see response and error codes.
5
- #
6
- # Pushing to rubygems.org
7
- # rake version:bump:patch
8
- # git commit ...
9
- # git push
10
- # rake release
11
-
12
- require 'rubygems'
13
- require "#{File.dirname(__FILE__)}/../lib/mixpanel_client"
14
-
15
- config = {'api_key' => 'e81de686c96261747fdc443d4809c297', 'api_secret' => '201ff82db5f1e8766b0004f0acf8d82e'}
16
-
17
- client = Mixpanel::Client.new(config)
18
-
19
- # Block form
20
- data = client.request do
21
- resource 'events'
22
- event '["test-event"]'
23
- unit 'hour'
24
- interval 24
25
- format 'csv'
26
- end
27
-
28
- puts
29
- puts client.inspect
30
- puts data.inspect
31
- puts
32
-
33
- # Block form
34
- data = client.request do
35
- resource 'events/properties/top'
36
- type 'general'
37
- event '["test-event"]'
38
- end
39
-
40
- puts
41
- puts client.inspect
42
- puts data.inspect
43
- puts
44
-
45
- # Bucket
46
- data = client.request do
47
- resource 'events'
48
- event '["test-event"]'
49
- type 'general'
50
- unit 'hour'
51
- interval 24
52
- bucket 'test'
53
- end
54
-
55
- puts
56
- puts client.inspect
57
- puts data.inspect
58
- puts
data/test/test.rb DELETED
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Notes:
4
- # Test URI.mixpanel in browser to see response and error codes.
5
- #
6
- # Pushing to rubygems.org
7
- # rake version:bump:patch
8
- # git commit ...
9
- # git push
10
- # rake release
11
-
12
- require 'rubygems'
13
- require "#{File.dirname(__FILE__)}/../lib/mixpanel_client"
14
-
15
- config = YAML.load_file "#{File.dirname(__FILE__)}/../config/mixpanel.yml"
16
- client = Mixpanel::Client.new(config)
17
-
18
- data = client.request do
19
- resource 'events'
20
- event '["test-event"]'
21
- unit 'hour'
22
- interval 24
23
- format 'csv'
24
- end
25
-
26
- puts client.inspect
27
- puts data.inspect
28
-
29
-
30
- data = client.request do
31
- resource 'events/top'
32
- type 'general'
33
- end
34
-
35
- puts client.inspect
36
- puts data.inspect