Sha256: 831aa066c7b4c7edbd53c0e7ec91c609e5d9120aa88ed2e942df7d98f4c8e5d7

Contents?: true

Size: 1.11 KB

Versions: 22

Compression:

Stored size: 1.11 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("/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
  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(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

22 entries across 22 versions & 1 rubygems

Version Path
rhosync-2.0.8 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.7 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.6 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.5 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.4 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.3 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.2 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.1 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.rc2 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.rc1 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta13 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta12 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta11 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta10 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta9 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta8 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta7 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta6 lib/rhosync/console/app/routes/client.rb
rhosync-2.0.0.beta4 lib/rhosync/console/app/routes/client.rb