Class: NVD::JSONFeeds::Schema::CVEItem
- Inherits:
-
Object
- Object
- NVD::JSONFeeds::Schema::CVEItem
- Defined in:
- lib/nvd/json_feeds/schema/cve_item.rb
Overview
Represents the "CVE_Item"
JSON object.
Instance Attribute Summary collapse
- #configurations ⇒ Configurations? readonly
-
#cve ⇒ CVESchema::CVE
readonly
The CVE object.
- #impact ⇒ Impact? readonly
- #last_modified_date ⇒ DateTime? readonly
- #published_date ⇒ DateTime? readonly
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ CVEItem
Loads the CVE Item object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(cve:, configurations: nil, impact: nil, published_date: nil, last_modified_date: nil) ⇒ CVEItem
constructor
Initializes the CVE Item object.
Constructor Details
#initialize(cve:, configurations: nil, impact: nil, published_date: nil, last_modified_date: nil) ⇒ CVEItem
Initializes the CVE Item object.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 37 def initialize(cve: , configurations: nil, impact: nil, published_date: nil, last_modified_date: nil) @cve = cve @configurations = configurations @impact = impact @published_date = published_date @last_modified_date = last_modified_date end |
Instance Attribute Details
#configurations ⇒ Configurations? (readonly)
20 21 22 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 20 def configurations @configurations end |
#cve ⇒ CVESchema::CVE (readonly)
The CVE object.
17 18 19 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 17 def cve @cve end |
#impact ⇒ Impact? (readonly)
23 24 25 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 23 def impact @impact end |
#last_modified_date ⇒ DateTime? (readonly)
29 30 31 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 29 def last_modified_date @last_modified_date end |
#published_date ⇒ DateTime? (readonly)
26 27 28 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 26 def published_date @published_date end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 58 def self.from_json(json) { cve: CVESchema::CVE.load(json.fetch('cve')), configurations: if (configurations = json['configurations']) Configurations.load(configurations) end, impact: if (impact = json['impact']) Impact.load(impact) end, published_date: if (published_date = json['publishedDate']) Timestamp.parse(published_date) end, last_modified_date: if (last_modified_date = json['lastModifiedDate']) Timestamp.parse(last_modified_date) end } end |
.load(json) ⇒ CVEItem
Loads the CVE Item object from the parsed JSON.
87 88 89 |
# File 'lib/nvd/json_feeds/schema/cve_item.rb', line 87 def self.load(json) new(**from_json(json)) end |