Class: CisaKevVulnerability
- Inherits:
-
Object
- Object
- CisaKevVulnerability
- Defined in:
- lib/domain/vulnerability/model.rb
Instance Attribute Summary collapse
-
#added_date ⇒ Object
Returns the value of attribute added_date.
-
#cve_id ⇒ Object
Returns the value of attribute cve_id.
-
#description ⇒ Object
Returns the value of attribute description.
-
#due_date ⇒ Object
Returns the value of attribute due_date.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#product ⇒ Object
Returns the value of attribute product.
-
#ransomware_campaign ⇒ Object
Returns the value of attribute ransomware_campaign.
-
#required_action ⇒ Object
Returns the value of attribute required_action.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
-
#vulnerability_name ⇒ Object
Returns the value of attribute vulnerability_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cve_id:, vendor:, product:, vulnerability_name:, added_date:, due_date:, description:, required_action:, ransomware_campaign:, notes:) ⇒ CisaKevVulnerability
constructor
A new instance of CisaKevVulnerability.
- #to_csv ⇒ Object
-
#to_json(*_args) ⇒ Object
Converts the instance into a JSON string.
- #to_s ⇒ Object
Constructor Details
#initialize(cve_id:, vendor:, product:, vulnerability_name:, added_date:, due_date:, description:, required_action:, ransomware_campaign:, notes:) ⇒ CisaKevVulnerability
Returns a new instance of CisaKevVulnerability.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/domain/vulnerability/model.rb', line 79 def initialize( cve_id:, vendor:, product:, vulnerability_name:, added_date:, due_date:, description:, required_action:, ransomware_campaign:, notes: ) @cve_id = cve_id @vendor = vendor @product = product @vulnerability_name = vulnerability_name @added_date = added_date @due_date = due_date @description = description @required_action = required_action @ransomware_campaign = ransomware_campaign @notes = notes end |
Instance Attribute Details
#added_date ⇒ Object
Returns the value of attribute added_date.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def added_date @added_date end |
#cve_id ⇒ Object
Returns the value of attribute cve_id.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def cve_id @cve_id end |
#description ⇒ Object
Returns the value of attribute description.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def description @description end |
#due_date ⇒ Object
Returns the value of attribute due_date.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def due_date @due_date end |
#notes ⇒ Object
Returns the value of attribute notes.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def notes @notes end |
#product ⇒ Object
Returns the value of attribute product.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def product @product end |
#ransomware_campaign ⇒ Object
Returns the value of attribute ransomware_campaign.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def ransomware_campaign @ransomware_campaign end |
#required_action ⇒ Object
Returns the value of attribute required_action.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def required_action @required_action end |
#vendor ⇒ Object
Returns the value of attribute vendor.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def vendor @vendor end |
#vulnerability_name ⇒ Object
Returns the value of attribute vulnerability_name.
49 50 51 |
# File 'lib/domain/vulnerability/model.rb', line 49 def vulnerability_name @vulnerability_name end |
Class Method Details
.columns ⇒ Object
64 65 66 67 68 |
# File 'lib/domain/vulnerability/model.rb', line 64 def self.columns methods = instance_methods - Object.methods methods.select { |m| m.to_s.end_with?('=') } .map { |m| m.to_s.chop.to_sym } end |
.from_json(json) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/domain/vulnerability/model.rb', line 103 def self.from_json(json) CisaKevVulnerability.new( cve_id: json['cveID'], vendor: json['vendorProject'], product: json['product'], vulnerability_name: json['vulnerabilityName'], added_date: json['dateAdded'], due_date: json['dueDate'], description: json['shortDescription'], required_action: json['requiredAction'], ransomware_campaign: json['knownRansomwareCampaignUse'], notes: json['notes'] ) end |
.primary_key ⇒ Object
70 71 72 |
# File 'lib/domain/vulnerability/model.rb', line 70 def self.primary_key 'cve_id' end |
.table_name ⇒ Object
60 61 62 |
# File 'lib/domain/vulnerability/model.rb', line 60 def self.table_name 'vulnerability_cisa_kev' end |
Instance Method Details
#to_csv ⇒ Object
74 75 76 77 |
# File 'lib/domain/vulnerability/model.rb', line 74 def to_csv self.class.columns .map { |column| send(column.to_sym) } end |
#to_json(*_args) ⇒ Object
Converts the instance into a JSON string
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/domain/vulnerability/model.rb', line 119 def to_json(*_args) hash = { cveID: @cve_id, vendorProject: @vendor, product: @product, vulnerabilityName: @vulnerability_name, dateAdded: @added_date, dueDate: @due_date, shortDescription: @description, requiredAction: @required_action, knownRansomwareCampaignUse: @ransomware_campaign, notes: @notes } JSON.generate(hash) end |
#to_s ⇒ Object
135 136 137 |
# File 'lib/domain/vulnerability/model.rb', line 135 def to_s [cve_id, vendor, product, vulnerability_name, due_date, description].join ',' end |