vero 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -4
- data/Gemfile.lock +8 -12
- data/info +122 -49
- data/lib/vero.rb +4 -1
- data/lib/vero/app.rb +1 -1
- data/lib/vero/config.rb +15 -9
- data/lib/vero/context.rb +21 -6
- data/lib/vero/railtie.rb +3 -2
- data/lib/vero/trackable.rb +8 -41
- data/lib/vero/trackable/base.rb +50 -0
- data/lib/vero/trackable/interface.rb +13 -0
- data/lib/vero/utility/logger.rb +27 -0
- data/lib/vero/version.rb +1 -1
- data/lib/vero/view_helpers/javascript.rb +42 -0
- data/spec/lib/trackable_spec.rb +97 -18
- data/spec/lib/view_helpers_spec.rb +7 -6
- data/spec/support/user_support.rb +17 -0
- data/vero.gemspec +5 -3
- metadata +55 -5
- data/lib/vero/logger.rb +0 -25
- data/lib/vero/view_helpers.rb +0 -40
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vero (0.3.
|
4
|
+
vero (0.3.2)
|
5
5
|
delayed_job
|
6
6
|
delayed_job_active_record
|
7
7
|
delayed_job_mongoid
|
@@ -38,7 +38,6 @@ GEM
|
|
38
38
|
i18n (~> 0.6)
|
39
39
|
multi_json (~> 1.0)
|
40
40
|
arel (3.0.2)
|
41
|
-
bson (1.6.4)
|
42
41
|
builder (3.0.0)
|
43
42
|
columnize (0.3.6)
|
44
43
|
debugger (1.1.3)
|
@@ -53,10 +52,9 @@ GEM
|
|
53
52
|
delayed_job_active_record (0.3.2)
|
54
53
|
activerecord (> 2.1.0)
|
55
54
|
delayed_job (~> 3.0.0)
|
56
|
-
delayed_job_mongoid (
|
55
|
+
delayed_job_mongoid (2.0.0)
|
57
56
|
delayed_job (~> 3.0)
|
58
|
-
|
59
|
-
mongoid (>= 2.0)
|
57
|
+
mongoid (~> 3.0)
|
60
58
|
diff-lcs (1.1.3)
|
61
59
|
erubis (2.7.0)
|
62
60
|
hike (1.2.1)
|
@@ -68,16 +66,14 @@ GEM
|
|
68
66
|
mime-types (~> 1.16)
|
69
67
|
treetop (~> 1.4.8)
|
70
68
|
mime-types (1.18)
|
71
|
-
|
72
|
-
bson (~> 1.6.4)
|
73
|
-
mongoid (3.0.2)
|
69
|
+
mongoid (3.0.3)
|
74
70
|
activemodel (~> 3.1)
|
75
|
-
moped (~> 1.1
|
76
|
-
origin (~> 1.0
|
71
|
+
moped (~> 1.1)
|
72
|
+
origin (~> 1.0)
|
77
73
|
tzinfo (~> 0.3.22)
|
78
|
-
moped (1.
|
74
|
+
moped (1.2.0)
|
79
75
|
multi_json (1.3.6)
|
80
|
-
origin (1.0.
|
76
|
+
origin (1.0.6)
|
81
77
|
polyglot (0.3.3)
|
82
78
|
rack (1.4.1)
|
83
79
|
rack-cache (1.2)
|
data/info
CHANGED
@@ -1,50 +1,123 @@
|
|
1
|
-
# Logfile created on 2012-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Vero:
|
10
|
-
|
11
|
-
|
12
|
-
Vero:
|
13
|
-
|
14
|
-
|
15
|
-
Vero:
|
16
|
-
|
17
|
-
|
18
|
-
Vero:
|
19
|
-
|
20
|
-
|
21
|
-
Vero:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
# Logfile created on 2012-08-12 22:31:19 +1000 by logger.rb/31641
|
2
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
3
|
+
|
4
|
+
Class: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
5
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
6
|
+
|
7
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
8
|
+
|
9
|
+
Vero::Sender: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
10
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
11
|
+
|
12
|
+
Vero::Sender: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
13
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
14
|
+
|
15
|
+
Vero::Sender: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
16
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
17
|
+
|
18
|
+
Vero::Sender: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
19
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&data[test]=1&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
20
|
+
|
21
|
+
Vero::Sender: method: Vero::API::TrackAPI, options: {"auth_token":"YWJjZDEyMzQ6ZWZnaDU2Nzg=","development_mode":true,"data":{"test":1},"event_name":"test_event","identity":{"email":"durkster@gmail.com","age":20,"_user_type":"User"}}, error: Connection refused - connect(2)
|
22
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
23
|
+
|
24
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
25
|
+
|
26
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
27
|
+
|
28
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
29
|
+
|
30
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
31
|
+
|
32
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
33
|
+
|
34
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
35
|
+
|
36
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
37
|
+
|
38
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
39
|
+
|
40
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
41
|
+
|
42
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
43
|
+
|
44
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
45
|
+
|
46
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
47
|
+
|
48
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
49
|
+
|
50
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
51
|
+
|
52
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
53
|
+
|
54
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
55
|
+
|
56
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
57
|
+
|
58
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
59
|
+
|
60
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
61
|
+
|
62
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
63
|
+
|
64
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
65
|
+
|
66
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
67
|
+
|
68
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
69
|
+
|
70
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
71
|
+
|
72
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
73
|
+
|
74
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
75
|
+
|
76
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
77
|
+
|
78
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
79
|
+
|
80
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
81
|
+
|
82
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
83
|
+
|
84
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
85
|
+
|
86
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
87
|
+
|
88
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
89
|
+
|
90
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
91
|
+
|
92
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
93
|
+
|
94
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
95
|
+
|
96
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
97
|
+
|
98
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
99
|
+
|
100
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
101
|
+
|
102
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
103
|
+
|
104
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
105
|
+
|
106
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
107
|
+
|
108
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
109
|
+
|
110
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
111
|
+
|
112
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
113
|
+
|
114
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
115
|
+
|
116
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
117
|
+
|
118
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
119
|
+
|
120
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
121
|
+
|
122
|
+
RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZWZnaDU2Nzg%3D&development_mode=true&event_name=test_event&identity[email]=durkster%40gmail.com&identity[age]=20&identity[_user_type]=User&data[test]=1", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"174", "Content-Type"=>"application/x-www-form-urlencoded"
|
50
123
|
|
data/lib/vero.rb
CHANGED
@@ -2,10 +2,13 @@ require 'rails'
|
|
2
2
|
|
3
3
|
module Vero
|
4
4
|
autoload :Config, 'vero/config'
|
5
|
-
autoload :Logger, 'vero/logger'
|
6
5
|
autoload :App, 'vero/app'
|
7
6
|
autoload :Context, 'vero/context'
|
8
7
|
autoload :Trackable, 'vero/trackable'
|
8
|
+
|
9
|
+
module Utility
|
10
|
+
autoload :Logger, 'vero/utility/logger'
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
if defined? ActiveRecord
|
data/lib/vero/app.rb
CHANGED
data/lib/vero/config.rb
CHANGED
@@ -16,12 +16,14 @@ module Vero
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def request_params
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
[:auth_token, :development_mode].inject({}) do |h, symbol|
|
20
|
+
method_name = "from_#{symbol}".to_sym
|
21
|
+
if respond_to?(symbol)
|
22
|
+
temp = send(symbol)
|
23
|
+
h[symbol] = temp unless temp.blank?
|
24
|
+
end
|
25
|
+
h
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def domain
|
@@ -29,14 +31,18 @@ module Vero
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def auth_token
|
32
|
-
return
|
34
|
+
return unless auth_token?
|
33
35
|
Base64::encode64("#{api_key}:#{secret}").gsub(/[\n ]/, '')
|
34
36
|
end
|
35
37
|
|
36
|
-
def
|
38
|
+
def auth_token?
|
37
39
|
!api_key.blank? && !secret.blank?
|
38
40
|
end
|
39
41
|
|
42
|
+
def configured?
|
43
|
+
auth_token?
|
44
|
+
end
|
45
|
+
|
40
46
|
def reset!
|
41
47
|
self.disabled = false
|
42
48
|
self.development_mode = !Rails.env.production?
|
@@ -50,7 +56,7 @@ module Vero
|
|
50
56
|
return unless attributes.is_a?(Hash)
|
51
57
|
|
52
58
|
Vero::Config.available_attributes.each do |symbol|
|
53
|
-
method_name = "#{symbol
|
59
|
+
method_name = "#{symbol}=".to_sym
|
54
60
|
self.send(method_name, attributes[symbol]) if self.respond_to?(method_name) && attributes.has_key?(symbol)
|
55
61
|
end
|
56
62
|
end
|
data/lib/vero/context.rb
CHANGED
@@ -58,24 +58,39 @@ module Vero
|
|
58
58
|
else
|
59
59
|
:post_now
|
60
60
|
end
|
61
|
-
self.send(method, "http://#{@config.domain}/api/v1/track.json", request_params)
|
61
|
+
self.send(method, "http://#{@config.domain}/api/v1/track.json", request_params, 'track')
|
62
|
+
end
|
63
|
+
|
64
|
+
def identify!
|
65
|
+
validate_configured!
|
66
|
+
|
67
|
+
data = subject.to_vero
|
68
|
+
request_params = @config.request_params
|
69
|
+
request_params.merge!({:email => data[:email], :data => data})
|
70
|
+
|
71
|
+
method = if @config.async
|
72
|
+
:post_later
|
73
|
+
else
|
74
|
+
:post_now
|
75
|
+
end
|
76
|
+
self.send(method, "http://#{@config.domain}/api/v1/user.json", request_params, 'identify!')
|
62
77
|
end
|
63
78
|
|
64
79
|
private
|
65
|
-
def post_now(url, params)
|
80
|
+
def post_now(url, params, method_name)
|
66
81
|
unless @config.disabled
|
67
82
|
Vero::Jobs::RestPostJob.new(url, params).perform
|
68
|
-
Vero::App.log(self, "method:
|
83
|
+
Vero::App.log(self, "method: #{method_name}, params: #{params.to_json}, response: job performed")
|
69
84
|
end
|
70
85
|
'success'
|
71
86
|
rescue => e
|
72
|
-
Vero::App.log(self, "method:
|
87
|
+
Vero::App.log(self, "method: #{method_name}, params: #{params.to_json} error: #{e.message}")
|
73
88
|
end
|
74
89
|
|
75
|
-
def post_later(url, params)
|
90
|
+
def post_later(url, params, method_name)
|
76
91
|
unless @config.disabled
|
77
92
|
::Delayed::Job.enqueue Vero::Jobs::RestPostJob.new(url, params)
|
78
|
-
Vero::App.log(self, "method:
|
93
|
+
Vero::App.log(self, "method: #{method_name}, params: #{params.to_json}, response: delayed job queued")
|
79
94
|
end
|
80
95
|
'success'
|
81
96
|
rescue => e
|
data/lib/vero/railtie.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
require 'vero/view_helpers'
|
1
|
+
require 'vero/view_helpers/javascript'
|
2
|
+
|
2
3
|
module Vero
|
3
4
|
class Railtie < Rails::Railtie
|
4
5
|
initializer "vero.view_helpers" do
|
5
|
-
ActionView::Base.send :include, ViewHelpers
|
6
|
+
ActionView::Base.send :include, ViewHelpers::Javascript
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/vero/trackable.rb
CHANGED
@@ -1,47 +1,14 @@
|
|
1
|
+
require 'vero/trackable/base'
|
2
|
+
require 'vero/trackable/interface'
|
3
|
+
|
1
4
|
module Vero
|
2
|
-
module Trackable
|
5
|
+
module Trackable
|
6
|
+
include Base
|
7
|
+
include Interface
|
8
|
+
|
3
9
|
def self.included(base)
|
4
10
|
@vero_trackable_map = []
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def trackable(*args)
|
10
|
-
@vero_trackable_map = case @vero_trackable_map
|
11
|
-
when Array then (@vero_trackable_map << args).flatten
|
12
|
-
else
|
13
|
-
args
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def trackable_map
|
18
|
-
@vero_trackable_map
|
19
|
-
end
|
20
|
-
|
21
|
-
def reset_trackable_map!
|
22
|
-
@vero_trackable_map = nil
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_vero
|
27
|
-
klass = self.class
|
28
|
-
result = klass.trackable_map.inject({}) do |hash, symbol|
|
29
|
-
hash[symbol] = self.send(symbol)
|
30
|
-
hash
|
31
|
-
end
|
32
|
-
|
33
|
-
result[:email] = result.delete(:email_address) if result.has_key?(:email_address)
|
34
|
-
result
|
35
|
-
end
|
36
|
-
|
37
|
-
def with_vero_context(context = {})
|
38
|
-
context = Vero::Context.new(context)
|
39
|
-
context.subject = self
|
40
|
-
context
|
41
|
-
end
|
42
|
-
|
43
|
-
def track(event_name, event_data = {})
|
44
|
-
self.with_vero_context(Vero::App.default_context).track(event_name, event_data)
|
11
|
+
base.extend(Base::ClassMethods)
|
45
12
|
end
|
46
13
|
end
|
47
14
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Vero
|
2
|
+
module Trackable
|
3
|
+
module Base
|
4
|
+
def self.included(base)
|
5
|
+
@vero_trackable_map = []
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def trackable(*args)
|
11
|
+
@vero_trackable_map = case @vero_trackable_map
|
12
|
+
when Array then (@vero_trackable_map << args).flatten
|
13
|
+
else
|
14
|
+
args
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def trackable_map
|
19
|
+
@vero_trackable_map
|
20
|
+
end
|
21
|
+
|
22
|
+
def reset_trackable_map!
|
23
|
+
@vero_trackable_map = nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_vero
|
28
|
+
klass = self.class
|
29
|
+
result = klass.trackable_map.inject({}) do |hash, symbol|
|
30
|
+
hash[symbol] = self.send(symbol)
|
31
|
+
hash
|
32
|
+
end
|
33
|
+
|
34
|
+
result[:email] = result.delete(:email_address) if result.has_key?(:email_address)
|
35
|
+
result[:_user_type] = self.class.name
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
39
|
+
def with_vero_context(context = {})
|
40
|
+
context = Vero::Context.new(context)
|
41
|
+
context.subject = self
|
42
|
+
context
|
43
|
+
end
|
44
|
+
|
45
|
+
def with_default_vero_context
|
46
|
+
with_vero_context(Vero::App.default_context)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Vero
|
2
|
+
module Utility
|
3
|
+
module Logger
|
4
|
+
def self.included(base)
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def log(object, message)
|
10
|
+
return unless Vero::App.default_context.config.logging
|
11
|
+
|
12
|
+
message = "#{object.class.name}: #{message}"
|
13
|
+
|
14
|
+
if (logger = self.logger)
|
15
|
+
logger.info(message)
|
16
|
+
else
|
17
|
+
puts(message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def logger
|
22
|
+
return Rails.logger if defined?(Rails) && Rails.logger
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/vero/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Vero
|
2
|
+
module ViewHelpers
|
3
|
+
module Javascript
|
4
|
+
def vero_javascript_tag(method = :default, context = Vero::App.default_context)
|
5
|
+
return "" unless context.configured?
|
6
|
+
config = context.config
|
7
|
+
|
8
|
+
unless [:default, :mixpanel, :kissmetrics].include?(method)
|
9
|
+
method = :default
|
10
|
+
end
|
11
|
+
|
12
|
+
method_name = method.to_s + "_vero_javascript_tag"
|
13
|
+
self.send(method_name.to_sym, config.config_params)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def default_vero_javascript_tag(options = {})
|
18
|
+
content_tag :script, {:type => "text/javascript"} do
|
19
|
+
result = "var _veroq = _veroq || [];" +
|
20
|
+
"setTimeout(function(){if(typeof window.Semblance==\"undefined\"){console.log(\"Vero did not load in time.\");for(var i=0;i<_veroq.length;i++){a=_veroq[i];if(a.length==3&&typeof a[2]==\"function\")a[2](null,false);}}},3000);" +
|
21
|
+
"_veroq.push(['init', {" +
|
22
|
+
options_to_string(options) +
|
23
|
+
"}]);" +
|
24
|
+
"(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//getvero.com/assets/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();"
|
25
|
+
result.html_safe
|
26
|
+
end.html_safe
|
27
|
+
end
|
28
|
+
|
29
|
+
def mixpanel_vero_javascript_tag(options = {})
|
30
|
+
end
|
31
|
+
|
32
|
+
def kissmetrics_vero_javascript_tag(options = {})
|
33
|
+
end
|
34
|
+
|
35
|
+
def options_to_string(options)
|
36
|
+
options = {} unless options.kind_of?(Hash)
|
37
|
+
result = options.keys.collect { |k| "\"#{k}\": \"#{options[k]}\"" }
|
38
|
+
result.join(", ")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/lib/trackable_spec.rb
CHANGED
@@ -2,14 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Vero::Trackable do
|
4
4
|
before :each do
|
5
|
-
@request_params = {
|
6
|
-
:event_name => 'test_event',
|
7
|
-
:auth_token => 'YWJjZDEyMzQ6ZWZnaDU2Nzg=',
|
8
|
-
:identity => {:email => 'durkster@gmail.com', :age => 20},
|
9
|
-
:data => { :test => 1 },
|
10
|
-
:development_mode => true
|
11
|
-
}
|
12
|
-
@url = "http://www.getvero.com/api/v1/track.json"
|
13
5
|
@user = User.new
|
14
6
|
end
|
15
7
|
|
@@ -21,7 +13,14 @@ describe Vero::Trackable do
|
|
21
13
|
describe :track do
|
22
14
|
it "should raise an error" do
|
23
15
|
@user.stub(:post_later).and_return('success')
|
24
|
-
expect { @user.track(
|
16
|
+
expect { @user.track("test_event", {}) }.to raise_error
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe :identity! do
|
21
|
+
it "should raise an error" do
|
22
|
+
@user.stub(:post_later).and_return('success')
|
23
|
+
expect { @user.identity! }.to raise_error
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -36,6 +35,17 @@ describe Vero::Trackable do
|
|
36
35
|
end
|
37
36
|
|
38
37
|
describe :track do
|
38
|
+
before do
|
39
|
+
@request_params = {
|
40
|
+
:event_name => 'test_event',
|
41
|
+
:auth_token => 'YWJjZDEyMzQ6ZWZnaDU2Nzg=',
|
42
|
+
:identity => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"},
|
43
|
+
:data => { :test => 1 },
|
44
|
+
:development_mode => true
|
45
|
+
}
|
46
|
+
@url = "http://www.getvero.com/api/v1/track.json"
|
47
|
+
end
|
48
|
+
|
39
49
|
it "should not send a track request when the required parameters are invalid" do
|
40
50
|
@user.stub(:post_now).and_return(200)
|
41
51
|
|
@@ -44,11 +54,11 @@ describe Vero::Trackable do
|
|
44
54
|
expect { @user.track('test', '') }.to raise_error
|
45
55
|
end
|
46
56
|
|
47
|
-
it "should send a track request when async is set to false" do
|
57
|
+
it "should send a `track` request when async is set to false" do
|
48
58
|
context = Vero::Context.new(Vero::App.default_context)
|
49
59
|
context.subject = @user
|
50
60
|
context.stub(:post_now).and_return(200)
|
51
|
-
context.should_receive(:post_now).with(@url, @request_params).at_least(:once)
|
61
|
+
context.should_receive(:post_now).with(@url, @request_params, "track").at_least(:once)
|
52
62
|
|
53
63
|
@user.stub(:with_vero_context).and_return(context)
|
54
64
|
|
@@ -62,7 +72,7 @@ describe Vero::Trackable do
|
|
62
72
|
context.config.async = true
|
63
73
|
|
64
74
|
context.stub(:post_later).and_return('success')
|
65
|
-
context.should_receive(:post_later).with(@url, @request_params).at_least(:once)
|
75
|
+
context.should_receive(:post_later).with(@url, @request_params, "track").at_least(:once)
|
66
76
|
|
67
77
|
@user.stub(:with_vero_context).and_return(context)
|
68
78
|
|
@@ -73,11 +83,49 @@ describe Vero::Trackable do
|
|
73
83
|
it "should not raise an error when async is set to false and the request times out" do
|
74
84
|
Rails.stub(:logger).and_return(Logger.new('info'))
|
75
85
|
|
76
|
-
context = Vero::App.default_context
|
86
|
+
context = Vero::Context.new(Vero::App.default_context)
|
77
87
|
context.config.async = false
|
78
88
|
context.config.domain = "localhost"
|
79
89
|
|
80
90
|
expect { @user.track(@request_params[:event_name], @request_params[:data]) }.to_not raise_error
|
91
|
+
|
92
|
+
context.config.domain = "www.getvero.com"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe :identify! do
|
97
|
+
before do
|
98
|
+
@request_params = {
|
99
|
+
:auth_token => 'YWJjZDEyMzQ6ZWZnaDU2Nzg=',
|
100
|
+
:data => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"},
|
101
|
+
:development_mode => true,
|
102
|
+
:email => 'durkster@gmail.com'
|
103
|
+
}
|
104
|
+
@url = "http://www.getvero.com/api/v1/user.json"
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should send an `identify` request when async is set to false" do
|
108
|
+
context = Vero::Context.new(Vero::App.default_context)
|
109
|
+
context.subject = @user
|
110
|
+
context.stub(:post_now).and_return(200)
|
111
|
+
context.should_receive(:post_now).with(@url, @request_params, "identify!").at_least(:once)
|
112
|
+
|
113
|
+
@user.stub(:with_vero_context).and_return(context)
|
114
|
+
|
115
|
+
@user.identify!.should == 200
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should create a delayed job when async is set to true" do
|
119
|
+
context = Vero::Context.new(Vero::App.default_context)
|
120
|
+
context.subject = @user
|
121
|
+
context.config.async = true
|
122
|
+
|
123
|
+
context.stub(:post_later).and_return('success')
|
124
|
+
context.should_receive(:post_later).with(@url, @request_params, "identify!").at_least(:once)
|
125
|
+
|
126
|
+
@user.stub(:with_vero_context).and_return(context)
|
127
|
+
|
128
|
+
@user.identify!.should == 'success'
|
81
129
|
end
|
82
130
|
end
|
83
131
|
|
@@ -103,17 +151,48 @@ describe Vero::Trackable do
|
|
103
151
|
|
104
152
|
describe :to_vero do
|
105
153
|
it "should return a hash of all values mapped by trackable" do
|
106
|
-
temp_params = {:email => 'durkster@gmail.com', :age => 20}
|
107
|
-
|
108
154
|
user = User.new
|
109
|
-
user.to_vero.should ==
|
155
|
+
user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "User"}
|
110
156
|
|
111
157
|
user = UserWithoutEmail.new
|
112
|
-
user.to_vero.should ==
|
158
|
+
user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutEmail"}
|
113
159
|
|
114
160
|
user = UserWithEmailAddress.new
|
115
|
-
user.to_vero.should ==
|
161
|
+
user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithEmailAddress"}
|
162
|
+
|
163
|
+
user = UserWithoutInterface.new
|
164
|
+
user.to_vero.should == {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutInterface"}
|
116
165
|
end
|
117
166
|
end
|
167
|
+
|
168
|
+
describe :with_vero_context do
|
169
|
+
it "should be able to change contexts" do
|
170
|
+
user = User.new
|
171
|
+
user.with_default_vero_context.config.config_params.should == {:api_key=>"abcd1234", :secret=>"efgh5678"}
|
172
|
+
user.with_vero_context({:api_key => "boom", :secret => "tish"}).config.config_params.should == {:api_key=>"boom", :secret=>"tish"}
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should work when Vero::Trackable::Interface is not included" do
|
177
|
+
user = UserWithoutInterface.new
|
178
|
+
|
179
|
+
request_params = {
|
180
|
+
:event_name => 'test_event',
|
181
|
+
:auth_token => 'YWJjZDEyMzQ6ZWZnaDU2Nzg=',
|
182
|
+
:identity => {:email => 'durkster@gmail.com', :age => 20, :_user_type => "UserWithoutInterface"},
|
183
|
+
:data => { :test => 1 },
|
184
|
+
:development_mode => true
|
185
|
+
}
|
186
|
+
url = "http://www.getvero.com/api/v1/track.json"
|
187
|
+
|
188
|
+
context = Vero::Context.new(Vero::App.default_context)
|
189
|
+
context.subject = user
|
190
|
+
context.stub(:post_now).and_return(200)
|
191
|
+
context.should_receive(:post_now).with(url, request_params, "track").at_least(:once)
|
192
|
+
|
193
|
+
user.stub(:with_vero_context).and_return(context)
|
194
|
+
|
195
|
+
user.vero_track(request_params[:event_name], request_params[:data]).should == 200
|
196
|
+
end
|
118
197
|
end
|
119
198
|
end
|
@@ -2,21 +2,22 @@ require 'spec_helper'
|
|
2
2
|
require 'action_view'
|
3
3
|
require 'active_support'
|
4
4
|
|
5
|
-
include Vero::ViewHelpers
|
5
|
+
include Vero::ViewHelpers::Javascript
|
6
6
|
include ActionView::Helpers
|
7
7
|
include ActionView::Context
|
8
8
|
|
9
|
-
describe Vero::ViewHelpers do
|
10
|
-
before
|
9
|
+
describe Vero::ViewHelpers::Javascript do
|
10
|
+
before do
|
11
11
|
Vero::App.reset!
|
12
12
|
end
|
13
13
|
|
14
|
+
subject { Vero::ViewHelpers::Javascript }
|
14
15
|
describe :vero_javascript_tag do
|
15
16
|
it "should return an empty string if Vero::App is not properly configured" do
|
16
|
-
|
17
|
+
subject.vero_javascript_tag.should == ""
|
17
18
|
|
18
19
|
Vero::App.init {}
|
19
|
-
|
20
|
+
subject.vero_javascript_tag.should == ""
|
20
21
|
end
|
21
22
|
|
22
23
|
context "Vero::App has been properly configured" do
|
@@ -34,7 +35,7 @@ describe Vero::ViewHelpers do
|
|
34
35
|
|
35
36
|
it "should return a properly formatted javascript snippet" do
|
36
37
|
result = "<script type=\"text/javascript\">var _veroq = _veroq || [];setTimeout(function(){if(typeof window.Semblance==\"undefined\"){console.log(\"Vero did not load in time.\");for(var i=0;i<_veroq.length;i++){a=_veroq[i];if(a.length==3&&typeof a[2]==\"function\")a[2](null,false);}}},3000);_veroq.push(['init', {\"api_key\": \"#{@api_key}\", \"secret\": \"#{@api_secret}\"}]);(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//getvero.com/assets/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();</script>"
|
37
|
-
|
38
|
+
subject.vero_javascript_tag.should == result
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
@@ -39,4 +39,21 @@ class UserWithEmailAddress
|
|
39
39
|
def age
|
40
40
|
20
|
41
41
|
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class UserWithoutInterface
|
45
|
+
include Vero::Trackable::Base
|
46
|
+
trackable :email_address, :age
|
47
|
+
|
48
|
+
def email_address
|
49
|
+
'durkster@gmail.com'
|
50
|
+
end
|
51
|
+
|
52
|
+
def age
|
53
|
+
20
|
54
|
+
end
|
55
|
+
|
56
|
+
def vero_track(event_name, event_data)
|
57
|
+
with_default_vero_context.track(event_name, event_data)
|
58
|
+
end
|
42
59
|
end
|
data/vero.gemspec
CHANGED
@@ -6,13 +6,16 @@ require "vero/version"
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "vero"
|
8
8
|
s.version = Vero::VERSION.dup
|
9
|
-
s.date = "
|
9
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
10
10
|
s.summary = "Rails 3.x gem for Vero"
|
11
11
|
s.email = "support@getvero.com"
|
12
|
-
s.homepage = "http://getvero.com/"
|
12
|
+
s.homepage = "http://www.getvero.com/"
|
13
13
|
s.authors = ['James Lamont']
|
14
14
|
|
15
15
|
dependencies = [
|
16
|
+
[:development, 'rails'],
|
17
|
+
[:development, 'debugger'],
|
18
|
+
[:development, 'rspec'],
|
16
19
|
[:runtime, 'rest-client'],
|
17
20
|
[:runtime, 'delayed_job'],
|
18
21
|
[:runtime, 'delayed_job_active_record'],
|
@@ -24,7 +27,6 @@ Gem::Specification.new do |s|
|
|
24
27
|
s.executables = Dir['bin/*'].map { |f| File.basename(f) }
|
25
28
|
s.require_paths = ["lib"]
|
26
29
|
|
27
|
-
|
28
30
|
## Make sure you can build the gem on older versions of RubyGems too:
|
29
31
|
s.rubygems_version = "1.8.23"
|
30
32
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vero
|
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,8 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: debugger
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
14
62
|
- !ruby/object:Gem::Dependency
|
15
63
|
name: rest-client
|
16
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,11 +137,13 @@ files:
|
|
89
137
|
- lib/vero/config.rb
|
90
138
|
- lib/vero/context.rb
|
91
139
|
- lib/vero/jobs/rest_post_job.rb
|
92
|
-
- lib/vero/logger.rb
|
93
140
|
- lib/vero/railtie.rb
|
141
|
+
- lib/vero/trackable/base.rb
|
142
|
+
- lib/vero/trackable/interface.rb
|
94
143
|
- lib/vero/trackable.rb
|
144
|
+
- lib/vero/utility/logger.rb
|
95
145
|
- lib/vero/version.rb
|
96
|
-
- lib/vero/view_helpers.rb
|
146
|
+
- lib/vero/view_helpers/javascript.rb
|
97
147
|
- lib/vero.rb
|
98
148
|
- README.markdown
|
99
149
|
- spec/lib/app_spec.rb
|
@@ -105,7 +155,7 @@ files:
|
|
105
155
|
- spec/support/user_support.rb
|
106
156
|
- spec/support/vero_user_support.rb
|
107
157
|
- vero.gemspec
|
108
|
-
homepage: http://getvero.com/
|
158
|
+
homepage: http://www.getvero.com/
|
109
159
|
licenses: []
|
110
160
|
post_install_message:
|
111
161
|
rdoc_options: []
|
data/lib/vero/logger.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Vero
|
2
|
-
module Logger
|
3
|
-
def self.included(base)
|
4
|
-
base.extend(ClassMethods)
|
5
|
-
end
|
6
|
-
|
7
|
-
module ClassMethods
|
8
|
-
def log(object, message)
|
9
|
-
return unless Vero::App.default_context.config.logging
|
10
|
-
|
11
|
-
message = "#{object.class.name}: #{message}"
|
12
|
-
|
13
|
-
if (logger = self.logger)
|
14
|
-
logger.info(message)
|
15
|
-
else
|
16
|
-
puts(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def logger
|
21
|
-
defined?(Rails) && Rails.logger ? Rails.logger : nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/vero/view_helpers.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module Vero
|
2
|
-
module ViewHelpers
|
3
|
-
def vero_javascript_tag(method = :default, context = Vero::App.default_context)
|
4
|
-
return "" unless context.configured?
|
5
|
-
config = context.config
|
6
|
-
|
7
|
-
unless [:default, :mixpanel, :kissmetrics].include?(method)
|
8
|
-
method = :default
|
9
|
-
end
|
10
|
-
|
11
|
-
method_name = method.to_s + "_vero_javascript_tag"
|
12
|
-
self.send(method_name.to_sym, config.config_params)
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def default_vero_javascript_tag(options = {})
|
17
|
-
content_tag :script, {:type => "text/javascript"} do
|
18
|
-
result = "var _veroq = _veroq || [];" +
|
19
|
-
"setTimeout(function(){if(typeof window.Semblance==\"undefined\"){console.log(\"Vero did not load in time.\");for(var i=0;i<_veroq.length;i++){a=_veroq[i];if(a.length==3&&typeof a[2]==\"function\")a[2](null,false);}}},3000);" +
|
20
|
-
"_veroq.push(['init', {" +
|
21
|
-
options_to_string(options) +
|
22
|
-
"}]);" +
|
23
|
-
"(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//getvero.com/assets/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();"
|
24
|
-
result.html_safe
|
25
|
-
end.html_safe
|
26
|
-
end
|
27
|
-
|
28
|
-
def mixpanel_vero_javascript_tag(options = {})
|
29
|
-
end
|
30
|
-
|
31
|
-
def kissmetrics_vero_javascript_tag(options = {})
|
32
|
-
end
|
33
|
-
|
34
|
-
def options_to_string(options)
|
35
|
-
options = {} unless options.kind_of?(Hash)
|
36
|
-
result = options.keys.collect { |k| "\"#{k}\": \"#{options[k]}\"" }
|
37
|
-
result.join(", ")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|