summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2012-06-29 03:46:01 -0700
committerNihad Abbasov <narkoz.2008@gmail.com>2012-06-29 03:46:01 -0700
commit0d67f209fcbabed5831d90561350a8e094c150c4 (patch)
tree12aadf636dde8f626fd1cfd53f13aaf8cf7a47c8 /lib/api/users.rb
parent84a3f8fca4e57422267bdd7e07d4f1b90717fbcc (diff)
downloadgitlab-ce-0d67f209fcbabed5831d90561350a8e094c150c4.tar.gz
refactor API and improve docs
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
new file mode 100644
index 00000000000..ef3762f30fc
--- /dev/null
+++ b/lib/api/users.rb
@@ -0,0 +1,36 @@
+module Gitlab
+ # Users API
+ class Users < Grape::API
+ before { authenticate! }
+
+ resource :users do
+ # Get a users list
+ #
+ # Example Request:
+ # GET /users
+ get do
+ @users = User.all
+ present @users, :with => Entities::User
+ end
+
+ # Get a single user
+ #
+ # Parameters:
+ # id (required) - The ID of a user
+ # Example Request:
+ # GET /users/:id
+ get ":id" do
+ @user = User.find(params[:id])
+ present @user, :with => Entities::User
+ end
+ end
+
+ # Get currently authenticated user
+ #
+ # Example Request:
+ # GET /user
+ get "/user" do
+ present @current_user, :with => Entities::User
+ end
+ end
+end