ft_gem 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ft_gem_api.rb +19 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ed926b83f2d49f69e2ad11b79814cda9138617f8421d5a4f9ee3a8354027312
4
- data.tar.gz: 50bb063ae32ed2da6bf81c9304b52c79bdee4ad25f9d40a781307430141fa0d6
3
+ metadata.gz: a6ede7ab69a4b02afa727673767f0f3df8c45aa6c19bc4f65ca8d0bb8f840aea
4
+ data.tar.gz: 236e7d8ed28bdc9f15e3d6748bbf80238f82825d3d9cd612afe9f86edcf539a3
5
5
  SHA512:
6
- metadata.gz: 3f90f19ed9622e831abe56858597386c597c4f20f5da76f7f89fefa6844b12f8656105699a80b68da28e23824779d5726352ef241602bdc424df6ec12e8bfc43
7
- data.tar.gz: 85c3c33de2618f612146452769e7bddf12d63527c0d4bfe26659c712402cc1b652950987d42d1f7b6ebd4d8102fdf608a04c06db4df02de916f27f3942b1ecbf
6
+ metadata.gz: cc98e81e010862da4130d0c6c25e454b901a5c01800a3f26fbc3cd3abf686033d98b4483a3d6775cd567069d45ef8a8437281488bc315dbdabde590d563d6ce3
7
+ data.tar.gz: 8828505562b526cd29c1ac6b26a5a29f708ac46c4388036dcff3eae76fccc359c7265febc80381a6c2a1706ee85ee54f718cc564c58411fdfe5d3ef40698bbed
data/lib/ft_gem_api.rb CHANGED
@@ -1,28 +1,26 @@
1
1
  module FTGemApi
2
- class << self
3
- def feature_toggle_status(name:)
4
- toggle = api_fetch_feature_toggle(name: name)
5
- toggle['feature_toggle']['toggle_percentage'].to_i == 100
6
- rescue StandardError => e
7
- puts "FTApiGem error #{e}"
8
- puts "Method: #{feature_toggle_status}"
9
- false
10
- end
2
+ def feature_toggle_status(name:)
3
+ toggle = api_fetch_feature_toggle(name: name)
4
+ toggle['feature_toggle']['toggle_percentage'].to_i == 100
5
+ rescue StandardError => e
6
+ puts "FTApiGem error #{e}"
7
+ puts "Method: #{feature_toggle_status}"
8
+ false
9
+ end
11
10
 
12
- def api_fetch_feature_toggle(name:)
13
- Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do
14
- JSON.parse(HTTP.headers(authentication_header).get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", params: { name: name }).body.to_s)
15
- end
16
- rescue StandardError => e
17
- puts "FTApiGem error #{e}"
18
- puts "Method: #{feature_toggle_status}"
19
- nil
11
+ def api_fetch_feature_toggle(name:)
12
+ Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do
13
+ JSON.parse(HTTP.headers(authentication_header).get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", params: { name: name }).body.to_s)
20
14
  end
15
+ rescue StandardError => e
16
+ puts "FTApiGem error #{e}"
17
+ puts "Method: #{feature_toggle_status}"
18
+ nil
19
+ end
21
20
 
22
- private
21
+ private
23
22
 
24
- def authentication_header
25
- { Authorization: "Bearer #{MumsnetJWT.tokenify}" }
26
- end
23
+ def authentication_header
24
+ { Authorization: "Bearer #{MumsnetJWT.tokenify}" }
27
25
  end
28
26
  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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murray Catto