ft_gem 3.2.0 → 3.2.1
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/lib/ft_gem/controllers/helpers.rb +8 -5
- data/lib/ft_gem/services/beta_service.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35400c0fa6a2f7640b62ae165101ed26afac0c10bcacdca9bc4d0adcef9b827b
|
4
|
+
data.tar.gz: c34b83cdd99f07730de5c3942cd6bcbf21ad49b72d48160824ade5f9f6e80880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 545f3a715845a5e452e6340d3d737fe23afb3843020490855c563a2e57a1e55802216ba9f05a312f2a709ee5e9ec5ee36d21aeba292f1414344afb64a6e8c4a4
|
7
|
+
data.tar.gz: c3eaf501b6837dffd80b1fd2d2455b66da2571333259c2d16e53e45c5afe7cb6203f60b283372cd20fc53fba6b20e41a05a267bfd6998d11da7f1383799fe85b
|
@@ -8,17 +8,20 @@ module FtGem
|
|
8
8
|
|
9
9
|
def feature_toggle_status(name:, user_id: nil, url: nil)
|
10
10
|
toggles = FtShared.new.all_toggles
|
11
|
-
update_feature_toggles(toggles: toggles)
|
12
|
-
decoded_cookie = Base64.decode64(cookies[TOGGLE_COOKIE_NAME])
|
13
11
|
index = toggles.index { |toggle| toggle['attributes']['name'] == name }
|
14
12
|
return false if index.nil?
|
15
|
-
|
16
|
-
toggle_percentage = toggles[index.to_i]['attributes']['percentage']
|
13
|
+
|
17
14
|
whitelisted = FtShared.new.whitelisted?(url: url, whitelist_urls: toggles[index.to_i]['attributes']['whitelist-urls'])
|
18
15
|
|
19
|
-
return true && whitelisted if FtGem::Services::BetaService.public_beta?(cookie: cookies[PUBLICBETA_COOKIE_NAME],toggles: toggles, index: index)
|
16
|
+
return true && whitelisted if FtGem::Services::BetaService.public_beta?(cookie: Base64.decode64(cookies[PUBLICBETA_COOKIE_NAME]),toggles: toggles, index: index)
|
20
17
|
return true && whitelisted if FtGem::Services::BetaService.private_beta?(user_id: user_id, toggles: toggles, index: index)
|
21
18
|
|
19
|
+
update_feature_toggles(toggles: toggles)
|
20
|
+
decoded_cookie = Base64.decode64(cookies[TOGGLE_COOKIE_NAME])
|
21
|
+
|
22
|
+
client_percentage = calc_client_percentage(decoded_cookie: decoded_cookie, toggle_name: name)
|
23
|
+
toggle_percentage = toggles[index.to_i]['attributes']['percentage']
|
24
|
+
|
22
25
|
return client_percentage.to_i <= toggle_percentage.to_i && whitelisted
|
23
26
|
rescue StandardError => e
|
24
27
|
Rails.logger.error "FtGem::feature_toggle_status error #{e.backtrace}"
|
@@ -7,6 +7,7 @@ module FtGem
|
|
7
7
|
|
8
8
|
attributes = toggles[index.to_i].dig('attributes')
|
9
9
|
|
10
|
+
Rails.logger.info("########### PRIVATE BETA status: #{attributes['status']}, include users: #{attributes['beta-users'].split(",").include?(user_id.to_s)} ################")
|
10
11
|
attributes['status'] == "privatebeta" && attributes['beta-users'].split(",").include?(user_id.to_s)
|
11
12
|
end
|
12
13
|
|
@@ -14,7 +15,9 @@ module FtGem
|
|
14
15
|
return false unless toggles.present?
|
15
16
|
|
16
17
|
attributes = toggles.dig(index.to_i, 'attributes')
|
17
|
-
|
18
|
+
|
19
|
+
Rails.logger.info("########### PUBLIC BETA cookie: #{cookie}, status: #{attributes['status']} ################")
|
20
|
+
attributes['status'] == "publicbeta" && cookie == "true"
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|