class Flipper::Api::V1::Actions::GroupsGate
Public Instance Methods
delete()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 21 def delete ensure_valid_params feature = flipper[feature_name] feature.disable_group(group_name) decorated_feature = Decorators::Feature.new(feature) json_response(decorated_feature.as_json, 200) end
post()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 13 def post ensure_valid_params feature = flipper[feature_name] feature.enable_group(group_name) decorated_feature = Decorators::Feature.new(feature) json_response(decorated_feature.as_json, 200) end
Private Instance Methods
allow_unregistered_groups?()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 42 def allow_unregistered_groups? allow_unregistered_groups = params['allow_unregistered_groups'] allow_unregistered_groups && allow_unregistered_groups == 'true' end
disallow_unregistered_groups?()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 47 def disallow_unregistered_groups? !allow_unregistered_groups? end
ensure_valid_params()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 31 def ensure_valid_params if group_name.nil? || group_name.empty? json_error_response(:name_invalid) end return if allow_unregistered_groups? return if Flipper.group_exists?(group_name) json_error_response(:group_not_registered) end
group_name()
click to toggle source
# File lib/flipper/api/v1/actions/groups_gate.rb, line 51 def group_name @group_name ||= params['name'] end