Class: ForemanOpenscap::HostReportDashboard::Data

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_openscap/host_report_dashboard/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy, host) ⇒ Data

Returns a new instance of Data.



5
6
7
8
9
10
11
# File 'app/services/foreman_openscap/host_report_dashboard/data.rb', line 5

def initialize(policy, host)
  @latest_report = ::ForemanOpenscap::ArfReport.latest_of_policy(policy)
                                               .where(:host_id => host.id)
                                               .order('created_at DESC').first
  @report = {}
  fetch_data
end

Instance Attribute Details

#latest_reportObject (readonly)

Returns the value of attribute latest_report.



3
4
5
# File 'app/services/foreman_openscap/host_report_dashboard/data.rb', line 3

def latest_report
  @latest_report
end

#reportObject

Returns the value of attribute report.



3
4
5
# File 'app/services/foreman_openscap/host_report_dashboard/data.rb', line 3

def report
  @report
end

Instance Method Details

#has_data?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/services/foreman_openscap/host_report_dashboard/data.rb', line 13

def has_data?
  latest_report.present?
end