class ForemanOpenscap::ScapContent

def as_json(*args)

def as_json(*args)
  hash = super
  hash["scap_file"] = scap_file.to_s.encode('utf-8', :invalid => :replace, :undef => :replace, :replace => '_')
end

def fetch_profiles

def fetch_profiles
  api = ProxyAPI::Openscap.new(:url => proxy_url)
  profiles = api.fetch_policies_for_scap_content(scap_file)
  profiles
end

def to_label

def to_label
  title
end

def used_location_ids

def used_location_ids
  Location.joins(:taxable_taxonomies).where(
    'taxable_taxonomies.taxable_type' => 'ForemanOpenscap::ScapContent',
    'taxable_taxonomies.taxable_id' => id
  ).pluck("#{Location.arel_table.name}.id")
end

def used_organization_ids

def used_organization_ids
  Organization.joins(:taxable_taxonomies).where(
    'taxable_taxonomies.taxable_type' => 'ForemanOpenscap::ScapContent',
    'taxable_taxonomies.taxable_id' => id
  ).pluck("#{Location.arel_table.name}.id")
end