jam-cloud/web/app/controllers/api_user_syncs_controller.rb

42 lines
1.0 KiB
Ruby

# abstracts the idea of downloading / uploading files to JamKazam.
# Recordings, JamTracks, and Video are this
class ApiUserSyncsController < ApiController
before_filter :api_signed_in_user, :except => [ ]
before_filter :auth_user
respond_to :json
@@log = Logging.logger[ApiUserSyncsController]
def show
@user_sync = UserSync.show(params[:user_sync_id], current_user.id)
if @user_sync.nil?
raise ActiveRecord::RecordNotFound
end
render "api_user_syncs/show", :layout => nil
end
# returns all downloads and uploads for a user, meaning it should return:
# all recorded_tracks (audio and video/soon)
# all mixes
# all jamtracks (soon)
def index
data = UserSync.index(
{user_id:current_user.id,
recording_id: params[:recording_id],
offset: params[:since],
limit: params[:limit]})
@user_syncs = data[:query]
@next = data[:next]
render "api_user_syncs/index", :layout => nil
end
end