Class: CVESchema::CVE::Impact::CVSSv3::TM

Inherits:
Object
  • Object
show all
Defined in:
lib/cve_schema/cve/impact/cvss_v3.rb

Constant Summary collapse

E =
{'X' => :X, 'H' => :H, 'F' => :F, 'P' => :P, 'U' => :U}
RL =
{'X' => :X, 'U' => :U, 'W' => :W, 'T' => :T, 'O' => :O}
RC =
{'X' => :X, 'C' => :C, 'R' => :R, 'U' => :U}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e: nil, rl: nil, rc: nil) ⇒ TM

Initializes the TM object.



159
160
161
162
163
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 159

def initialize(e: nil, rl: nil, rc: nil)
  @e  = e
  @rl = rl
  @rc = rc
end

Instance Attribute Details

#e:X, ... (readonly)

Exploit Code Maturity.

Returns:

  • (:X, :H, :F, :P, :U)


140
141
142
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 140

def e
  @e
end

#rc:X, ... (readonly)

Report Confidence.

Returns:

  • (:X, :C, :R, :U)


154
155
156
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 154

def rc
  @rc
end

#rl:X, ... (readonly)

Remediation Level.

Returns:

  • (:X, :U, :W, :T, :O)


147
148
149
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 147

def rl
  @rl
end

Class Method Details

.from_json(json) ⇒ Hash{Symbol => Object}

Maps the parsed JSON to the Symbol Hash for #initialize.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (Hash{Symbol => Object})

    The mapped Symbol Hash.



174
175
176
177
178
179
180
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 174

def self.from_json(json)
  {
    e:  E[json['E']],
    rl: RL[json['RL']],
    rc: RC[json['RC']]
  }
end

.load(json) ⇒ TM

Loads the TM object from the parsed JSON.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (TM)

    The loaded TM object.



191
192
193
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 191

def self.load(json)
  new(**from_json(json))
end