mixpanel-ruby 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.rdoc +5 -0
- data/lib/mixpanel-ruby/people.rb +14 -3
- data/lib/mixpanel-ruby/version.rb +1 -1
- data/spec/mixpanel-ruby/people_spec.rb +12 -0
- metadata +2 -2
data/Readme.rdoc
CHANGED
@@ -28,6 +28,11 @@ The primary class you will use to track events is Mixpanel::Tracker. An instance
|
|
28
28
|
Mixpanel::Tracker is enough to send events directly to \Mixpanel, and get you integrated
|
29
29
|
right away.
|
30
30
|
|
31
|
+
== Additional Information
|
31
32
|
|
33
|
+
For more information please visit:
|
32
34
|
|
35
|
+
* Our Ruby API Integration page[https://mixpanel.com/help/reference/ruby#introduction]
|
36
|
+
* The usage demo[https://github.com/mixpanel/mixpanel-ruby/tree/master/demo]
|
37
|
+
* The docuemntation[http://mixpanel.github.io/mixpanel-ruby/]
|
33
38
|
|
data/lib/mixpanel-ruby/people.rb
CHANGED
@@ -89,7 +89,7 @@ module Mixpanel
|
|
89
89
|
# will be added to zero.
|
90
90
|
#
|
91
91
|
# tracker = Mixpanel::Tracker.new
|
92
|
-
# tracker.people.
|
92
|
+
# tracker.people.increment("12345", {
|
93
93
|
# 'Coins Spent' => 7,
|
94
94
|
# 'Coins Earned' => -7, # Use a negative number to subtract
|
95
95
|
# });
|
@@ -108,6 +108,17 @@ module Mixpanel
|
|
108
108
|
update(message)
|
109
109
|
end
|
110
110
|
|
111
|
+
# Convenience method- increases the value of a numeric property
|
112
|
+
# by one. Calling #plus_one(distinct_id, property_name) is the same as calling
|
113
|
+
# #increment(distinct_id, { property_name => 1 })
|
114
|
+
#
|
115
|
+
# tracker = Mixpanel::Tracker.new
|
116
|
+
# tracker.people.plus_one("12345", "Albums Released")
|
117
|
+
#
|
118
|
+
def plus_one(distinct_id, property_name, ip=nil)
|
119
|
+
increment(distinct_id, { property_name => 1 }, ip)
|
120
|
+
end
|
121
|
+
|
111
122
|
# Appends a values to the end of list-valued properties.
|
112
123
|
# If the given properties don't exist, a new list-valued
|
113
124
|
# property will be created.
|
@@ -154,7 +165,7 @@ module Mixpanel
|
|
154
165
|
update(message)
|
155
166
|
end
|
156
167
|
|
157
|
-
# Removes a property and
|
168
|
+
# Removes a property and its value from a profile.
|
158
169
|
#
|
159
170
|
# tracker = Mixpanel::Tracker.new
|
160
171
|
# tracker.people.unset("12345", "Overdue Since")
|
@@ -205,7 +216,7 @@ module Mixpanel
|
|
205
216
|
# method might be useful if you want to use very new
|
206
217
|
# or experimental features of people analytics from Ruby
|
207
218
|
# The \Mixpanel HTTP tracking API is documented at
|
208
|
-
#
|
219
|
+
# https://mixpanel.com/help/reference/http
|
209
220
|
def update(message)
|
210
221
|
message = {
|
211
222
|
'$token' => @token,
|
@@ -58,6 +58,18 @@ describe Mixpanel::People do
|
|
58
58
|
}]])
|
59
59
|
end
|
60
60
|
|
61
|
+
it 'should send an engage/add message with a value of 1' do
|
62
|
+
@people.plus_one("TEST ID", 'Albums Released')
|
63
|
+
@log.should eq([[ :profile_update, {
|
64
|
+
'$token' => 'TEST TOKEN',
|
65
|
+
'$distinct_id' => 'TEST ID',
|
66
|
+
'$time' => 76695784000,
|
67
|
+
'$add' => {
|
68
|
+
'Albums Released' => 1
|
69
|
+
}
|
70
|
+
}]])
|
71
|
+
end
|
72
|
+
|
61
73
|
it 'should send a well formed engage/append message' do
|
62
74
|
@people.append("TEST ID", { 'Albums' => 'Diamond Dogs' })
|
63
75
|
@log.should eq([[ :profile_update, {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpanel-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|