summaryrefslogtreecommitdiff
path: root/lib/api/groups.rb
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-27 17:50:30 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-27 17:50:30 +0100
commit7499f65014257989510da50505fa7c0f5a4fae88 (patch)
treeb8c9355b73ec48c12bfa9d6416fa91ba4c4444e6 /lib/api/groups.rb
parent43d75960303be538fb79804ca6e2a90241aee0df (diff)
downloadgitlab-ce-7499f65014257989510da50505fa7c0f5a4fae88.tar.gz
API: extracted helper method to validate required parameters, code clean up
Added a helper method to check if required parameters are given in an API call. Can be used to return a `400 Bad Request` return code if a required attribute is missing. Code clean up and fixed tests.
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r--lib/api/groups.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 3f213073f80..5aaa5eb4f54 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -29,9 +29,7 @@ module Gitlab
# POST /groups
post do
authenticated_as_admin!
-
- bad_request!(:name) unless params[:name].present?
- bad_request!(:path) unless params[:path].present?
+ required_attributes! [:name, :path]
attrs = attributes_for_keys [:name, :path]
@group = Group.new(attrs)