Class: Api::V1::ReportsController

Inherits:
BaseController show all
Defined in:
app/controllers/api/v1/reports_controller.rb

Instance Method Summary collapse

Methods included from Api::Version1

#api_version

Methods inherited from BaseController

#get_resource, #resource_class, #resource_name, #resource_scope

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#destroyObject


27
28
29
# File 'app/controllers/api/v1/reports_controller.rb', line 27

def destroy
  process_response @report.destroy
end

#indexObject


13
14
15
16
# File 'app/controllers/api/v1/reports_controller.rb', line 13

def index
  @reports = Report.my_reports.includes(:logs => [:source, :message]).
    search_for(*search_options).paginate(paginate_options)
end

#lastObject


34
35
36
37
38
39
# File 'app/controllers/api/v1/reports_controller.rb', line 34

def last
  conditions = { :host_id => Host.find_by_name(params[:host_id]).try(:id) } unless params[:host_id].blank?
  max_id = Report.my_reports.maximum(:id, :conditions => conditions)
  @report = Report.find(max_id, :include => { :logs => [:message, :source] })
  render :show
end

#showObject


21
22
# File 'app/controllers/api/v1/reports_controller.rb', line 21

def show
end