class CVESchema::CVE::Vendor
Represents an element within the `“vendor_data”` JSON Array.
Attributes
product[R]
@return [Array<Product>]
vendor_name[R]
@return [String]
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/vendor.rb, line 59 def self.from_json(json) { vendor_name: json['vendor_name'], product: json['product']['product_data'].map(&Product.method(:load)) } end
load(json)
click to toggle source
Loads the vendor object from the parsed JSON.
@param [Hash{String => Object}] json
The parsed JSON.
@return [Vendor]
The loaded vendor object.
@api semipublic
# File lib/cve_schema/cve/vendor.rb, line 77 def self.load(json) new(**from_json(json)) end
new(vendor_name: , product: )
click to toggle source
Initializes the vendor object.
@param [String] vendor_name
@param [Array<Product>] product
# File lib/cve_schema/cve/vendor.rb, line 24 def initialize(vendor_name: , product: ) @vendor_name = vendor_name @product = product end
Public Instance Methods
na?()
click to toggle source
Determines if the {#vendor_name} is `n/a`.
@return [Boolean]
# File lib/cve_schema/cve/vendor.rb, line 34 def na? @vendor_name == NA end
to_s()
click to toggle source
Converts the vendor object to a String.
@return [String]
The vendor name
# File lib/cve_schema/cve/vendor.rb, line 44 def to_s @vendor_name end