test_track_rails_client 0.9.20 → 1.0.0
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 +8 -8
- data/app/controllers/tt/api/v1/split_details_controller.rb +5 -0
- data/app/controllers/tt/api/v1/visitor_details_controller.rb +5 -0
- data/app/models/test_track/fake/split_detail.rb +39 -0
- data/app/models/test_track/fake/visitor_detail.rb +24 -0
- data/app/models/test_track/fake_server.rb +8 -0
- data/app/models/test_track/remote/assignment_detail.rb +24 -0
- data/app/models/test_track/remote/split_detail.rb +42 -0
- data/app/models/test_track/remote/visitor_detail.rb +23 -0
- data/app/views/tt/api/v1/split_details/show.json.jbuilder +1 -0
- data/config/routes.rb +3 -0
- data/lib/test_track_rails_client/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YjRkODQyZjM0ODM2YzM0NzFhYTE5YTU4ZWQ4YjhhYjQ0ZTg2OWQxYw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
OGViNGE1Y2NlNTM2NWVhYWI5ZjcxZmIyZGNhYTRjOTA4NTBmMDE0NA==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
OTM5YmZkYTNhNTllZmNhNWNmNzYwODM0ZmNmNzE3NTg1ZDFiYjg1MmY3Mjg2
|
|
10
|
+
Yjk5NGFmZTA0NWM2ZjhlYTFiNmNkNjc4NzA3NWE3YTdlODg3MWU4MDNjNjZj
|
|
11
|
+
YzZhYTMyNzM5NTFkNjMyYzcwZTk2Y2Y4YzdmODJkZDI2OTkwZGU=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
YzMyOWIzYmNiODcwZTI1NzZhYjg0NGY3OWUwZjRjMDExMWIzYTIxZDZhMjZi
|
|
14
|
+
NzAwNjVmYWM1MGQxNzU0MTlkYTBmNzg0ZGQ3ZDRkY2JiNWUxMzk5Y2FhZjAw
|
|
15
|
+
YTEyYjUwMjNhNTM5OTVmMzAwNWZiN2I4ZjE5NjRmYjU3YjlkMDQ=
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
class TestTrack::Fake::SplitDetail
|
|
2
|
+
attr_reader :name
|
|
3
|
+
|
|
4
|
+
def initialize(name)
|
|
5
|
+
@name = name
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def details
|
|
9
|
+
@details ||= _details
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def _details
|
|
15
|
+
{
|
|
16
|
+
name: name,
|
|
17
|
+
hypothesis: "user will interact more with blue banner",
|
|
18
|
+
location: "home screen",
|
|
19
|
+
platform: "mobile",
|
|
20
|
+
owner: "mobile team",
|
|
21
|
+
assignment_criteria: "user has mobile app",
|
|
22
|
+
description: "banner test to see if users will interact more",
|
|
23
|
+
variant_details: variant_details
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def variant_details
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
name: "first variant detail",
|
|
31
|
+
description: "red banner on homepage"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "second variant detail",
|
|
35
|
+
description: "yellow banner on homepage"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class TestTrack::Fake::VisitorDetail
|
|
2
|
+
# rubocop:disable Metrics/MethodLength
|
|
3
|
+
def self.instance
|
|
4
|
+
{
|
|
5
|
+
assignment_details: [
|
|
6
|
+
{
|
|
7
|
+
split_name: 'really_cool_feature',
|
|
8
|
+
split_location: 'Home page',
|
|
9
|
+
variant_name: 'Enabled',
|
|
10
|
+
variant_description: 'The feature is enabled',
|
|
11
|
+
assigned_at: '2017-04-11T00:00:00Z'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
split_name: 'green_button',
|
|
15
|
+
split_location: 'Sign up',
|
|
16
|
+
variant_name: 'Button green',
|
|
17
|
+
variant_description: 'That big button will be green',
|
|
18
|
+
assigned_at: '2017-04-10T00:00:00Z'
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
# rubocop:enable Metrics/MethodLength
|
|
24
|
+
end
|
|
@@ -4,10 +4,18 @@ class TestTrack::FakeServer
|
|
|
4
4
|
TestTrack::Fake::SplitRegistry.instance.splits
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
def split_details(name)
|
|
8
|
+
TestTrack::Fake::SplitDetail.new(name).details
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
def visitor
|
|
8
12
|
TestTrack::Fake::Visitor.instance
|
|
9
13
|
end
|
|
10
14
|
|
|
15
|
+
def visitor_details
|
|
16
|
+
TestTrack::Fake::VisitorDetail.instance
|
|
17
|
+
end
|
|
18
|
+
|
|
11
19
|
def assignments
|
|
12
20
|
TestTrack::Fake::Visitor.instance.assignments
|
|
13
21
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class TestTrack::Remote::AssignmentDetail
|
|
2
|
+
include TestTrack::RemoteModel
|
|
3
|
+
|
|
4
|
+
attributes :split_location, :split_name, :variant_name, :variant_description, :assigned_at
|
|
5
|
+
|
|
6
|
+
def assigned_at
|
|
7
|
+
original = super
|
|
8
|
+
if original.blank? || !original.respond_to?(:in_time_zone)
|
|
9
|
+
nil
|
|
10
|
+
else
|
|
11
|
+
original.in_time_zone rescue nil # rubocop:disable Style/RescueModifier
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.fake_instance_attributes(_)
|
|
16
|
+
{
|
|
17
|
+
split_name: 'excellent_feature',
|
|
18
|
+
split_location: 'Sign up',
|
|
19
|
+
variant_name: 'Excellent feature enabled',
|
|
20
|
+
variant_description: 'This feature is on which means something will be different.',
|
|
21
|
+
assigned_at: '2017-04-10T05:00:00Z'
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class TestTrack::Remote::SplitDetail
|
|
2
|
+
include TestTrack::RemoteModel
|
|
3
|
+
|
|
4
|
+
collection_path '/api/v1/split_details'
|
|
5
|
+
|
|
6
|
+
attributes :name, :hypothesis, :assignment_criteria, :description, :owner, :location, :platform, :variant_details
|
|
7
|
+
|
|
8
|
+
def self.from_name(name)
|
|
9
|
+
# TODO: FakeableHer needs to make this faking a feature of `get`
|
|
10
|
+
if faked?
|
|
11
|
+
new(fake_instance_attributes(name))
|
|
12
|
+
else
|
|
13
|
+
get("/api/v1/split_details/#{name}")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.fake_instance_attributes(name)
|
|
18
|
+
{
|
|
19
|
+
name: name,
|
|
20
|
+
hypothesis: "fake hypothesis",
|
|
21
|
+
assignment_criteria: "fake criteria for everyone",
|
|
22
|
+
description: "fake but still good description",
|
|
23
|
+
owner: "fake owner",
|
|
24
|
+
location: "fake activity",
|
|
25
|
+
platform: "mobile",
|
|
26
|
+
variant_details: fake_variant_details
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.fake_variant_details
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
name: "fake first variant detail",
|
|
34
|
+
description: "There are FAQ links in a sidebar"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "fake second variant detail",
|
|
38
|
+
description: "There are FAQ links in the default footer"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class TestTrack::Remote::VisitorDetail
|
|
2
|
+
include TestTrack::RemoteModel
|
|
3
|
+
|
|
4
|
+
has_many :assignment_details
|
|
5
|
+
|
|
6
|
+
def self.from_identifier(identifier_type, identifier_value)
|
|
7
|
+
# TODO: FakeableHer needs to make this faking a feature of `get`
|
|
8
|
+
if faked?
|
|
9
|
+
new(fake_instance_attributes(nil))
|
|
10
|
+
else
|
|
11
|
+
get("/api/v1/identifier_types/#{identifier_type}/identifiers/#{identifier_value}/visitor_detail")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.fake_instance_attributes(_)
|
|
16
|
+
{
|
|
17
|
+
assignment_details: [
|
|
18
|
+
TestTrack::Remote::AssignmentDetail.fake_instance_attributes(nil),
|
|
19
|
+
TestTrack::Remote::AssignmentDetail.fake_instance_attributes(nil)
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
json.(@split_detail, :name, :hypothesis, :assignment_criteria, :description, :owner, :location, :platform)
|
data/config/routes.rb
CHANGED
|
@@ -11,9 +11,12 @@ Rails.application.routes.draw do
|
|
|
11
11
|
|
|
12
12
|
resources :visitors, only: :show
|
|
13
13
|
|
|
14
|
+
resource :split_detail, only: :show
|
|
15
|
+
|
|
14
16
|
resources :identifier_types, only: [], param: :name do
|
|
15
17
|
resources :identifiers, only: [], param: :value do
|
|
16
18
|
resource :visitor, only: :show, controller: 'identifier_visitors'
|
|
19
|
+
resource :visitor_details, only: :show
|
|
17
20
|
end
|
|
18
21
|
end
|
|
19
22
|
|
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: 0.
|
|
4
|
+
version: 1.0.0
|
|
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: 2017-
|
|
16
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: rails
|
|
@@ -242,7 +242,9 @@ files:
|
|
|
242
242
|
- app/controllers/tt/api/v1/identifiers_controller.rb
|
|
243
243
|
- app/controllers/tt/api/v1/resets_controller.rb
|
|
244
244
|
- app/controllers/tt/api/v1/split_configs_controller.rb
|
|
245
|
+
- app/controllers/tt/api/v1/split_details_controller.rb
|
|
245
246
|
- app/controllers/tt/api/v1/split_registries_controller.rb
|
|
247
|
+
- app/controllers/tt/api/v1/visitor_details_controller.rb
|
|
246
248
|
- app/controllers/tt/api/v1/visitors_controller.rb
|
|
247
249
|
- app/helpers/test_track/application_helper.rb
|
|
248
250
|
- app/models/concerns/test_track/identity.rb
|
|
@@ -254,21 +256,26 @@ files:
|
|
|
254
256
|
- app/models/test_track/assignment.rb
|
|
255
257
|
- app/models/test_track/config_updater.rb
|
|
256
258
|
- app/models/test_track/create_alias_job.rb
|
|
259
|
+
- app/models/test_track/fake/split_detail.rb
|
|
257
260
|
- app/models/test_track/fake/split_registry.rb
|
|
258
261
|
- app/models/test_track/fake/visitor.rb
|
|
262
|
+
- app/models/test_track/fake/visitor_detail.rb
|
|
259
263
|
- app/models/test_track/fake_server.rb
|
|
260
264
|
- app/models/test_track/identity_session_discriminator.rb
|
|
261
265
|
- app/models/test_track/misconfiguration_notifier.rb
|
|
262
266
|
- app/models/test_track/notify_assignment_job.rb
|
|
263
267
|
- app/models/test_track/offline_session.rb
|
|
264
268
|
- app/models/test_track/remote/assignment.rb
|
|
269
|
+
- app/models/test_track/remote/assignment_detail.rb
|
|
265
270
|
- app/models/test_track/remote/assignment_event.rb
|
|
266
271
|
- app/models/test_track/remote/fake_server.rb
|
|
267
272
|
- app/models/test_track/remote/identifier.rb
|
|
268
273
|
- app/models/test_track/remote/identifier_type.rb
|
|
269
274
|
- app/models/test_track/remote/split_config.rb
|
|
275
|
+
- app/models/test_track/remote/split_detail.rb
|
|
270
276
|
- app/models/test_track/remote/split_registry.rb
|
|
271
277
|
- app/models/test_track/remote/visitor.rb
|
|
278
|
+
- app/models/test_track/remote/visitor_detail.rb
|
|
272
279
|
- app/models/test_track/session.rb
|
|
273
280
|
- app/models/test_track/unsynced_assignments_notifier.rb
|
|
274
281
|
- app/models/test_track/variant_calculator.rb
|
|
@@ -277,6 +284,7 @@ files:
|
|
|
277
284
|
- app/models/test_track/visitor_dsl.rb
|
|
278
285
|
- app/views/tt/api/v1/identifier_visitors/show.json.jbuilder
|
|
279
286
|
- app/views/tt/api/v1/identifiers/create.json.jbuilder
|
|
287
|
+
- app/views/tt/api/v1/split_details/show.json.jbuilder
|
|
280
288
|
- app/views/tt/api/v1/split_registries/show.json.jbuilder
|
|
281
289
|
- app/views/tt/api/v1/visitors/_show.json.jbuilder
|
|
282
290
|
- app/views/tt/api/v1/visitors/show.json.jbuilder
|