Class: NVD::JSONFeeds::Schema::Impact::BaseMetricV2
- Inherits:
-
Object
- Object
- NVD::JSONFeeds::Schema::Impact::BaseMetricV2
- Defined in:
- lib/nvd/json_feeds/schema/impact/base_metric_v2.rb
Overview
Represents the "baseMetricV2"
value.
Instance Attribute Summary collapse
- #ac_insuf_info ⇒ Boolean? readonly
-
#cvss_v2 ⇒ CVSSv2?
readonly
The CVSSv2 data.
-
#exploitability_score ⇒ Float?
readonly
The exploitability score.
-
#impact_score ⇒ Float?
readonly
The impact score.
- #obtain_all_privilege ⇒ Boolean? readonly
- #obtain_other_privilege ⇒ Boolean? readonly
- #obtain_user_privilege ⇒ Boolean? readonly
-
#severity ⇒ String?
readonly
The severity.
- #user_interaction_required ⇒ Boolean? readonly
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ BaseMetricV2
Loads the base metrics V2 object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(cvss_v2: nil, severity: nil, exploitability_score: nil, impact_score: nil, ac_insuf_info: nil, obtain_all_privilege: nil, obtain_user_privilege: nil, obtain_other_privilege: nil, user_interaction_required: nil) ⇒ BaseMetricV2
constructor
Initializes the base metric V2 object.
Constructor Details
#initialize(cvss_v2: nil, severity: nil, exploitability_score: nil, impact_score: nil, ac_insuf_info: nil, obtain_all_privilege: nil, obtain_user_privilege: nil, obtain_other_privilege: nil, user_interaction_required: nil) ⇒ BaseMetricV2
Initializes the base metric V2 object.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 68 def initialize(cvss_v2: nil, severity: nil, exploitability_score: nil, impact_score: nil, ac_insuf_info: nil, obtain_all_privilege: nil, obtain_user_privilege: nil, obtain_other_privilege: nil, user_interaction_required: nil) @cvss_v2 = cvss_v2 @severity = severity @exploitability_score = exploitability_score @impact_score = impact_score @ac_insuf_info = ac_insuf_info @obtain_all_privilege = obtain_all_privilege @obtain_user_privilege = obtain_user_privilege @obtain_other_privilege = obtain_other_privilege @user_interaction_required = user_interaction_required end |
Instance Attribute Details
#ac_insuf_info ⇒ Boolean? (readonly)
33 34 35 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 33 def ac_insuf_info @ac_insuf_info end |
#cvss_v2 ⇒ CVSSv2? (readonly)
The CVSSv2 data.
15 16 17 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 15 def cvss_v2 @cvss_v2 end |
#exploitability_score ⇒ Float? (readonly)
The exploitability score.
25 26 27 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 25 def exploitability_score @exploitability_score end |
#impact_score ⇒ Float? (readonly)
The impact score.
30 31 32 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 30 def impact_score @impact_score end |
#obtain_all_privilege ⇒ Boolean? (readonly)
36 37 38 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 36 def obtain_all_privilege @obtain_all_privilege end |
#obtain_other_privilege ⇒ Boolean? (readonly)
42 43 44 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 42 def obtain_other_privilege @obtain_other_privilege end |
#obtain_user_privilege ⇒ Boolean? (readonly)
39 40 41 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 39 def obtain_user_privilege @obtain_user_privilege end |
#severity ⇒ String? (readonly)
The severity.
20 21 22 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 20 def severity @severity end |
#user_interaction_required ⇒ Boolean? (readonly)
45 46 47 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 45 def user_interaction_required @user_interaction_required end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 97 def self.from_json(json) { cvss_v2: if (value = json['cvssV2']) CVSSv2.load(value) end, severity: json['severity'], exploitability_score: json['exploitabilityScore'], impact_score: json['impactScore'], ac_insuf_info: json['acInsufInfo'], obtain_all_privilege: json['obtainAllPrivilege'], obtain_user_privilege: json['obtainUserPrivilege'], obtain_other_privilege: json['obtainOtherPrivilege'], user_interaction_required: json['userInteractionRequired'] } end |
.load(json) ⇒ BaseMetricV2
Loads the base metrics V2 object from the parsed JSON.
123 124 125 |
# File 'lib/nvd/json_feeds/schema/impact/base_metric_v2.rb', line 123 def self.load(json) new(**from_json(json)) end |