Sha256: 3cd4e3d9e54c5cec00477efd70c9d6826666af2a03e7e767833e87aab9a3eb4d

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

module Scaptimony::HostReportDashboard
  class Data
    attr_reader :report

    def initialize(policy_id, asset_id)
      @latest_report = Scaptimony::ArfReport.where(:asset_id =>  asset_id, :policy_id => policy_id).order('created_at DESC').limit(1).first
      @report = {}
      fetch_data
    end

    private
    attr_writer :report
    attr_accessor :latest_report

    def fetch_data
      report.update(
          {
            :passed  => report_passed,
            :failed  => report_failed,
            :othered => report_othered
          }
      )
    end

    def report_passed
      @latest_report.passed
    end

    def report_failed
      @latest_report.failed
    end

    def report_othered
      @latest_report.othered
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_openscap-0.4.3 app/services/scaptimony/host_report_dashboard/data.rb
foreman_openscap-0.4.2 app/services/scaptimony/host_report_dashboard/data.rb
foreman_openscap-0.4.1 app/services/scaptimony/host_report_dashboard/data.rb
foreman_openscap-0.4.0 app/services/scaptimony/host_report_dashboard/data.rb