class CVESchema::CVE::Timeline

Represents a timeline entry in the `“timeline”` JSON Array.

Attributes

time[R]

The time of the timeline event.

@return [DateTime]

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/timeline.rb, line 40
def self.from_json(json)
  {
    lang: json['lang'],
    time: Timestamp.parse(json['time']),
    value: json['value']
  }
end
load(json) click to toggle source

Loads the timeline object from the parsed JSON.

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

The parsed JSON.

@return [Timeline]

The loaded timeline object.

@api semipublic

# File lib/cve_schema/cve/timeline.rb, line 59
def self.load(json)
  new(**from_json(json))
end
new(time: , **kargs) click to toggle source

Initializes the timeline object.

@param [DateTime] time

Calls superclass method CVESchema::CVE::HasLangValue::new
# File lib/cve_schema/cve/timeline.rb, line 23
def initialize(time: , **kargs)
  super(**kargs)

  @time = time
end