Class: Api::V2::OmahaReportsController
- Inherits:
-
V2::BaseController
- Object
- V2::BaseController
- Api::V2::OmahaReportsController
- Includes:
- Api::Version2, Foreman::Controller::SmartProxyAuth
- Defined in:
- app/controllers/api/v2/omaha_reports_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/api/v2/omaha_reports_controller.rb', line 44 def create @omaha_report = resource_class.import(params.to_unsafe_h[:omaha_report], detected_proxy.try(:id)) process_response @omaha_report.errors.empty? rescue ::Foreman::Exception => e (e.to_s, :status => :unprocessable_entity) end |
#destroy ⇒ Object
54 55 56 |
# File 'app/controllers/api/v2/omaha_reports_controller.rb', line 54 def destroy process_response @omaha_report.destroy end |
#index ⇒ Object
31 32 33 34 |
# File 'app/controllers/api/v2/omaha_reports_controller.rb', line 31 def index @omaha_reports = resource_scope_for_index.my_reports @total = resource_scope_for_index.my_reports.count end |
#last ⇒ Object
62 63 64 65 66 67 |
# File 'app/controllers/api/v2/omaha_reports_controller.rb', line 62 def last conditions = params[:host_id].present? ? { :host_id => resource_finder(Host.(:view_hosts), params[:host_id]).try(:id) } : nil max_id = resource_scope.where(conditions).maximum(:id) @omaha_report = resource_scope.find(max_id) render :show end |
#show ⇒ Object
39 |
# File 'app/controllers/api/v2/omaha_reports_controller.rb', line 39 def show; end |