Sha256: 046d488a006cb8fc344fdedbc57ecc598aac5bf23762e3b9e3c0227be8514409
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# # Copyright (c) 2014 Red Hat Inc. # # This software is licensed to you under the GNU General Public License, # version 3 (GPLv3). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3 # along with this software; if not, see http://www.gnu.org/licenses/gpl.txt # require 'digest' module Scaptimony module ArfReportsHelper def self.create_arf(asset, params, arf_bzip, arf_bzip_size) # fail if policy does not exist. policy = Policy.find(params[:policy_id]) digest = Digest::SHA256.hexdigest arf_bzip ArfReportRaw.transaction do # TODO:RAILS-4.0: This should become arf_report = ArfReport.find_or_create_by! ... arf_report = ArfReport.where(:asset_id => asset.id, :policy_id => policy.id, :date => params[:date], :digest => digest).first_or_create! if arf_report.arf_report_raw.nil? ArfReportRaw.where(:arf_report_id => arf_report.id, :size => arf_bzip_size, :bzip_data => arf_bzip).create! end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scaptimony-0.3.2 | lib/scaptimony/arf_reports_helper.rb |
scaptimony-0.3.1 | lib/scaptimony/arf_reports_helper.rb |
scaptimony-0.3.0 | lib/scaptimony/arf_reports_helper.rb |