Sha256: fc3829a46dd58bd3c9898f6477da40b0a7d4e64117baaec96d9774b3915b1fa3
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'flipper/api/action' require 'flipper/api/v1/decorators/feature' module Flipper module Api module V1 module Actions class Feature < Api::Action route %r{api/v1/features/[^/]*/?\Z} def get if feature_names.include?(feature_name) feature = Decorators::Feature.new(flipper[feature_name]) json_response(feature.as_json) else json_error_response(:feature_not_found) end end def delete if feature_names.include?(feature_name) flipper.remove(feature_name) json_response({}, 204) else json_error_response(:feature_not_found) end end private def feature_name @feature_name ||= Rack::Utils.unescape(path_parts.last) end def feature_names @feature_names ||= flipper.adapter.features end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flipper-api-0.10.2 | lib/flipper/api/v1/actions/feature.rb |
flipper-api-0.10.1 | lib/flipper/api/v1/actions/feature.rb |
flipper-api-0.10.0 | lib/flipper/api/v1/actions/feature.rb |