test_track_rails_client 4.0.0.alpha9 → 4.0.0.alpha10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/app/models/test_track/application_identity.rb +32 -0
- data/lib/test_track.rb +9 -1
- data/lib/test_track_rails_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca0050364986fb6ceb12563a3442cd7730e2f718
|
4
|
+
data.tar.gz: 19b0350fb87fd5cf8f572efdf10cb47788e07cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf9a7b291712fbf42947f95e7640cddfe70dcd053ebd42f173b4c3867fa350cd7e14c7f3863d40d7039f3e700d36ddc4440dba9de8815a87e66fa7196f84531
|
7
|
+
data.tar.gz: 02bb28ab4a8d73b8cbaef9d285fdea8082d005516a0369d200fa2ae404809420072e5b76068c346c04638be5b9e7816bb1d847436e781c3ed4ee26fcc38fb152
|
data/README.md
CHANGED
@@ -267,6 +267,28 @@ class User
|
|
267
267
|
test_track_identifier :myapp_user_id, :id # `id` is a column on User model which is what we're using as the identifier value in this example.
|
268
268
|
end
|
269
269
|
```
|
270
|
+
### Varying app behavior globally
|
271
|
+
|
272
|
+
The `TestTrack.app_ab` method uses an "app" identifier type to be able to globally access "Feature Gate" splits. This is useful when a visitor context is not handy, and when you don't care about visitor specific assignments.
|
273
|
+
|
274
|
+
In order to use this feature, you need to set `TestTrack.app_name`, preferably in an app initializer.
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
# config/initializers/test_track.rb
|
278
|
+
TestTrack.app_name = "MyApp"
|
279
|
+
```
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
class BackgroundWorkJob
|
283
|
+
def perform
|
284
|
+
if TestTrack.app_ab(:fancy_new_api_enabled, context: 'BackgroundWorkJob')
|
285
|
+
FancyNewApi.do_thing
|
286
|
+
else
|
287
|
+
CruftyOldApi.do_thing
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
```
|
270
292
|
|
271
293
|
## Tracking visitor logins
|
272
294
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class TestTrack::ApplicationIdentity
|
2
|
+
include Singleton
|
3
|
+
|
4
|
+
delegate :test_track_ab, to: :identity
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def app_name
|
9
|
+
raise 'must configure TestTrack.app_name on application initialization' if TestTrack.app_name.blank?
|
10
|
+
TestTrack.app_name
|
11
|
+
end
|
12
|
+
|
13
|
+
def identity
|
14
|
+
Identity.new(app_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
class Identity
|
18
|
+
include TestTrack::Identity
|
19
|
+
|
20
|
+
test_track_identifier :app_id, :app_name
|
21
|
+
|
22
|
+
def initialize(app_name)
|
23
|
+
@app_name = app_name
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :app_name
|
29
|
+
end
|
30
|
+
|
31
|
+
private_constant :Identity
|
32
|
+
end
|
data/lib/test_track.rb
CHANGED
@@ -16,7 +16,7 @@ module TestTrack
|
|
16
16
|
|
17
17
|
SERVER_ERRORS = [Faraday::ConnectionFailed, Faraday::TimeoutError, Her::Errors::RemoteServerError].freeze
|
18
18
|
|
19
|
-
mattr_accessor :enabled_override
|
19
|
+
mattr_accessor :enabled_override, :app_name
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def analytics
|
@@ -36,6 +36,10 @@ module TestTrack
|
|
36
36
|
def mixpanel
|
37
37
|
TestTrack::Analytics::MixpanelClient.new
|
38
38
|
end
|
39
|
+
|
40
|
+
def app
|
41
|
+
TestTrack::ApplicationIdentity.instance
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def update_config
|
@@ -57,4 +61,8 @@ module TestTrack
|
|
57
61
|
def enabled?
|
58
62
|
enabled_override.nil? ? !Rails.env.test? : enabled_override
|
59
63
|
end
|
64
|
+
|
65
|
+
def app_ab(split_name, context:)
|
66
|
+
app.test_track_ab(split_name, context: context)
|
67
|
+
end
|
60
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_track_rails_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.alpha10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan O'Neill
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-
|
16
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: airbrake
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- app/models/test_track/analytics/mixpanel_client.rb
|
261
261
|
- app/models/test_track/analytics/safe_wrapper.rb
|
262
262
|
- app/models/test_track/analytics_event.rb
|
263
|
+
- app/models/test_track/application_identity.rb
|
263
264
|
- app/models/test_track/assignment.rb
|
264
265
|
- app/models/test_track/config_updater.rb
|
265
266
|
- app/models/test_track/fake/split_detail.rb
|