Sha256: fc42558ee280369aee842e857b0c33456471d3c2ec0c26f4ec7638b7710f95a8

Contents?: true

Size: 1.14 KB

Versions: 21

Compression:

Stored size: 1.14 KB

Contents

class RhosyncConsole::Server
  
  get '/device/create' do
    session[:errors] = nil
    handle_api_error("Can't create new device") do  
      RhosyncApi::create_client(session[:server],session[:token],params[:user_id])
    end      
    redirect url_path("/user?user_id=#{CGI.escape(params[:user_id])}"), 303  
  end
  
  get '/device' do
    @attributes = []
    handle_api_error("Can't load list of device attributes") do
      @attributes = RhosyncApi::get_client_params(session[:server],session[:token],params[:device_id])
    end
    @sources = []
    handle_api_error("Can't load list of sources") do
      @sources = RhosyncApi::list_sources(session[:server],session[:token],:all)
    end
    erb :client, :layout => false
  end
  
  get '/device/delete' do
    handle_api_error("Can't delete device #{params[:device_id]}") do 
      RhosyncApi::delete_client(session[:server],session[:token],
        params[:user_id],params[:device_id])
    end    
    redirect url_path(session[:errors] ? "/device?user_id=#{CGI.escape(params[:user_id])}&device_id=#{CGI.escape(params[:device_id])}" :
      "/user?user_id=#{CGI.escape(params[:user_id])}"), 303
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.18.beta1 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta7 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta6 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta5 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta4 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta3 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta2 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.17.beta1 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.16 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.15 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.14 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.13 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.12 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.11 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.10 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.7 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.6 lib/rhosync/console/app/routes/client.rb
rhosync-2.1.3 lib/rhosync/console/app/routes/client.rb