jam-cloud/web/app/views/api_users/show.rabl

71 lines
1.8 KiB
Ruby

object @user
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count, :recording_count, :session_count, :biography, :favorite_count
if @user.musician?
node :location do @user.location end
else
node :location do @user.online ? 'Online' : 'Offline' end
end
# give back more info if the user being fetched is yourself
if @user == current_user
attributes :email, :original_fpfile, :cropped_fpfile, :crop_selection, :session_settings, :show_whats_next, :subscribe_email, :auth_twitter, :new_notifications
elsif current_user
node :is_friend do |uu|
current_user.friends?(@user)
end
node :is_following do |uu|
current_user.following?(@user)
end
node :is_liking do |uu|
current_user.likes?(@user)
end
node :pending_friend_request do |uu|
current_user.pending_friend_request?(@user)
end
end
child :friends => :friends do
attributes :id, :first_name, :last_name, :name, :online, :photo_url
end
child :followings => :followings do
attributes :type
node :id do |f|
f.followable.id
end
node :name do |f|
f.followable.name
end
node :location do |f|
f.followable.location
end
node :photo_url do |f|
f.followable.photo_url
end
end
child :band_musicians => :bands do
attributes :id, :name, :admin, :photo_url, :logo_url
child :genres => :genres do
attributes :id, :description
#partial('api_genres/index', :object => @user.bands.genres)
end
end
child :musician_instruments => :instruments do
attributes :description, :proficiency_level, :priority, :instrument_id
end
child :music_sessions => :sessions do
attributes :id, :description, :musician_access, :approval_required, :fan_access
end