Class: Tenable::Models::Vulnerability

Inherits:
Data
  • Object
show all
Defined in:
lib/tenable/models/vulnerability.rb

Overview

Represents a vulnerability finding from the Tenable.io API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#assetObject (readonly)

Returns the value of attribute asset



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def asset
  @asset
end

#cveObject (readonly)

Returns the value of attribute cve



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def cve
  @cve
end

#cvss_base_scoreObject (readonly)

Returns the value of attribute cvss_base_score



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def cvss_base_score
  @cvss_base_score
end

#first_foundObject (readonly)

Returns the value of attribute first_found



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def first_found
  @first_found
end

#last_fixedObject (readonly)

Returns the value of attribute last_fixed



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def last_fixed
  @last_fixed
end

#last_foundObject (readonly)

Returns the value of attribute last_found



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def last_found
  @last_found
end

#outputObject (readonly)

Returns the value of attribute output



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def output
  @output
end

#plugin_idObject (readonly)

Returns the value of attribute plugin_id



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def plugin_id
  @plugin_id
end

#plugin_nameObject (readonly)

Returns the value of attribute plugin_name



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def plugin_name
  @plugin_name
end

#severityObject (readonly)

Returns the value of attribute severity



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def severity
  @severity
end

#severity_idObject (readonly)

Returns the value of attribute severity_id



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def severity_id
  @severity_id
end

#stateObject (readonly)

Returns the value of attribute state



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def state
  @state
end

#vpr_scoreObject (readonly)

Returns the value of attribute vpr_score



6
7
8
# File 'lib/tenable/models/vulnerability.rb', line 6

def vpr_score
  @vpr_score
end

Class Method Details

.from_api(data) ⇒ Vulnerability

Builds a Vulnerability from a raw API response hash.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tenable/models/vulnerability.rb', line 15

def self.from_api(data) # rubocop:disable Metrics/MethodLength
  data = data.transform_keys(&:to_sym)
  new(
    plugin_id: data[:plugin_id],
    plugin_name: data[:plugin_name],
    severity: data[:severity],
    severity_id: data[:severity_id],
    state: data[:state],
    asset: data[:asset] ? Asset.from_api(data[:asset]) : nil,
    output: data[:output],
    first_found: data[:first_found],
    last_found: data[:last_found],
    last_fixed: data[:last_fixed],
    vpr_score: data[:vpr_score],
    cvss_base_score: data[:cvss_base_score],
    cve: data[:cve] || []
  )
end