ft_gem 1.0.6 → 1.0.7
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.rb +2 -2
- data/lib/ft_helper.rb +28 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f53ba87b3c84b6a69b5730ed58228c8b9e96c94dee883ea6d8d24c4cbad0228d
|
4
|
+
data.tar.gz: e7eee44e162620733a2d69c398d28152f9ac213794571e3db6e72253f0cd43e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff91350dd1b81bb8e254e27c4e3293f34200062670704ccf5c14230b5a42b770d73f2d23ff57885cbad4018e291585b5b044173c243a3cff545c296c67c608a
|
7
|
+
data.tar.gz: 648058b921fd748f9c48af516eca0c205a80c204f9cc3acaaad47c71ff5e6f6f15dd38592cd2ab98236101addd4b6570417a6bacbc0d04eaa3fc6dda23232807
|
data/lib/ft_gem.rb
CHANGED
@@ -44,7 +44,7 @@ module FTGem
|
|
44
44
|
toggle['feature_toggle']['toggle_percentage'].to_i == 100
|
45
45
|
rescue StandardError => e
|
46
46
|
puts "FTApiGem error #{e}"
|
47
|
-
puts
|
47
|
+
puts 'Method: api_feature_toggle_status'
|
48
48
|
false
|
49
49
|
end
|
50
50
|
|
@@ -54,7 +54,7 @@ module FTGem
|
|
54
54
|
end
|
55
55
|
rescue StandardError => e
|
56
56
|
puts "FTApiGem error #{e}"
|
57
|
-
puts
|
57
|
+
puts 'Method: api_fetch_feature_toggle'
|
58
58
|
nil
|
59
59
|
end
|
60
60
|
|
data/lib/ft_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module FTHelper
|
2
|
+
class <<self
|
3
|
+
def status(name:)
|
4
|
+
toggle = fetch(name: name)
|
5
|
+
toggle['feature_toggle']['toggle_percentage'].to_i == 100
|
6
|
+
rescue StandardError => e
|
7
|
+
puts "FTApiGem error #{e}"
|
8
|
+
puts 'Method: api_feature_toggle_status'
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def fetch(name:)
|
15
|
+
Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do
|
16
|
+
JSON.parse(HTTP.headers(authentication_header).get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", params: { name: name }).body.to_s)
|
17
|
+
end
|
18
|
+
rescue StandardError => e
|
19
|
+
puts "FTApiGem error #{e}"
|
20
|
+
puts 'Method: api_fetch_feature_toggle'
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def authentication_header
|
25
|
+
{ Authorization: "Bearer #{MumsnetJWT.tokenify}" }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
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: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Murray Catto
|
@@ -31,6 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/ft_gem.rb
|
34
|
+
- lib/ft_helper.rb
|
34
35
|
homepage:
|
35
36
|
licenses: []
|
36
37
|
metadata: {}
|