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

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

Defined Under Namespace

Classes: BM, EM, TM

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bm: nil, tm: nil, em: nil) ⇒ CVSSv3

Initializes the CVSSv2.

Parameters:

  • bm (BM, nil) (defaults to: nil)
  • tm (TM, nil) (defaults to: nil)
  • em (EM, nil) (defaults to: nil)


349
350
351
352
353
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 349

def initialize(bm: nil, tm: nil, em: nil)
  @bm = bm
  @tm = tm
  @em = em
end

Instance Attribute Details

#bmBM? (readonly)

Returns:

  • (BM, nil)


131
132
133
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 131

def bm
  @bm
end

#emEM? (readonly)

Returns:

  • (EM, nil)


338
339
340
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 338

def em
  @em
end

#tmTM? (readonly)

Returns:

  • (TM, nil)


198
199
200
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 198

def tm
  @tm
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.



364
365
366
367
368
369
370
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 364

def self.from_json(json)
  {
    bm: json['BM'] && BM.load(json['BM']),
    tm: json['TM'] && TM.load(json['TM']),
    em: json['EM'] && EM.load(json['EM'])
  }
end

.load(json) ⇒ CVSSv3

Loads the CVSSv3 object from the parsed JSON.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (CVSSv3)

    the loaded CVSSv3 object.



381
382
383
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 381

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