ft_gem 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c87e1b362c32c626bae277df5143edae9272ecd266f35385f1357f4e160afc56
4
- data.tar.gz: 1b344e81360b00da689b46c280b9bd4e5c7e396f539dbe9164f9aaba75811d79
3
+ metadata.gz: 35400c0fa6a2f7640b62ae165101ed26afac0c10bcacdca9bc4d0adcef9b827b
4
+ data.tar.gz: c34b83cdd99f07730de5c3942cd6bcbf21ad49b72d48160824ade5f9f6e80880
5
5
  SHA512:
6
- metadata.gz: 5b130653d438520557292a204f73369a791c724a4e1063e947e63a77dc4853315bbb889049785313f0a9eabb8e8fa15570e74e523fad5178db2a6f141e0c9e24
7
- data.tar.gz: 341027d3da3318695a647480268aa71925caab0d1dfabc82b21e778cb8ada8fd2efb27ee8b8d28c37838623858c8d55c199c04c196c9925efd6b9c5d57e2a942
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
- client_percentage = calc_client_percentage(decoded_cookie: decoded_cookie, toggle_name: name)
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
- cookie == "true" && attributes['status'] == "publicbeta"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ft_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murray Catto