Class: CVESchema::CVE::Impact::CVSSv2::BM
- Inherits:
-
Object
- Object
- CVESchema::CVE::Impact::CVSSv2::BM
- Defined in:
- lib/cve_schema/cve/impact/cvss_v2.rb
Constant Summary collapse
- AV =
{'L' => :L, 'A' => :A, 'N' => :N}
- AC =
{'H' => :H, 'M' => :M, 'L' => :L}
- AU =
{'M' => :M, 'S' => :S, 'N' => :N}
- C =
{'N' => :N, 'P' => :P, 'C' => :C}
- I =
{'N' => :N, 'P' => :P, 'C' => :C}
- A =
{'N' => :N, 'P' => :P, 'C' => :C}
Instance Attribute Summary collapse
-
#a ⇒ :N, ...
readonly
The Availability impact.
-
#ac ⇒ :H, ...
readonly
The Access Complexity.
-
#au ⇒ :M, ...
readonly
The Authentication.
-
#av ⇒ :L, ...
readonly
The Access Vector.
-
#c ⇒ :N, ...
readonly
The Confidentiality impact.
-
#i ⇒ :N, ...
readonly
The Integrity impact.
-
#score ⇒ String
readonly
The CVSSv2 Base Metrics Group score assuming all elements are present.
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ self
Loads the BM object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(av: nil, ac: nil, au: nil, c: nil, i: nil, a: nil, score: nil) ⇒ BM
constructor
A new instance of BM.
Constructor Details
#initialize(av: nil, ac: nil, au: nil, c: nil, i: nil, a: nil, score: nil) ⇒ BM
Returns a new instance of BM.
57 58 59 60 61 62 63 64 65 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 57 def initialize(av: nil, ac: nil, au: nil, c: nil, i: nil, a: nil, score: nil) @av = av @ac = ac @c = c @i = i @a = a @score = score end |
Instance Attribute Details
#a ⇒ :N, ... (readonly)
The Availability impact.
50 51 52 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 50 def a @a end |
#ac ⇒ :H, ... (readonly)
The Access Complexity.
22 23 24 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 22 def ac @ac end |
#au ⇒ :M, ... (readonly)
The Authentication
29 30 31 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 29 def au @au end |
#av ⇒ :L, ... (readonly)
The Access Vector.
15 16 17 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 15 def av @av end |
#c ⇒ :N, ... (readonly)
The Confidentiality impact.
36 37 38 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 36 def c @c end |
#i ⇒ :N, ... (readonly)
The Integrity impact.
43 44 45 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 43 def i @i end |
#score ⇒ String (readonly)
The CVSSv2 Base Metrics Group score assuming all elements are present.
55 56 57 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 55 def score @score end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 76 def self.from_json(json) { av: AV[json['AV']], ac: AC[json['AC']], au: AU[json['AU']], c: C[json['C']], i: I[json['I']], a: A[json['A']], score: json['SCORE'] } end |
.load(json) ⇒ self
Loads the BM object from the parsed JSON.
98 99 100 |
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 98 def self.load(json) new(**from_json(json)) end |