ft_gem 3.1.11 → 3.2.2

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: d64498a7f6859d6d51e064192b7812c5b3f3c1d5a7b4b09dfa2f08534fde4dbb
4
- data.tar.gz: d1581653b1cd5fbe017ffac77557f68225b09a4d3264163f8de9b4299b258c8c
3
+ metadata.gz: 0a388bf5a96a2c5baec8e883e0438dbd0e7ec62f55fe37187e7e2c4034b25b58
4
+ data.tar.gz: e1d8d9f3ced0ec3429fc2ceae552a29f8ffee33ee88f760e6f0d2f7e313ed820
5
5
  SHA512:
6
- metadata.gz: dd3b8045267e02895e7b0941247ccf9c2de810cee6917b5669c75b420feef27140321c1882bf2f23e2ac279e1aafc90fb4c8272e150fd8fe1292251e43b269b7
7
- data.tar.gz: 4eeb5c92e619c3305a9fc73fec4f2aa86222bae5da0e8f402458e160923e0b491f7fd592d7a68879c968530a0dbe396967d30b24df5ef8493055ac75495839ce
6
+ metadata.gz: 329f36b475d2d6ada6f46e271f4808a06d0d93698f234b1e7d8c35919acf4bf2d39afd021f2e83350d9b20826e35154e18b14a4a8b672640123fdc4f984bccb4
7
+ data.tar.gz: 4bd56b5a27dee8f04b3fe4668f6b323f80258ba45e2d73a20e810afe25da44aca06fea7cfca5ee084dc91990ca9ac0df3e6126510bb443497e30067526c31d29
@@ -8,16 +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'])
15
+ return false unless whitelisted
16
+
17
+ return true if FtGem::Services::BetaService.public_beta?(cookie: "false",toggles: toggles, index: index)
18
+ return true if FtGem::Services::BetaService.private_beta?(user_id: user_id, toggles: toggles, index: index)
18
19
 
19
- return true && whitelisted if FtGem::Services::BetaService.public_beta(cookie: Base64.decode64(cookies[PUBLICBETA_COOKIE_NAME]),toggles: toggles, index: index)
20
- return true && whitelisted if FtGem::Services::BetaService.private_beta(user_id: user_id, toggles: toggles, index: index)
20
+ update_feature_toggles(toggles: toggles)
21
+ decoded_cookie = Base64.decode64(cookies[TOGGLE_COOKIE_NAME])
22
+
23
+ client_percentage = calc_client_percentage(decoded_cookie: decoded_cookie, toggle_name: name)
24
+ toggle_percentage = toggles[index.to_i]['attributes']['percentage']
21
25
 
22
26
  return client_percentage.to_i <= toggle_percentage.to_i && whitelisted
23
27
  rescue StandardError => e
@@ -5,8 +5,9 @@ module FtGem
5
5
  return false unless user_id.present?
6
6
  return false unless toggles.present?
7
7
 
8
- attributes = toggles.dig(index.to_i, 'attributes')
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'] == "privatebeta"
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.1.11
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murray Catto