ft_gem 3.1.0 → 3.1.1
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/shared/ft_shared.rb +5 -3
- data/lib/ft_gem/view/helpers.rb +1 -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: 8cc187fec2bd3bd0d3ccf9d8155474ab1df2b4d159f7182721358e489d1a1b26
|
4
|
+
data.tar.gz: 949d225f2cf30a87bdde4cff8d84f325f5772c19ef0cee44902a8c562992740c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767bafbc0e9aad4a588cb6fac23bab2cfd32ba59d1bb1f864fdaccc0293121511ec1ff74a9957f68bb2ad562c47745ef871aa499b7c0ab411ca0d0d222b0b538
|
7
|
+
data.tar.gz: e2dfc3d9c9cc86fa9dce15d232c1b9409eb05c971d9ec59fa8f8ab708546a490ef5d9aec8f1699e4137bf61489881755faef99b004478619c2126367a5c62c69
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class FtShared
|
2
2
|
def fetch(name:)
|
3
|
+
http_response = ''
|
3
4
|
Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do
|
4
|
-
|
5
|
+
http_response = HTTParty.get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", query: { name: name }, headers: authentication_header)
|
6
|
+
JSON.parse(http_response.to_json)['data']
|
5
7
|
end
|
6
8
|
rescue StandardError => e
|
7
|
-
Rails.logger.error "FtHelper::fetch error #{e.
|
9
|
+
Rails.logger.error "FtHelper::fetch error for #{name}\nerror: #{e.message}\nhttp_response: #{http_response}"
|
8
10
|
nil
|
9
11
|
end
|
10
12
|
|
@@ -13,7 +15,7 @@ class FtShared
|
|
13
15
|
JSON.parse(HTTParty.get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/", headers: authentication_header).to_json)['data']
|
14
16
|
end
|
15
17
|
rescue StandardError => e
|
16
|
-
Rails.logger.error "FtHelper::all_toggles error #{e.
|
18
|
+
Rails.logger.error "FtHelper::all_toggles error #{e.message}"
|
17
19
|
{}
|
18
20
|
end
|
19
21
|
|
data/lib/ft_gem/view/helpers.rb
CHANGED
@@ -7,7 +7,7 @@ module FtGem
|
|
7
7
|
whitelisted = FtShared.new.whitelisted?(url: url, whitelist_urls: toggle['attributes']['whitelist-urls'])
|
8
8
|
toggle['attributes']['percentage'].to_i == 100 && whitelisted
|
9
9
|
rescue StandardError => e
|
10
|
-
Rails.logger.error "FtHelper::status error #{e.
|
10
|
+
Rails.logger.error "FtHelper::status error #{e.message}"
|
11
11
|
false
|
12
12
|
end
|
13
13
|
end
|