Module: FtShared
- Defined in:
- lib/ft_gem/shared/ft_shared.rb
Class Method Summary collapse
Class Method Details
.authentication_header ⇒ Object
12 13 14 |
# File 'lib/ft_gem/shared/ft_shared.rb', line 12 def authentication_header { Authorization: "Bearer #{MumsnetJWT.tokenify}" } end |
.fetch(name:) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/ft_gem/shared/ft_shared.rb', line 3 def fetch(name:) Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do JSON.parse(HTTP.headers(authentication_header).get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", params: { name: name }).body.to_s) end rescue StandardError => e Rails.logger.error "FtHelper::fetch error #{e.backtrace}" nil end |