API: groups documentation updated, functions return different status codes

Updates the API documentation of groups with infos to return codes. The function calls
in the groups API have updated documentation and return `400 Bad Request` status code
if a required attribute is missing.
This commit is contained in:
Sebastian Ziebell 2013-02-27 12:34:45 +01:00
parent e119b0a0cb
commit 873db06255
3 changed files with 44 additions and 7 deletions

View file

@ -6,6 +6,9 @@ module Gitlab
resource :groups do
# Get a groups list
#
# Parameters
# page (optional) - The page number of the groups list
# per_page (optional) - The number of elements per page
# Example Request:
# GET /groups
get do
@ -20,12 +23,16 @@ module Gitlab
# Create group. Available only for admin
#
# Parameters:
# name (required) - Name
# path (required) - Path
# name (required) - The name of the group
# path (required) - The path of the group
# Example Request:
# POST /groups
post do
authenticated_as_admin!
bad_request!(:name) unless params[:name].present?
bad_request!(:path) unless params[:path].present?
attrs = attributes_for_keys [:name, :path]
@group = Group.new(attrs)
@group.owner = current_user