class CVESchema::CVE::Affects

Represents the `“affects”` JSON object.

Attributes

vendor[R]

@return [Array<Vendor>]

vendors[R]

@return [Array<Vendor>]

Public Class Methods

from_json(json) click to toggle source

Maps the parsed JSON to an Array of {Vendor} objects for {#initialize}.

@param [Hash{String => Object}] json

The parsed JSON.

@return [Array<Vendor>]

@api semipublic

# File lib/cve_schema/cve/affects.rb, line 34
def self.from_json(json)
  json['vendor']['vendor_data'].map(&Vendor.method(:load))
end
load(json) click to toggle source

Loads the affects object from parsed JSON.

@param [Hash{String => Object}] json

The parsed JSON.

@return [Affects]

The loaded affects object.

@api semipublic

# File lib/cve_schema/cve/affects.rb, line 49
def self.load(json)
  new(from_json(json))
end
new(vendor) click to toggle source

Initializes the affects container.

@param [Array<Vendor>] vendor

# File lib/cve_schema/cve/affects.rb, line 20
def initialize(vendor)
  @vendor = vendor
end