ft_gem 3.1.3 → 3.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ft_gem/controllers/helpers.rb +12 -2
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 809676c332224a3afa063feb423dc9e8af915ffe37f8b5315ab45d25102fb903
|
4
|
+
data.tar.gz: c621a941075cbe797eb6286f5bf26b9d8e7abe8a1efa189369ba8a4c6336c378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee30a4db3847c8ef0bab9ddde3b547e7f38a9724896bfcd26b05588ddd72a3d94f68e207fcf3e0f6d2e512b7bec0bd3609ed5e84b47342be8eedc0406b9dbb1
|
7
|
+
data.tar.gz: 62fc8f5afb70f7c1dd15ede41201d75031e2b6f61c8c18906a5a4ee9f1ac3c00080b6d0794ce5f43766aba7e9eda3d6347d11ae11ed262fdb7ed0c914842285a
|
@@ -5,7 +5,7 @@ module FtGem
|
|
5
5
|
TOGGLE_COOKIE_NAME = 'mnft'.freeze
|
6
6
|
require 'base64'
|
7
7
|
|
8
|
-
def feature_toggle_status(name:, url: nil)
|
8
|
+
def feature_toggle_status(name:, user_id: nil, url: nil)
|
9
9
|
toggles = FtShared.new.all_toggles
|
10
10
|
update_feature_toggles(toggles: toggles)
|
11
11
|
decoded_cookie = Base64.decode64(cookies[TOGGLE_COOKIE_NAME])
|
@@ -14,7 +14,11 @@ module FtGem
|
|
14
14
|
client_percentage = calc_client_percentage(decoded_cookie: decoded_cookie, toggle_name: name)
|
15
15
|
toggle_percentage = toggles[index.to_i]['attributes']['percentage']
|
16
16
|
whitelisted = FtShared.new.whitelisted?(url: url, whitelist_urls: toggles[index.to_i]['attributes']['whitelist-urls'])
|
17
|
-
|
17
|
+
if user_id_beta(user_id: user_id, toggles: toggles, index: index)
|
18
|
+
return true && whitelisted
|
19
|
+
else
|
20
|
+
return client_percentage.to_i <= toggle_percentage.to_i && whitelisted
|
21
|
+
end
|
18
22
|
rescue StandardError => e
|
19
23
|
Rails.logger.error "FtGem::feature_toggle_status error #{e.backtrace}"
|
20
24
|
false
|
@@ -49,6 +53,12 @@ module FtGem
|
|
49
53
|
def api_feature_toggle_status(name:)
|
50
54
|
FtGem::View::Helpers.status(name: name)
|
51
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def user_id_beta(user_id: nil, toggles: nil, index: "")
|
60
|
+
user_id.present? && toggles.present? && toggles[index.to_i]['attributes']['status'] == "amber" && toggles[index.to_i]['attributes']['beta-users'].split(",").include?(user_id.to_s)
|
61
|
+
end
|
52
62
|
end
|
53
63
|
end
|
54
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ft_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Murray Catto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumsnet_jwt
|
@@ -38,8 +38,8 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
42
|
-
email:
|
41
|
+
description:
|
42
|
+
email:
|
43
43
|
executables: []
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
@@ -48,10 +48,10 @@ files:
|
|
48
48
|
- lib/ft_gem/controllers/helpers.rb
|
49
49
|
- lib/ft_gem/shared/ft_shared.rb
|
50
50
|
- lib/ft_gem/view/helpers.rb
|
51
|
-
homepage:
|
51
|
+
homepage:
|
52
52
|
licenses: []
|
53
53
|
metadata: {}
|
54
|
-
post_install_message:
|
54
|
+
post_install_message:
|
55
55
|
rdoc_options: []
|
56
56
|
require_paths:
|
57
57
|
- lib
|
@@ -66,9 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
|
70
|
-
|
71
|
-
signing_key:
|
69
|
+
rubygems_version: 3.0.8
|
70
|
+
signing_key:
|
72
71
|
specification_version: 4
|
73
72
|
summary: Client side feature toggle
|
74
73
|
test_files: []
|