Class: Flipper::Api::V1::Actions::Feature

Inherits:
Action
  • Object
show all
Includes:
FeatureNameFromRoute
Defined in:
lib/flipper/api/v1/actions/feature.rb

Constant Summary

Constants inherited from Action

Action::VALID_REQUEST_METHOD_NAMES

Instance Attribute Summary

Attributes inherited from Action

#flipper, #request

Instance Method Summary collapse

Methods inherited from Action

#halt, #header, #initialize, #json_error_response, #json_response, route, route_match?, route_regex, #run, run, #run_other_action, #status

Constructor Details

This class inherits a constructor from Flipper::Api::Action

Instance Method Details

#deleteObject



20
21
22
23
# File 'lib/flipper/api/v1/actions/feature.rb', line 20

def delete
  flipper.remove(feature_name)
  json_response({}, 204)
end

#getObject



13
14
15
16
17
18
# File 'lib/flipper/api/v1/actions/feature.rb', line 13

def get
  return json_error_response(:feature_not_found) unless feature_exists?(feature_name)
  exclude_gates = params['exclude_gates']&.downcase == "true"
  feature = Decorators::Feature.new(flipper[feature_name])
  json_response(feature.as_json(exclude_gates: exclude_gates))
end