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

Inherits:
Action
  • Object
show all
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_response, regex, route, run, #run, #run_other_action, #status

Constructor Details

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

Instance Method Details

#deleteObject



21
22
23
24
25
26
27
28
29
# File 'lib/flipper/api/v1/actions/feature.rb', line 21

def delete
  if feature_names.include?(feature_name)
    flipper.remove(feature_name)

    json_response({}, 204)
  else
    json_response({}, 404)
  end
end

#getObject



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

def get
  if feature_names.include?(feature_name)
    feature = Decorators::Feature.new(flipper[feature_name])
    json_response(feature.as_json)
  else
    json_response({}, 404)
  end
end