Class: Api::V2::Compliance::ScapContentsController

Inherits:
BaseController
  • Object
show all
Includes:
Foreman::Controller::Parameters::ScapContent, ForemanOpenscap::BodyLogExtensions
Defined in:
app/controllers/api/v2/compliance/scap_contents_controller.rb

Instance Method Summary collapse

Methods included from ForemanOpenscap::BodyLogExtensions

#log_response_body, #logger_msg, #skip_body_log

Instance Method Details

#createObject



50
51
52
53
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 50

def create
  @scap_content = ForemanOpenscap::ScapContent.new(scap_content_params)
  process_response @scap_content.save
end

#destroyObject



66
67
68
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 66

def destroy
  process_response @scap_content.destroy
end

#get_resource(message = 'no resource loaded') ⇒ Object



12
13
14
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 12

def get_resource(message = 'no resource loaded')
  instance_variable_get(:"@scap_content") || raise(message)
end

#indexObject



20
21
22
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 20

def index
  @scap_contents = resource_scope_for_index(:permission => :view_scap_contents)
end

#resource_name(resource = '::ForemanOpenscap::ScapContent') ⇒ Object



8
9
10
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 8

def resource_name(resource = '::ForemanOpenscap::ScapContent')
  super resource
end

#showObject



35
36
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 35

def show
end

#updateObject



59
60
61
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 59

def update
  process_response @scap_content.update_attributes(scap_content_params)
end

#xmlObject



27
28
29
30
31
# File 'app/controllers/api/v2/compliance/scap_contents_controller.rb', line 27

def xml
  send_data @scap_content.scap_file,
            :type     => 'application/xml',
            :filename => @scap_content.original_filename || "#{@scap_content.title}.xml"
end