mixpanel_client 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -10
- data/lib/mixpanel/client.rb +2 -2
- data/lib/mixpanel/version.rb +1 -1
- data/manual_test/basic.rb +3 -1
- data/mixpanel_client.gemspec +1 -1
- data/spec/mixpanel_client/events_externalspec.rb +2 -0
- data/spec/mixpanel_client/mixpanel_client_spec.rb +6 -6
- data/spec/mixpanel_client/uri_spec.rb +2 -2
- metadata +9 -9
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Ruby access to the [Mixpanel](http://mixpanel.com/) web analytics tool.
|
4
4
|
|
5
|
-
[Mixpanel Data API Reference](
|
5
|
+
[Mixpanel Data API Reference](https://mixpanel.com/docs/api-documentation/data-export-api)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -56,7 +56,7 @@ Run external specs.
|
|
56
56
|
vi config/mixpanel.yml
|
57
57
|
rake spec:externals
|
58
58
|
|
59
|
-
##
|
59
|
+
## Releasing Gem
|
60
60
|
Update version
|
61
61
|
|
62
62
|
vi lib/mixpanel/version.rb
|
@@ -74,30 +74,33 @@ Create tag v2.0.2 and build and push mixpanel_client-2.0.2.gem to Rubygems
|
|
74
74
|
|
75
75
|
## Changelog
|
76
76
|
|
77
|
-
###
|
77
|
+
### v2.1.0
|
78
|
+
* Updated json dependency to 1.6.
|
79
|
+
|
80
|
+
### v2.0.2
|
78
81
|
* Added timezone to available options.
|
79
82
|
* All exceptions can be caught under Mixpanel::Error.
|
80
83
|
|
81
|
-
###
|
84
|
+
### v2.0.1
|
82
85
|
* Added options used in segmentation resources.
|
83
86
|
|
84
|
-
###
|
87
|
+
### v2.0.0
|
85
88
|
* Manually tested compatibility with Mixpanel gem.
|
86
89
|
|
87
|
-
###
|
90
|
+
### v2.0.0.beta2
|
88
91
|
* Added JSON to gemspec for ruby versions less than 1.9.
|
89
92
|
|
90
|
-
###
|
93
|
+
### v2.0.0.beta1
|
91
94
|
* Reverted to namespacing via module name because it's a better practice.
|
92
95
|
I.e. Use `Mixpanel::Client` instead of `MixpanelClient`.
|
93
96
|
* Added 'values' as an optional parameter
|
94
97
|
* `gem install mixpanel_client --pre`
|
95
98
|
|
96
|
-
###
|
99
|
+
### v1.0.1
|
97
100
|
* Minor housekeeping and organizing
|
98
101
|
* Refactored specs
|
99
102
|
|
100
|
-
###
|
103
|
+
### v1.0.0
|
101
104
|
* Changed "Mixpanel" class name to "MixpanelClient" to prevent naming collision in other
|
102
105
|
libraries. [a710a84e8ba4b6f018b7](https://github.com/keolo/mixpanel_client/commit/a710a84e8ba4b6f018b7404ab9fabc8f08b4a4f3)
|
103
106
|
|
@@ -106,7 +109,6 @@ Create tag v2.0.2 and build and push mixpanel_client-2.0.2.gem to Rubygems
|
|
106
109
|
[Jason Logsdon](https://github.com/jasonlogsdon)
|
107
110
|
[James R](https://github.com/Cev)
|
108
111
|
[Mike Ferrier](http://github.com/mferrier)
|
109
|
-
[Mike Ferrier](http://github.com/mferrier)
|
110
112
|
[Grzegorz Forysinski](http://github.com/railwaymen)
|
111
113
|
[Nathan Chong](http://github.com/paramaw)
|
112
114
|
[Paul McMahon](http://github.com/pwim)
|
data/lib/mixpanel/client.rb
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
module Mixpanel
|
10
10
|
# Return metrics from Mixpanel Data API
|
11
11
|
class Client
|
12
|
-
BASE_URI = '
|
12
|
+
BASE_URI = 'https://mixpanel.com/api/2.0'
|
13
13
|
|
14
14
|
attr_reader :uri
|
15
15
|
attr_accessor :api_key, :api_secret
|
16
16
|
|
17
17
|
# Availalbe options for a Mixpanel API request
|
18
|
-
OPTIONS = [:resource, :event, :
|
18
|
+
OPTIONS = [:resource, :event, :funnel_id, :name, :type, :unit, :interval, :limit, :format, :bucket,
|
19
19
|
:values, :from_date, :to_date, :on, :where, :buckets, :timezone]
|
20
20
|
|
21
21
|
# Dynamically define accessor methods for each option
|
data/lib/mixpanel/version.rb
CHANGED
data/manual_test/basic.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
1
3
|
require 'rubygems'
|
2
|
-
require '
|
4
|
+
require 'mixpanel_client'
|
3
5
|
require 'yaml'
|
4
6
|
|
5
7
|
config = YAML.load_file(File.dirname(__FILE__) + '/../config/mixpanel.yml')['mixpanel']
|
data/mixpanel_client.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
22
|
s.add_runtime_dependency('json', '~> 1.6') if RUBY_VERSION < '1.9'
|
23
|
-
s.add_development_dependency('bundler', '>=
|
23
|
+
s.add_development_dependency('bundler', '>=1.0.21')
|
24
24
|
s.add_development_dependency('rake', '>=0.9.2.2')
|
25
25
|
s.add_development_dependency('rdoc', '>=3.11')
|
26
26
|
s.add_development_dependency('rspec', '>=2.5.0')
|
@@ -75,6 +75,7 @@ describe 'External calls to mixpanel' do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should return retention' do
|
78
|
+
pending 'Retention now has its own endpoint.'
|
78
79
|
data = @client.request do
|
79
80
|
resource 'events/retention'
|
80
81
|
event '["test-event"]'
|
@@ -86,6 +87,7 @@ describe 'External calls to mixpanel' do
|
|
86
87
|
end
|
87
88
|
|
88
89
|
it 'should return retention in csv format' do
|
90
|
+
pending 'Retention now has its own endpoint.'
|
89
91
|
data = @client.request do
|
90
92
|
resource 'events/retention'
|
91
93
|
event '["test-event"]'
|
@@ -88,12 +88,12 @@ describe Mixpanel::Client do
|
|
88
88
|
|
89
89
|
@client.request do
|
90
90
|
# This is not a real request. It just lists all possible options.
|
91
|
-
resource
|
92
|
-
event
|
93
|
-
|
94
|
-
name
|
95
|
-
type
|
96
|
-
unit
|
91
|
+
resource 'events'
|
92
|
+
event '["test-event"]'
|
93
|
+
funnel_id 'down-the-rabbit-hole'
|
94
|
+
name 'ricky-bobby'
|
95
|
+
type 'A'
|
96
|
+
unit 'hour'
|
97
97
|
interval 24
|
98
98
|
limit 5
|
99
99
|
format 'csv'
|
@@ -5,11 +5,11 @@ describe Mixpanel::URI do
|
|
5
5
|
describe '.mixpanel' do
|
6
6
|
it 'should return a properly formatted mixpanel uri as a string (without an endpoint)' do
|
7
7
|
resource, params = ['events', {:c => 'see', :a => 'ey'}]
|
8
|
-
Mixpanel::URI.mixpanel(resource, params).should ==
|
8
|
+
Mixpanel::URI.mixpanel(resource, params).should == "#{Mixpanel::Client::BASE_URI}/events?a=ey&c=see"
|
9
9
|
end
|
10
10
|
it 'should return a properly formatted mixpanel uri as a string (with an endpoint)' do
|
11
11
|
resource, params = ['events/top', {:c => 'see', :a => 'ey'}]
|
12
|
-
Mixpanel::URI.mixpanel(resource, params).should ==
|
12
|
+
Mixpanel::URI.mixpanel(resource, params).should == "#{Mixpanel::Client::BASE_URI}/events/top?a=ey&c=see"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpanel_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 2.
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Keolo Keagy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-03-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -40,12 +40,12 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 61
|
44
44
|
segments:
|
45
|
-
-
|
46
|
-
- 5
|
45
|
+
- 1
|
47
46
|
- 0
|
48
|
-
|
47
|
+
- 21
|
48
|
+
version: 1.0.21
|
49
49
|
type: :development
|
50
50
|
version_requirements: *id002
|
51
51
|
- !ruby/object:Gem::Dependency
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
requirements: []
|
173
173
|
|
174
174
|
rubyforge_project: mixpanel_client
|
175
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.15
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
178
|
summary: Ruby Mixpanel API Client Library
|