Class: CVESchema::CVE::Impact::CVSSv2::EM

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

Constant Summary collapse

CDP =
{
  'N' => :N,
  'L' => :L,
  'LM' => :LM,
  'MH' => :MH,
  'H' => :H,
  'ND' => :ND
}
TD =
{'N' => :N, 'L' => :L, 'M' => :M, 'H' => :H, 'ND' => :ND}
CR =
{'L' => :L, 'M' => :M, 'H' => :H, 'ND' => :ND}
IR =
{'L' => :L, 'M' => :M, 'H' => :H, 'ND' => :ND}
AR =
{'L' => :L, 'M' => :M, 'H' => :H, 'ND' => :ND}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cdp: nil, td: nil, cr: nil, ir: nil, ar: nil) ⇒ EM

Returns a new instance of EM.



225
226
227
228
229
230
231
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 225

def initialize(cdp: nil, td: nil, cr: nil, ir: nil, ar: nil)
  @cdp = cdp
  @td  = td
  @cr  = cr
  @ir  = ir
  @ar  = ar
end

Instance Attribute Details

#ar:L, ... (readonly)

Security Requirements Availability.

Returns:

  • (:L, :M, :H, :ND)


223
224
225
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 223

def ar
  @ar
end

#cdp:N, ... (readonly)

The Collateral Damage Potential.

Returns:

  • (:N, :L, :LM, :MH, :H, :ND)


195
196
197
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 195

def cdp
  @cdp
end

#cr:L, ... (readonly)

Security Requirements Confidentiality.

Returns:

  • (:L, :M, :H, :ND)


209
210
211
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 209

def cr
  @cr
end

#ir:L, ... (readonly)

Security Requirements Integrity.

Returns:

  • (:L, :M, :H, :ND)


216
217
218
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 216

def ir
  @ir
end

#td:N, ... (readonly)

The Target Distribution.

Returns:

  • (:N, :L, :M, :H, :ND)


202
203
204
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 202

def td
  @td
end

Class Method Details

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

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

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (Hash{Symbol => Object})

    The mapped Symbol Hash.



242
243
244
245
246
247
248
249
250
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 242

def self.from_json(json)
  {
    cdp: CDP[json['CDP']],
    td:  TD[json['TD']],
    cr:  CR[json['CR']],
    ir:  IR[json['IR']],
    ar:  AR[json['AR']]
  }
end

.load(json) ⇒ self

Loads the EM object from the parsed JSON.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (self)

    The loaded EM object.



261
262
263
# File 'lib/cve_schema/cve/impact/cvss_v2.rb', line 261

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