ft_gem 3.1.3 → 3.1.4
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 +6 -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: bd51c11b15d1f46fd98c4476c8a0d0eadbead26785f022dbae2ec1b0a661b033
|
4
|
+
data.tar.gz: 0351fb12d09f8d4ead1746247f1d1d67a41f668afc58124f4bfc22853db24ff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 329fd3295dd560e017f8cb60d8ee92c46137e89a9941d76f3359dc7b376630cd431adbba2487c1b52155719de079e7b0e97b7547c9da5caa18da4e3b19f7bedb
|
7
|
+
data.tar.gz: 240149ba279adfdeb18d357642f306d88b1ad6ba3e6e7eb90dfcf50235d3e9edb9e94cd7a1541e3044e18d7fc2c3fc3c811589dcfe8ce04664c24490af367734
|
@@ -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.present? && toggles[index.to_i]['attributes']['status'] == "amber" && toggles[index.to_i]['attributes']['beta-users'].split(",").include?(user_id.to_s))
|
18
|
+
return true
|
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
|
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.4
|
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-17 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: []
|