vero 0.3.2 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,50 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vero (0.3.2)
4
+ vero (0.4)
5
5
  delayed_job
6
6
  delayed_job_active_record
7
7
  delayed_job_mongoid
8
+ girl_friday
8
9
  rest-client
9
10
 
10
11
  GEM
11
12
  remote: http://rubygems.org/
12
13
  specs:
13
- actionmailer (3.2.5)
14
- actionpack (= 3.2.5)
14
+ actionmailer (3.2.8)
15
+ actionpack (= 3.2.8)
15
16
  mail (~> 2.4.4)
16
- actionpack (3.2.5)
17
- activemodel (= 3.2.5)
18
- activesupport (= 3.2.5)
17
+ actionpack (3.2.8)
18
+ activemodel (= 3.2.8)
19
+ activesupport (= 3.2.8)
19
20
  builder (~> 3.0.0)
20
21
  erubis (~> 2.7.0)
21
- journey (~> 1.0.1)
22
+ journey (~> 1.0.4)
22
23
  rack (~> 1.4.0)
23
24
  rack-cache (~> 1.2)
24
25
  rack-test (~> 0.6.1)
25
26
  sprockets (~> 2.1.3)
26
- activemodel (3.2.5)
27
- activesupport (= 3.2.5)
27
+ activemodel (3.2.8)
28
+ activesupport (= 3.2.8)
28
29
  builder (~> 3.0.0)
29
- activerecord (3.2.5)
30
- activemodel (= 3.2.5)
31
- activesupport (= 3.2.5)
30
+ activerecord (3.2.8)
31
+ activemodel (= 3.2.8)
32
+ activesupport (= 3.2.8)
32
33
  arel (~> 3.0.2)
33
34
  tzinfo (~> 0.3.29)
34
- activeresource (3.2.5)
35
- activemodel (= 3.2.5)
36
- activesupport (= 3.2.5)
37
- activesupport (3.2.5)
35
+ activeresource (3.2.8)
36
+ activemodel (= 3.2.8)
37
+ activesupport (= 3.2.8)
38
+ activesupport (3.2.8)
38
39
  i18n (~> 0.6)
39
40
  multi_json (~> 1.0)
40
41
  arel (3.0.2)
41
- builder (3.0.0)
42
+ builder (3.0.3)
42
43
  columnize (0.3.6)
43
- debugger (1.1.3)
44
+ connection_pool (0.9.2)
45
+ debugger (1.2.0)
44
46
  columnize (>= 0.3.1)
45
47
  debugger-linecache (~> 1.1.1)
46
- debugger-ruby_core_source (~> 1.1.2)
47
- debugger-linecache (1.1.1)
48
+ debugger-ruby_core_source (~> 1.1.3)
49
+ debugger-linecache (1.1.2)
48
50
  debugger-ruby_core_source (>= 1.1.1)
49
51
  debugger-ruby_core_source (1.1.3)
50
52
  delayed_job (3.0.3)
@@ -57,23 +59,25 @@ GEM
57
59
  mongoid (~> 3.0)
58
60
  diff-lcs (1.1.3)
59
61
  erubis (2.7.0)
62
+ girl_friday (0.10.0)
63
+ connection_pool (~> 0.9.0)
60
64
  hike (1.2.1)
61
- i18n (0.6.0)
62
- journey (1.0.3)
63
- json (1.7.3)
65
+ i18n (0.6.1)
66
+ journey (1.0.4)
67
+ json (1.7.5)
64
68
  mail (2.4.4)
65
69
  i18n (>= 0.4.0)
66
70
  mime-types (~> 1.16)
67
71
  treetop (~> 1.4.8)
68
- mime-types (1.18)
69
- mongoid (3.0.3)
72
+ mime-types (1.19)
73
+ mongoid (3.0.6)
70
74
  activemodel (~> 3.1)
71
75
  moped (~> 1.1)
72
76
  origin (~> 1.0)
73
77
  tzinfo (~> 0.3.22)
74
- moped (1.2.0)
78
+ moped (1.2.5)
75
79
  multi_json (1.3.6)
76
- origin (1.0.6)
80
+ origin (1.0.9)
77
81
  polyglot (0.3.3)
78
82
  rack (1.4.1)
79
83
  rack-cache (1.2)
@@ -82,17 +86,17 @@ GEM
82
86
  rack
83
87
  rack-test (0.6.1)
84
88
  rack (>= 1.0)
85
- rails (3.2.5)
86
- actionmailer (= 3.2.5)
87
- actionpack (= 3.2.5)
88
- activerecord (= 3.2.5)
89
- activeresource (= 3.2.5)
90
- activesupport (= 3.2.5)
89
+ rails (3.2.8)
90
+ actionmailer (= 3.2.8)
91
+ actionpack (= 3.2.8)
92
+ activerecord (= 3.2.8)
93
+ activeresource (= 3.2.8)
94
+ activesupport (= 3.2.8)
91
95
  bundler (~> 1.0)
92
- railties (= 3.2.5)
93
- railties (3.2.5)
94
- actionpack (= 3.2.5)
95
- activesupport (= 3.2.5)
96
+ railties (= 3.2.8)
97
+ railties (3.2.8)
98
+ actionpack (= 3.2.8)
99
+ activesupport (= 3.2.8)
96
100
  rack-ssl (~> 1.3.2)
97
101
  rake (>= 0.8.7)
98
102
  rdoc (~> 3.4)
@@ -102,19 +106,19 @@ GEM
102
106
  json (~> 1.4)
103
107
  rest-client (1.6.7)
104
108
  mime-types (>= 1.16)
105
- rspec (2.10.0)
106
- rspec-core (~> 2.10.0)
107
- rspec-expectations (~> 2.10.0)
108
- rspec-mocks (~> 2.10.0)
109
- rspec-core (2.10.1)
110
- rspec-expectations (2.10.0)
109
+ rspec (2.11.0)
110
+ rspec-core (~> 2.11.0)
111
+ rspec-expectations (~> 2.11.0)
112
+ rspec-mocks (~> 2.11.0)
113
+ rspec-core (2.11.1)
114
+ rspec-expectations (2.11.3)
111
115
  diff-lcs (~> 1.1.3)
112
- rspec-mocks (2.10.1)
116
+ rspec-mocks (2.11.3)
113
117
  sprockets (2.1.3)
114
118
  hike (~> 1.2)
115
119
  rack (~> 1.0)
116
120
  tilt (~> 1.1, != 1.3.0)
117
- thor (0.15.2)
121
+ thor (0.16.0)
118
122
  tilt (1.3.3)
119
123
  treetop (1.4.10)
120
124
  polyglot
data/README.markdown CHANGED
@@ -24,9 +24,11 @@ Create a [Vero account](http://getvero.com). Create an initializer in your confi
24
24
 
25
25
  You will be able to find your API key and secret by logging into Vero and clicking the 'Account' button at the top of the page.
26
26
 
27
- By default, events are sent asynchronously using DelayedJob. To force all events to be sent synchronously, add the following line to your initializer:
27
+ By default, events are sent asynchronously using DelayedJob. We do however offer a few alternatives:
28
28
 
29
- config.async = false
29
+ config.async = :none # Synchronously
30
+ config.async = :thread # Background thread
31
+ config.async = :delayed_job # DelayedJob (default)
30
32
 
31
33
  ## Setup tracking
32
34
 
data/info CHANGED
@@ -121,3 +121,99 @@ RestClient.post "http://localhost/api/v1/track.json", "auth_token=YWJjZDEyMzQ6ZW
121
121
 
122
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"
123
123
 
124
+ 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"
125
+
126
+ 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"
127
+
128
+ # => 404 NotFound | text/html 49 bytes
129
+
130
+ 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"
131
+
132
+ # => 404 NotFound | text/html 49 bytes
133
+
134
+ 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"
135
+
136
+ # => 404 NotFound | text/html 49 bytes
137
+
138
+ 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"
139
+
140
+ # => 404 NotFound | text/html 49 bytes
141
+
142
+ 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"
143
+
144
+ # => 404 NotFound | text/html 49 bytes
145
+
146
+ 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"
147
+
148
+ # => 404 NotFound | text/html 49 bytes
149
+
150
+ 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: 404 Resource Not Found
151
+ 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"
152
+
153
+ # => 404 NotFound | text/html 49 bytes
154
+
155
+ 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: 404 Resource Not Found
156
+ 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"
157
+
158
+ # => 404 NotFound | text/html 49 bytes
159
+
160
+ 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: 404 Resource Not Found
161
+ 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"
162
+
163
+ # => 404 NotFound | text/html 49 bytes
164
+
165
+ 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: 404 Resource Not Found
166
+ 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"
167
+
168
+ # => 404 NotFound | text/html 49 bytes
169
+
170
+ 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: 404 Resource Not Found
171
+ 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"
172
+
173
+ # => 404 NotFound | text/html 49 bytes
174
+
175
+ 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: 404 Resource Not Found
176
+ 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"
177
+
178
+ # => 404 NotFound | text/html 49 bytes
179
+
180
+ 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: 404 Resource Not Found
181
+ 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"
182
+
183
+ # => 404 NotFound | text/html 49 bytes
184
+
185
+ 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: 404 Resource Not Found
186
+ 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"
187
+
188
+ # => 404 NotFound | text/html 49 bytes
189
+
190
+ 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: 404 Resource Not Found
191
+ 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"
192
+
193
+ # => 404 NotFound | text/html 49 bytes
194
+
195
+ 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: 404 Resource Not Found
196
+ 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"
197
+
198
+ # => 404 NotFound | text/html 49 bytes
199
+
200
+ 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: 404 Resource Not Found
201
+ RestClient.post "http://200.200.200.200/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"
202
+
203
+ RestClient.post "http://200.200.200.200/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"
204
+
205
+ RestClient.post "http://200.200.200.200/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"
206
+
207
+ 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: Address already in use - connect(2)
208
+ RestClient.post "http://200.200.200.200/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"
209
+
210
+ 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: Address already in use - connect(2)
211
+ RestClient.post "http://200.200.200.200/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"
212
+
213
+ 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: Address already in use - connect(2)
214
+ RestClient.post "http://200.200.200.200/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"
215
+
216
+ 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: Address already in use - connect(2)
217
+ RestClient.post "http://200.200.200.200/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"
218
+
219
+ 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: Address already in use - connect(2)
data/lib/vero.rb CHANGED
@@ -1,14 +1,37 @@
1
1
  require 'rails'
2
+ require 'rest-client'
2
3
 
3
4
  module Vero
4
- autoload :Config, 'vero/config'
5
- autoload :App, 'vero/app'
6
- autoload :Context, 'vero/context'
7
- autoload :Trackable, 'vero/trackable'
5
+ autoload :Config, 'vero/config'
6
+ autoload :App, 'vero/app'
7
+ autoload :Context, 'vero/context'
8
+ autoload :Trackable, 'vero/trackable'
9
+
10
+ module API
11
+ autoload :BaseAPI, 'vero/api/base_api'
8
12
 
13
+ module Events
14
+ autoload :TrackAPI, 'vero/api/events/track_api'
15
+ end
16
+
17
+ module Users
18
+ autoload :TrackAPI, 'vero/api/users/track_api'
19
+ autoload :EditAPI, 'vero/api/users/edit_api'
20
+ autoload :EditTagsAPI, 'vero/api/users/edit_tags_api'
21
+ autoload :UnsubscribeAPI, 'vero/api/users/unsubscribe_api'
22
+ end
23
+ end
24
+
9
25
  module Utility
10
- autoload :Logger, 'vero/utility/logger'
26
+ autoload :Logger, 'vero/utility/logger'
27
+ end
28
+
29
+ module Senders
30
+ autoload :Base, 'vero/senders/base'
31
+ autoload :DelayedJob, 'vero/senders/delayed_job'
32
+ autoload :Thread, 'vero/senders/thread'
11
33
  end
34
+ autoload :Sender, 'vero/sender'
12
35
  end
13
36
 
14
37
  if defined? ActiveRecord
@@ -0,0 +1,48 @@
1
+ require 'json'
2
+ require 'delayed_job'
3
+ require 'rest-client'
4
+
5
+ module Vero
6
+ module API
7
+ class BaseAPI
8
+ attr_accessor :domain, :options
9
+
10
+ def self.perform(domain, options)
11
+ caller = self.new(domain, options)
12
+ caller.perform
13
+ end
14
+
15
+ def initialize(domain, options)
16
+ @domain = domain
17
+ @options = options
18
+ setup_logging
19
+ end
20
+
21
+ def perform
22
+ validate!
23
+ request
24
+ end
25
+
26
+ protected
27
+ def setup_logging
28
+ return unless Vero::App.logger
29
+
30
+ RestClient.log = Object.new.tap do |proxy|
31
+ def proxy.<<(message)
32
+ Vero::App.logger.info message
33
+ end
34
+ end
35
+ end
36
+
37
+ def url
38
+ end
39
+
40
+ def validate!
41
+ raise "#{self.class.name}#validate! should be overridden"
42
+ end
43
+
44
+ def request
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,25 @@
1
+ module Vero
2
+ module API
3
+ module Events
4
+ class TrackAPI < BaseAPI
5
+ def url
6
+ "#{@domain}/api/v2/events/track.json"
7
+ end
8
+
9
+ def request
10
+ RestClient.post(self.url, @options)
11
+ end
12
+
13
+ def validate!
14
+ result = true
15
+ result &&= options[:event_name].to_s.blank? == false
16
+ result &&= (options[:data].nil? || options[:data].is_a?(Hash))
17
+
18
+ unless result
19
+ raise ArgumentError.new(:event_name => options[:event_name], :data => options[:data])
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module Vero
2
+ module API
3
+ module Users
4
+ class EditAPI < BaseAPI
5
+ def url
6
+ "#{@domain}/api/v2/users/edit.json"
7
+ end
8
+
9
+ def request
10
+ RestClient.put(url, @options)
11
+ end
12
+
13
+ def validate!
14
+ result = true
15
+ result &&= options[:email].to_s.blank? == false
16
+ result &&= options[:changes].is_a?(Hash)
17
+
18
+ unless result
19
+ raise ArgumentError.new(:email => options[:email], :changes => options[:changes])
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module Vero
2
+ module API
3
+ module Users
4
+ class EditTagsAPI < BaseAPI
5
+ def url
6
+ "#{@domain}/api/v2/users/tags/edit.json"
7
+ end
8
+
9
+ def request
10
+ RestClient.put(url, @options)
11
+ end
12
+
13
+ def validate!
14
+ result = true
15
+ result &&= options[:email].to_s.blank? == false
16
+ result &&= (options[:add].is_a?(Array) || options[:remove].is_a?(Array))
17
+
18
+ unless result
19
+ raise ArgumentError.new(:email => options[:email], :add => options[:add], :remove => options[:remove])
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end