class CVESchema::CVE::Product
Represents a product element within the `“product_data”` JSON Array.
Attributes
product_name[R]
The product name.
@return [String]
version[R]
The list of affected versions.
@return [Array<Version>]
versions[R]
The list of affected versions.
@return [Array<Version>]
Public Class Methods
from_json(json)
click to toggle source
Maps the parsed JSON to a Symbol Hash for {#initialize}.
@param [Hash{String => Object}] json
The parsed JSON.
@return [Hash{Symbol => Object}]
The mapped Symbol Hash.
@api semipublic
# File lib/cve_schema/cve/product.rb, line 55 def self.from_json(json) { product_name: json['product_name'], version: Array(json['version']['version_data']).map(&Version.method(:load)) } end
load(json)
click to toggle source
Loads the product object from parsed JSON.
@param [Hash{String => Object}] json
The parsed JSON.
@return [Product]
The loaded product.
@api semipublic
# File lib/cve_schema/cve/product.rb, line 73 def self.load(json) new(**from_json(json)) end
new(product_name: , version: [])
click to toggle source
Initializes the product.
@param [String] product_name
@param [Array<Version>] version
# File lib/cve_schema/cve/product.rb, line 30 def initialize(product_name: , version: []) @product_name = product_name @version = version end
Public Instance Methods
na?()
click to toggle source
Determines if the {#product_name} is `n/a`.
@return [Boolean]
# File lib/cve_schema/cve/product.rb, line 40 def na? @product_name == NA end