2012-06-27 13:32:56 +02:00
|
|
|
require 'api/entities'
|
|
|
|
require 'api/helpers'
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class API < Grape::API
|
|
|
|
format :json
|
|
|
|
helpers APIHelpers
|
|
|
|
|
|
|
|
resource :users do
|
|
|
|
before { authenticate! }
|
|
|
|
|
|
|
|
# GET /users
|
|
|
|
get do
|
|
|
|
@users = User.all
|
|
|
|
present @users, :with => Entities::User
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /users/:id
|
|
|
|
get ":id" do
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
present @user, :with => Entities::User
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /user
|
|
|
|
get "/user" do
|
|
|
|
authenticate!
|
|
|
|
present @current_user, :with => Entities::User
|
|
|
|
end
|
|
|
|
end
|
2012-06-27 11:26:16 +02:00
|
|
|
end
|