Class: NVD::JSONFeeds::Schema::CPE::Match
- Inherits:
-
Object
- Object
- NVD::JSONFeeds::Schema::CPE::Match
- Includes:
- HasURI
- Defined in:
- lib/nvd/json_feeds/schema/cpe/match.rb
Overview
Represents the "cpe_match"
value.
Instance Attribute Summary collapse
- #cpe_name ⇒ Array<Name> readonly
- #version_end_excluding ⇒ String? readonly
- #version_end_including ⇒ String? readonly
- #version_start_excluding ⇒ String? readonly
- #version_start_including ⇒ String? readonly
- #vulnerable ⇒ Boolean readonly
Attributes included from HasURI
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the CPE match JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ Match
Loads the CPE match object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(vulnerable:, version_start_excluding: nil, version_start_including: nil, version_end_excluding: nil, version_end_including: nil, cpe_name: [], **kwargs) ⇒ Match
constructor
Initializes the CPE match object.
-
#vulnerable? ⇒ Boolean
Determines if the CPE match indicates whether it's vulnerable.
Methods included from HasURI
Constructor Details
#initialize(vulnerable:, version_start_excluding: nil, version_start_including: nil, version_end_excluding: nil, version_end_including: nil, cpe_name: [], **kwargs) ⇒ Match
Initializes the CPE match object.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 47 def initialize(vulnerable: , version_start_excluding: nil, version_start_including: nil, version_end_excluding: nil, version_end_including: nil, cpe_name: [], **kwargs) super(**kwargs) @vulnerable = vulnerable @version_start_excluding = version_start_excluding @version_start_including = version_start_including @version_end_excluding = version_end_excluding @version_end_including = version_end_including @cpe_name = cpe_name end |
Instance Attribute Details
#cpe_name ⇒ Array<Name> (readonly)
30 31 32 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 30 def cpe_name @cpe_name end |
#version_end_excluding ⇒ String? (readonly)
24 25 26 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 24 def version_end_excluding @version_end_excluding end |
#version_end_including ⇒ String? (readonly)
27 28 29 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 27 def version_end_including @version_end_including end |
#version_start_excluding ⇒ String? (readonly)
18 19 20 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 18 def version_start_excluding @version_start_excluding end |
#version_start_including ⇒ String? (readonly)
21 22 23 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 21 def version_start_including @version_start_including end |
#vulnerable ⇒ Boolean (readonly)
15 16 17 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 15 def vulnerable @vulnerable end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the CPE match JSON to a Symbol Hash for #initialize.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 84 def self.from_json(json) { vulnerable: json.fetch('vulnerable'), **super(json), version_start_excluding: json['versionStartExcluding'], version_start_including: json['versionStartIncluding'], version_end_excluding: json['versionEndExcluding'], version_end_including: json['versionEndIncluding'], cpe_name: Array(json['cpe_name']).map(&Name.method(:load)) } end |
.load(json) ⇒ Match
Loads the CPE match object from the parsed JSON.
109 110 111 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 109 def self.load(json) new(**from_json(json)) end |
Instance Method Details
#vulnerable? ⇒ Boolean
Determines if the CPE match indicates whether it's vulnerable.
71 72 73 |
# File 'lib/nvd/json_feeds/schema/cpe/match.rb', line 71 def vulnerable? @vulnerable == true end |