travis-api/lib/travis/api/app/endpoint/users.rb
2012-10-09 15:17:10 +02:00

42 lines
1018 B
Ruby

require 'travis/api/app'
class Travis::Api::App
class Endpoint
# TODO should this be /profile?
class Users < Endpoint
# Gives information about the currently logged in user.
#
# Example:
#
# {
# "user": {
# "name": "Sven Fuchs",
# "login": "svenfuchs",
# "email": "svenfuchs@artweb-design.de",
# "gravatar_id": "402602a60e500e85f2f5dc1ff3648ecb",
# "locale": "de",
# "is_syncing": false,
# "synced_at": "2012-08-14T22:11:21Z"
# }
# }
get '/', scope: :private do
respond_with current_user
end
get '/permissions', scope: :private do
respond_with service(:users, :permissions), type: :permissions
end
put '/:id?', scope: :private do
update(params[:user])
204
end
post '/sync', scope: :private do
service(:users, :sync)
204
end
end
end
end