mixpanel 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/lib/mixpanel/tracker.rb +7 -1
- data/mixpanel.gemspec +1 -1
- data/spec/mixpanel/tracker_spec.rb +10 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -112,3 +112,4 @@ All collaborations are welcome to this project, please fork and make a pull requ
|
|
112
112
|
* {Logan Bowers}[https://github.com/loganb]
|
113
113
|
* {jakemack}[https://github.com/jakemack]
|
114
114
|
* {James Ferguson}[https://github.com/JamesFerguson]
|
115
|
+
* {Brad Wilson}[https://github.com/bradx3]
|
data/lib/mixpanel/tracker.rb
CHANGED
@@ -29,7 +29,13 @@ module Mixpanel
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def ip
|
32
|
-
@env.has_key?("
|
32
|
+
if @env.has_key?("HTTP_X_FORWARDED_FOR")
|
33
|
+
@env["HTTP_X_FORWARDED_FOR"].split(",").last
|
34
|
+
elsif @env.has_key?("REMOTE_ADDR")
|
35
|
+
@env["REMOTE_ADDR"]
|
36
|
+
else
|
37
|
+
""
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
def queue
|
data/mixpanel.gemspec
CHANGED
@@ -2,7 +2,7 @@ files = ['README.rdoc', 'LICENSE', 'Rakefile', 'mixpanel.gemspec', '{spec,lib}/*
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = "mixpanel"
|
5
|
-
s.version = "1.1.
|
5
|
+
s.version = "1.1.2"
|
6
6
|
s.rubyforge_project = "mixpanel"
|
7
7
|
s.description = "Simple lib to track events in Mixpanel service. It can be used in any rack based framework."
|
8
8
|
s.author = "Alvaro Gil"
|
@@ -26,12 +26,21 @@ describe Mixpanel::Tracker do
|
|
26
26
|
@mixpanel.track_event("Sign up").should == true
|
27
27
|
end
|
28
28
|
|
29
|
-
it "should call request method with token and
|
29
|
+
it "should call request method with token, time value and ip address" do
|
30
30
|
params = {:event => "Sign up", :properties => {:token => MIX_PANEL_TOKEN, :time => Time.now.utc.to_i, :ip => "127.0.0.1"}}
|
31
31
|
|
32
32
|
@mixpanel.should_receive(:request).with(params).and_return("1")
|
33
33
|
@mixpanel.track_event("Sign up").should == true
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should call request method with token, and send ip address from HTTP_X_FORWARDED_FOR" do
|
37
|
+
@mixpanel = Mixpanel::Tracker.new(MIX_PANEL_TOKEN, @env = {"HTTP_X_FORWARDED_FOR" => "10.1.0.2"})
|
38
|
+
|
39
|
+
params = {:event => "Sign up", :properties => {:token => MIX_PANEL_TOKEN, :time => Time.now.utc.to_i, :ip => "10.1.0.2"}}
|
40
|
+
|
41
|
+
@mixpanel.should_receive(:request).with(params).and_return("1")
|
42
|
+
@mixpanel.track_event("Sign up")
|
43
|
+
end
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 2
|
9
|
+
version: 1.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alvaro Gil
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2012-01-09 00:00:00 -02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|