mixpal 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +5 -0
- data/lib/mixpal/tracker.rb +2 -2
- data/lib/mixpal/util.rb +3 -1
- data/lib/mixpal/version.rb +1 -1
- data/spec/lib/mixpal/util_spec.rb +6 -1
- metadata +55 -83
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f7b06bf4a86525182d6d44a19848532e62cc51a
|
4
|
+
data.tar.gz: eb38535ae4ef5a101b61a8d30c0a4ed041c04b9d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d4079b4038dad025ca08dfaefcb1239abeacbedccb1c0c7553e1cdaa8cea64849cd03717d83cf2315ede897b85634a55d6950e6de299dbd61f3354f9d97a08d
|
7
|
+
data.tar.gz: 883548ba1bb19454caa6052e2d812efe80f09680b22b1647034865f0c885042b462d1412a37ac152ca1c2786ee89e61ea827a721f6fce11331aab1346907380f
|
data/README.md
CHANGED
@@ -7,6 +7,11 @@ events like user sign ups or form submissions.
|
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
+
First make sure you follow the instructions for installing Mixpanel's JS
|
11
|
+
library:
|
12
|
+
|
13
|
+
https://mixpanel.com/help/reference/javascript
|
14
|
+
|
10
15
|
### With Bundler
|
11
16
|
|
12
17
|
1. Add to Gemfile: `gem "mixpal"`
|
data/lib/mixpal/tracker.rb
CHANGED
@@ -32,9 +32,9 @@ module Mixpal
|
|
32
32
|
"".tap do |html|
|
33
33
|
html << "<script type=\"text/javascript\">"
|
34
34
|
html << "mixpanel.alias(\"#{identity}\");" if alias_user
|
35
|
+
html << "mixpanel.identify(\"#{identity}\");" if identity
|
35
36
|
html << events.map(&:render).join("")
|
36
37
|
html << user_updates.map(&:render).join("")
|
37
|
-
html << "mixpanel.identify(\"#{identity}\");" if identity
|
38
38
|
html << "</script>"
|
39
39
|
end.html_safe
|
40
40
|
end
|
@@ -65,4 +65,4 @@ module Mixpal
|
|
65
65
|
}
|
66
66
|
end
|
67
67
|
end
|
68
|
-
end
|
68
|
+
end
|
data/lib/mixpal/util.rb
CHANGED
@@ -2,6 +2,8 @@ module Mixpal
|
|
2
2
|
module Util
|
3
3
|
class << self
|
4
4
|
def hash_to_js_object_string(hash)
|
5
|
+
hash.reject! { |k,v| v.nil? }
|
6
|
+
|
5
7
|
contents = hash.map do |k,v|
|
6
8
|
js_value = v.is_a?(String) || v.is_a?(Time) ? "\"#{v}\"" : v
|
7
9
|
"\"#{k}\": #{js_value}"
|
@@ -11,4 +13,4 @@ module Mixpal
|
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
14
|
-
end
|
16
|
+
end
|
data/lib/mixpal/version.rb
CHANGED
@@ -18,5 +18,10 @@ describe Mixpal::Util do
|
|
18
18
|
expect(subject.hash_to_js_object_string({ age: 21 })).
|
19
19
|
to eq "{\"age\": 21}"
|
20
20
|
end
|
21
|
+
|
22
|
+
it "does not include keys with nil values" do
|
23
|
+
expect(subject.hash_to_js_object_string({ age: 21, gender: nil })).
|
24
|
+
to eq "{\"age\": 21}"
|
25
|
+
end
|
21
26
|
end
|
22
|
-
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,176 +1,155 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.4
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- patbenatar
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
prerelease: false
|
16
14
|
name: bundler
|
17
|
-
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
19
16
|
requirements:
|
20
17
|
- - ~>
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '1.3'
|
23
|
-
|
24
|
-
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
24
|
- - ~>
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '1.3'
|
29
|
-
none: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
prerelease: false
|
32
28
|
name: rake
|
33
|
-
|
34
|
-
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
35
30
|
requirements:
|
36
|
-
- -
|
31
|
+
- - '>='
|
37
32
|
- !ruby/object:Gem::Version
|
38
33
|
version: '0'
|
39
|
-
|
40
|
-
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
|
-
none: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
prerelease: false
|
48
42
|
name: pry
|
49
|
-
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
51
44
|
requirements:
|
52
|
-
- -
|
45
|
+
- - '>='
|
53
46
|
- !ruby/object:Gem::Version
|
54
47
|
version: '0'
|
55
|
-
|
56
|
-
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
|
-
none: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
prerelease: false
|
64
56
|
name: rspec
|
65
|
-
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
67
58
|
requirements:
|
68
59
|
- - ~>
|
69
60
|
- !ruby/object:Gem::Version
|
70
61
|
version: 2.14.0
|
71
|
-
|
72
|
-
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
65
|
requirements:
|
74
66
|
- - ~>
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: 2.14.0
|
77
|
-
none: false
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
prerelease: false
|
80
70
|
name: guard-rspec
|
81
|
-
|
82
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
83
72
|
requirements:
|
84
73
|
- - ~>
|
85
74
|
- !ruby/object:Gem::Version
|
86
75
|
version: 3.0.3
|
87
|
-
|
88
|
-
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
79
|
requirements:
|
90
80
|
- - ~>
|
91
81
|
- !ruby/object:Gem::Version
|
92
82
|
version: 3.0.3
|
93
|
-
none: false
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
prerelease: false
|
96
84
|
name: rb-fsevent
|
97
|
-
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
99
86
|
requirements:
|
100
87
|
- - ~>
|
101
88
|
- !ruby/object:Gem::Version
|
102
89
|
version: 0.9.3
|
103
|
-
|
104
|
-
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
93
|
requirements:
|
106
94
|
- - ~>
|
107
95
|
- !ruby/object:Gem::Version
|
108
96
|
version: 0.9.3
|
109
|
-
none: false
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
|
-
prerelease: false
|
112
98
|
name: awesome_print
|
113
|
-
|
114
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
115
100
|
requirements:
|
116
101
|
- - ~>
|
117
102
|
- !ruby/object:Gem::Version
|
118
103
|
version: 1.1.0
|
119
|
-
|
120
|
-
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - ~>
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 1.1.0
|
125
|
-
none: false
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
|
-
prerelease: false
|
128
112
|
name: nokogiri
|
129
|
-
|
130
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
131
114
|
requirements:
|
132
115
|
- - ~>
|
133
116
|
- !ruby/object:Gem::Version
|
134
117
|
version: 1.6.0
|
135
|
-
|
136
|
-
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
121
|
requirements:
|
138
122
|
- - ~>
|
139
123
|
- !ruby/object:Gem::Version
|
140
124
|
version: 1.6.0
|
141
|
-
none: false
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
|
-
prerelease: false
|
144
126
|
name: actionpack
|
145
|
-
|
146
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
147
128
|
requirements:
|
148
|
-
- -
|
129
|
+
- - '>='
|
149
130
|
- !ruby/object:Gem::Version
|
150
131
|
version: '3.0'
|
151
|
-
|
152
|
-
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
135
|
requirements:
|
154
|
-
- -
|
136
|
+
- - '>='
|
155
137
|
- !ruby/object:Gem::Version
|
156
138
|
version: '3.0'
|
157
|
-
none: false
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
|
-
prerelease: false
|
160
140
|
name: activesupport
|
161
|
-
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
163
142
|
requirements:
|
164
|
-
- -
|
143
|
+
- - '>='
|
165
144
|
- !ruby/object:Gem::Version
|
166
145
|
version: '3.0'
|
167
|
-
|
168
|
-
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
149
|
requirements:
|
170
|
-
- -
|
150
|
+
- - '>='
|
171
151
|
- !ruby/object:Gem::Version
|
172
152
|
version: '3.0'
|
173
|
-
none: false
|
174
153
|
description: Use Mixpanel's JavaScript library from your backend with ease
|
175
154
|
email:
|
176
155
|
- nick@gophilosophie.com
|
@@ -205,33 +184,26 @@ files:
|
|
205
184
|
homepage: https://github.com/patbenatar/mixpal
|
206
185
|
licenses:
|
207
186
|
- MIT
|
187
|
+
metadata: {}
|
208
188
|
post_install_message:
|
209
189
|
rdoc_options: []
|
210
190
|
require_paths:
|
211
191
|
- lib
|
212
192
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
193
|
requirements:
|
214
|
-
- -
|
194
|
+
- - '>='
|
215
195
|
- !ruby/object:Gem::Version
|
216
|
-
segments:
|
217
|
-
- 0
|
218
|
-
hash: 4327721075013694130
|
219
196
|
version: '0'
|
220
|
-
none: false
|
221
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
198
|
requirements:
|
223
|
-
- -
|
199
|
+
- - '>='
|
224
200
|
- !ruby/object:Gem::Version
|
225
|
-
segments:
|
226
|
-
- 0
|
227
|
-
hash: 4327721075013694130
|
228
201
|
version: '0'
|
229
|
-
none: false
|
230
202
|
requirements: []
|
231
203
|
rubyforge_project:
|
232
|
-
rubygems_version:
|
204
|
+
rubygems_version: 2.0.3
|
233
205
|
signing_key:
|
234
|
-
specification_version:
|
206
|
+
specification_version: 4
|
235
207
|
summary: As the JavaScript library is Mixpanel's preferred method of usage, Mixpal
|
236
208
|
aims to make it easier to work with from your Rails backend. Most notably it persists
|
237
209
|
tracking data across redirects, perfect for handling events like user sign ups or
|