Class: Flipper::Api::V1::Actions::Features
- Defined in:
- lib/flipper/api/v1/actions/features.rb
Constant Summary
Constants inherited from Action
Action::VALID_REQUEST_METHOD_NAMES
Instance Attribute Summary
Attributes inherited from Action
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
#get ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/flipper/api/v1/actions/features.rb', line 13 def get features = flipper.features.map { |feature| Decorators::Feature.new(feature).as_json } json_response({ features: features }) end |
#post ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/flipper/api/v1/actions/features.rb', line 23 def post feature_name = params.fetch('name') do json_response({ errors: [{ message: 'Missing post parameter: name', }] }, 422) end flipper.adapter.add(flipper[feature_name]) json_response({}, 200) end |