Class: Api::V2::Compliance::ArfReportsController
- Inherits:
-
V2::BaseController
- Object
- V2::BaseController
- Api::V2::Compliance::ArfReportsController
- Includes:
- Api::Version2, Foreman::Controller::SmartProxyAuth, ForemanOpenscap::ArfReportsControllerCommonExtensions
- Defined in:
- app/controllers/api/v2/compliance/arf_reports_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #download ⇒ Object
- #download_html ⇒ Object
- #get_resource(message = 'no resource loaded') ⇒ Object
- #index ⇒ Object
- #resource_name(resource = '::ForemanOpenscap::ArfReport') ⇒ Object
- #show ⇒ Object
Methods included from ForemanOpenscap::ArfReportsControllerCommonExtensions
Instance Method Details
#create ⇒ Object
51 52 53 54 55 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 51 def create arf_report = ForemanOpenscap::ArfReport.create_arf(@asset, @smart_proxy, params.to_unsafe_h) @asset.host.refresh_statuses([HostStatus.find_status_by_humanized_name("compliance")]) respond_for_report arf_report end |
#destroy ⇒ Object
42 43 44 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 42 def destroy process_response @arf_report.destroy end |
#download ⇒ Object
60 61 62 63 64 65 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 60 def download response = @arf_report.to_bzip send_data response, :filename => "#{format_filename}.xml.bz2" rescue => e handle_download_error e end |
#download_html ⇒ Object
70 71 72 73 74 75 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 70 def download_html response = @arf_report.to_html send_data response, :filename => "#{format_filename}.html" rescue => e handle_download_error e end |
#get_resource(message = 'no resource loaded') ⇒ Object
21 22 23 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 21 def get_resource( = 'no resource loaded') instance_variable_get(:"@arf_report") || raise() end |
#index ⇒ Object
29 30 31 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 29 def index @arf_reports = resource_scope_for_index(:permission => :view_arf_reports).includes(:openscap_proxy, :policy, :host) end |
#resource_name(resource = '::ForemanOpenscap::ArfReport') ⇒ Object
17 18 19 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 17 def resource_name(resource = '::ForemanOpenscap::ArfReport') super resource end |
#show ⇒ Object
36 37 |
# File 'app/controllers/api/v2/compliance/arf_reports_controller.rb', line 36 def show end |