Class: NVD::JSONFeeds::Schema::Impact::BaseMetricV3
- Inherits:
-
Object
- Object
- NVD::JSONFeeds::Schema::Impact::BaseMetricV3
- Defined in:
- lib/nvd/json_feeds/schema/impact/base_metric_v3.rb
Overview
Represents the "baseMetricV3"
value.
Instance Attribute Summary collapse
-
#cvss_v3 ⇒ CVSSv3
readonly
The CVSSv3 data.
-
#exploitability_score ⇒ Float?
readonly
The exploitability score.
-
#impact_score ⇒ Float?
readonly
The impact score.
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ BaseMetricV3
Loads the base metrics V3 object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(cvss_v3:, exploitability_score: nil, impact_score: nil) ⇒ BaseMetricV3
constructor
Initializes the base metric v3 object.
Constructor Details
#initialize(cvss_v3:, exploitability_score: nil, impact_score: nil) ⇒ BaseMetricV3
Initializes the base metric v3 object.
36 37 38 39 40 41 42 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 36 def initialize(cvss_v3: , exploitability_score: nil, impact_score: nil) @cvss_v3 = cvss_v3 @exploitability_score = exploitability_score @impact_score = impact_score end |
Instance Attribute Details
#cvss_v3 ⇒ CVSSv3 (readonly)
The CVSSv3 data.
15 16 17 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 15 def cvss_v3 @cvss_v3 end |
#exploitability_score ⇒ Float? (readonly)
The exploitability score.
20 21 22 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 20 def exploitability_score @exploitability_score end |
#impact_score ⇒ Float? (readonly)
The impact score.
25 26 27 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 25 def impact_score @impact_score end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
53 54 55 56 57 58 59 60 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 53 def self.from_json(json) { cvss_v3: CVSSv3.load(json.fetch('cvssV3')), exploitability_score: json['exploitabilityScore'], impact_score: json['impactScore'] } end |
.load(json) ⇒ BaseMetricV3
Loads the base metrics V3 object from the parsed JSON.
71 72 73 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v3.rb', line 71 def self.load(json) new(**from_json(json)) end |