Class: Dev::Ruby::Audit
- Defined in:
- lib/firespring_dev_commands/ruby/audit.rb
Overview
Class which contains commands and customizations for security audit reports
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Audit
constructor
A new instance of Audit.
-
#to_report ⇒ Object
Convert the php audit data to the standardized audit report object.
Constructor Details
#initialize(data) ⇒ Audit
Returns a new instance of Audit.
9 10 11 |
# File 'lib/firespring_dev_commands/ruby/audit.rb', line 9 def initialize(data) @data = JSON.parse(Dev::Common.new.strip_non_json(data)) end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/firespring_dev_commands/ruby/audit.rb', line 7 def data @data end |
Instance Method Details
#to_report ⇒ Object
Convert the php audit data to the standardized audit report object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/firespring_dev_commands/ruby/audit.rb', line 14 def to_report Dev::Audit::Report.new( data['results'].map do |it| Dev::Audit::Report::Item.new( id: it['advisory']['id'], name: it['gem']['name'], severity: it['advisory']['criticality'] || Dev::Audit::Report::Level::UNKNOWN, title: it['advisory']['title'], url: it['advisory']['url'], version: it['gem']['version'] ) end ) end |