2014-03-29 00:59:26 +00:00
|
|
|
class Api::V1::UsersController < Api::V1::BaseController
|
|
|
|
def index
|
2014-08-28 20:43:11 +00:00
|
|
|
render json: Api::V1::UsersCollection.as_json
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
@steam = SteamCondenser::Community::SteamId.from_steam_id("STEAM_#{@user.steamid}")
|
|
|
|
|
|
|
|
render json: {
|
2015-07-21 13:27:33 +00:00
|
|
|
id: @user.id,
|
|
|
|
username: @user.username,
|
|
|
|
country: @user.country,
|
|
|
|
time_zone: @user.time_zone,
|
|
|
|
avatar: @user.profile.avatar.url,
|
|
|
|
admin: @user.admin?,
|
2014-08-28 20:43:11 +00:00
|
|
|
steam: {
|
|
|
|
url: @steam.base_url,
|
|
|
|
nickname: @steam.nickname
|
|
|
|
}
|
|
|
|
}
|
2015-07-22 16:22:38 +00:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
raise ActionController::RoutingError.new('User Not Found')
|
2014-03-29 00:59:26 +00:00
|
|
|
end
|
2014-03-31 21:33:16 +00:00
|
|
|
end
|