ab_panel 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ab_panel.gemspec +1 -1
- data/lib/ab_panel/controller_additions.rb +25 -5
- data/lib/ab_panel/version.rb +1 -1
- data/spec/ab_panel/controller_additions_spec.rb +4 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6384dbbb2f6f5d733852536b3eebcebff6e680
|
4
|
+
data.tar.gz: 2d5cac0f67172e2af1ac26d734d9f3dfad14a9a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca426b425a10f82474e6b3f8013bf505e06754cfc75b670c6e5cd54d0d14e5b9cea90a502ffe0113e84de3fecb9be8a5e2cfc11fb24ccf35f4de8d3c81548fd0
|
7
|
+
data.tar.gz: b8edc3524941c3e68e3b498c1693a23030f79f24844b8221c1dafbea3c120390a1f93a9106b8a6964c4930156a77f6cf3d66803361ffdba7780823862900969d
|
data/ab_panel.gemspec
CHANGED
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rspec"
|
25
25
|
spec.add_development_dependency "byebug"
|
26
26
|
|
27
|
-
spec.add_runtime_dependency "rails", '
|
27
|
+
spec.add_runtime_dependency "rails", '>= 4.0', '< 5.2'
|
28
28
|
spec.add_runtime_dependency "mixpanel"
|
29
29
|
end
|
@@ -27,8 +27,20 @@ module AbPanel
|
|
27
27
|
#
|
28
28
|
# `current_user.id` for logged in users.
|
29
29
|
def distinct_id
|
30
|
-
cookies.signed['distinct_id']
|
31
|
-
|
30
|
+
distinct_id = cookies.signed['distinct_id']
|
31
|
+
|
32
|
+
return distinct_id if distinct_id
|
33
|
+
|
34
|
+
distinct_id = (0..4).map { |i| i.even? ? ('A'..'Z').to_a[rand(26)] : rand(10) }.join
|
35
|
+
|
36
|
+
cookies.signed['distinct_id'] =
|
37
|
+
{
|
38
|
+
value: distinct_id,
|
39
|
+
httponly: true,
|
40
|
+
secure: request.ssl?
|
41
|
+
}
|
42
|
+
|
43
|
+
distinct_id
|
32
44
|
end
|
33
45
|
|
34
46
|
def ab_panel_options
|
@@ -57,9 +69,18 @@ module AbPanel
|
|
57
69
|
nil
|
58
70
|
end
|
59
71
|
|
60
|
-
cookies.signed[:ab_panel_conditions] =
|
72
|
+
cookies.signed[:ab_panel_conditions] = {
|
73
|
+
value: AbPanel.serialized_conditions,
|
74
|
+
httponly: true,
|
75
|
+
secure: request.ssl?
|
76
|
+
}
|
77
|
+
|
61
78
|
AbPanel.funnels = Set.new(cookies.signed[:ab_panel_funnels])
|
62
|
-
cookies.signed[:ab_panel_funnels] =
|
79
|
+
cookies.signed[:ab_panel_funnels] = {
|
80
|
+
value: AbPanel.funnels,
|
81
|
+
httponly: true,
|
82
|
+
secure: request.ssl?
|
83
|
+
}
|
63
84
|
|
64
85
|
{
|
65
86
|
'distinct_id' => distinct_id,
|
@@ -88,7 +109,6 @@ module AbPanel
|
|
88
109
|
|
89
110
|
options = {
|
90
111
|
distinct_id: distinct_id,
|
91
|
-
ip: request.remote_ip,
|
92
112
|
time: Time.now.utc,
|
93
113
|
}.merge(properties)
|
94
114
|
|
data/lib/ab_panel/version.rb
CHANGED
@@ -13,7 +13,10 @@ describe AbPanel::ControllerAdditions do
|
|
13
13
|
|
14
14
|
describe "#distinct_id" do
|
15
15
|
let(:cookies) { {} }
|
16
|
-
before
|
16
|
+
before do
|
17
|
+
allow(controller).to receive_message_chain(:request, :ssl?).and_return(true)
|
18
|
+
allow(controller).to receive_message_chain(:cookies, :signed).and_return(cookies)
|
19
|
+
end
|
17
20
|
subject { controller.distinct_id }
|
18
21
|
|
19
22
|
it { is_expected.to match /^([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])([A-Z]|[0-9])$/ }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ab_panel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter de Vos
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -86,16 +86,22 @@ dependencies:
|
|
86
86
|
name: rails
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - "
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '4.0'
|
92
|
+
- - "<"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '5.2'
|
92
95
|
type: :runtime
|
93
96
|
prerelease: false
|
94
97
|
version_requirements: !ruby/object:Gem::Requirement
|
95
98
|
requirements:
|
96
|
-
- - "
|
99
|
+
- - ">="
|
97
100
|
- !ruby/object:Gem::Version
|
98
101
|
version: '4.0'
|
102
|
+
- - "<"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '5.2'
|
99
105
|
- !ruby/object:Gem::Dependency
|
100
106
|
name: mixpanel
|
101
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
234
|
version: '0'
|
229
235
|
requirements: []
|
230
236
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.6.13
|
232
238
|
signing_key:
|
233
239
|
specification_version: 4
|
234
240
|
summary: Run A/B test experiments on your Rails 4+ site using Mixpanel as a backend.
|