Class: SmartProxiesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/smart_proxies_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


14
15
16
17
18
19
20
21
# File 'app/controllers/smart_proxies_controller.rb', line 14

def create
  @proxy = SmartProxy.new(params[:smart_proxy])
  if @proxy.save
    process_success :object => @proxy
  else
    process_error :object => @proxy
  end
end

#destroyObject


40
41
42
43
44
45
46
# File 'app/controllers/smart_proxies_controller.rb', line 40

def destroy
  if @proxy.destroy
    process_success :object => @proxy
  else
    process_error :object => @proxy
  end
end

#editObject


23
24
# File 'app/controllers/smart_proxies_controller.rb', line 23

def edit
end

#indexObject


3
4
5
6
7
8
# File 'app/controllers/smart_proxies_controller.rb', line 3

def index
  respond_to do |format|
    format.html {@proxies = SmartProxy.includes(:features).paginate :page => params[:page]}
    format.json {render :json => SmartProxy.all}
  end
end

#newObject


10
11
12
# File 'app/controllers/smart_proxies_controller.rb', line 10

def new
  @proxy = SmartProxy.new
end

#pingObject


26
27
28
29
30
# File 'app/controllers/smart_proxies_controller.rb', line 26

def ping
  respond_to do |format|
    format.json {render :json => errors_hash(@proxy.ping)}
  end
end

#updateObject


32
33
34
35
36
37
38
# File 'app/controllers/smart_proxies_controller.rb', line 32

def update
  if @proxy.update_attributes(params[:smart_proxy])
    process_success :object => @proxy
  else
    process_error :object => @proxy
  end
end