Class: Falcon::DomainCVE

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/domain_cve.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DomainCVE

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/crimson-falcon/models/domain_cve.rb', line 160

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::DomainCVE` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Falcon::DomainCVE`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'actors')
    if (value = attributes[:'actors']).is_a?(Array)
      self.actors = value
    end
  end

  if attributes.key?(:'additional_info')
    self.additional_info = attributes[:'additional_info']
  end

  if attributes.key?(:'base_score')
    self.base_score = attributes[:'base_score']
  end

  if attributes.key?(:'cisa_kev_info')
    self.cisa_kev_info = attributes[:'cisa_kev_info']
  end

  if attributes.key?(:'content_packages')
    if (value = attributes[:'content_packages']).is_a?(Array)
      self.content_packages = value
    end
  end

  if attributes.key?(:'cps_rating')
    self.cps_rating = attributes[:'cps_rating']
  end

  if attributes.key?(:'cvss_v2_score')
    self.cvss_v2_score = attributes[:'cvss_v2_score']
  end

  if attributes.key?(:'cvss_v3_score')
    self.cvss_v3_score = attributes[:'cvss_v3_score']
  end

  if attributes.key?(:'cvss_version')
    self.cvss_version = attributes[:'cvss_version']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'exploitability_score')
    self.exploitability_score = attributes[:'exploitability_score']
  end

  if attributes.key?(:'exploited')
    self.exploited = attributes[:'exploited']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'impact_score')
    self.impact_score = attributes[:'impact_score']
  end

  if attributes.key?(:'is_supported')
    self.is_supported = attributes[:'is_supported']
  end

  if attributes.key?(:'metadata_hash')
    self. = attributes[:'metadata_hash']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'published_date')
    self.published_date = attributes[:'published_date']
  end

  if attributes.key?(:'references')
    if (value = attributes[:'references']).is_a?(Array)
      self.references = value
    end
  end

  if attributes.key?(:'severity')
    self.severity = attributes[:'severity']
  end

  if attributes.key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.key?(:'source_type')
    self.source_type = attributes[:'source_type']
  end

  if attributes.key?(:'spotlight_published_date')
    self.spotlight_published_date = attributes[:'spotlight_published_date']
  end

  if attributes.key?(:'types')
    if (value = attributes[:'types']).is_a?(Array)
      self.types = value
    end
  end

  if attributes.key?(:'vector')
    self.vector = attributes[:'vector']
  end
end

Instance Attribute Details

#actorsObject

Returns the value of attribute actors.



35
36
37
# File 'lib/crimson-falcon/models/domain_cve.rb', line 35

def actors
  @actors
end

#additional_infoObject

Returns the value of attribute additional_info.



37
38
39
# File 'lib/crimson-falcon/models/domain_cve.rb', line 37

def additional_info
  @additional_info
end

#base_scoreObject

Returns the value of attribute base_score.



39
40
41
# File 'lib/crimson-falcon/models/domain_cve.rb', line 39

def base_score
  @base_score
end

#cisa_kev_infoObject

Returns the value of attribute cisa_kev_info.



41
42
43
# File 'lib/crimson-falcon/models/domain_cve.rb', line 41

def cisa_kev_info
  @cisa_kev_info
end

#content_packagesObject

Returns the value of attribute content_packages.



43
44
45
# File 'lib/crimson-falcon/models/domain_cve.rb', line 43

def content_packages
  @content_packages
end

#cps_ratingObject

Returns the value of attribute cps_rating.



45
46
47
# File 'lib/crimson-falcon/models/domain_cve.rb', line 45

def cps_rating
  @cps_rating
end

#cvss_v2_scoreObject

Returns the value of attribute cvss_v2_score.



47
48
49
# File 'lib/crimson-falcon/models/domain_cve.rb', line 47

def cvss_v2_score
  @cvss_v2_score
end

#cvss_v3_scoreObject

Returns the value of attribute cvss_v3_score.



49
50
51
# File 'lib/crimson-falcon/models/domain_cve.rb', line 49

def cvss_v3_score
  @cvss_v3_score
end

#cvss_versionObject

Returns the value of attribute cvss_version.



51
52
53
# File 'lib/crimson-falcon/models/domain_cve.rb', line 51

def cvss_version
  @cvss_version
end

#descriptionObject

Returns the value of attribute description.



53
54
55
# File 'lib/crimson-falcon/models/domain_cve.rb', line 53

def description
  @description
end

#exploitability_scoreObject

Returns the value of attribute exploitability_score.



55
56
57
# File 'lib/crimson-falcon/models/domain_cve.rb', line 55

def exploitability_score
  @exploitability_score
end

#exploitedObject

Returns the value of attribute exploited.



57
58
59
# File 'lib/crimson-falcon/models/domain_cve.rb', line 57

def exploited
  @exploited
end

#idObject

Returns the value of attribute id.



59
60
61
# File 'lib/crimson-falcon/models/domain_cve.rb', line 59

def id
  @id
end

#impact_scoreObject

Returns the value of attribute impact_score.



61
62
63
# File 'lib/crimson-falcon/models/domain_cve.rb', line 61

def impact_score
  @impact_score
end

#is_supportedObject

Returns the value of attribute is_supported.



63
64
65
# File 'lib/crimson-falcon/models/domain_cve.rb', line 63

def is_supported
  @is_supported
end

#metadata_hashObject

Returns the value of attribute metadata_hash.



65
66
67
# File 'lib/crimson-falcon/models/domain_cve.rb', line 65

def 
  @metadata_hash
end

#nameObject

Returns the value of attribute name.



67
68
69
# File 'lib/crimson-falcon/models/domain_cve.rb', line 67

def name
  @name
end

#published_dateObject

Returns the value of attribute published_date.



69
70
71
# File 'lib/crimson-falcon/models/domain_cve.rb', line 69

def published_date
  @published_date
end

#referencesObject

Returns the value of attribute references.



71
72
73
# File 'lib/crimson-falcon/models/domain_cve.rb', line 71

def references
  @references
end

#severityObject

Returns the value of attribute severity.



73
74
75
# File 'lib/crimson-falcon/models/domain_cve.rb', line 73

def severity
  @severity
end

#sourceObject

Returns the value of attribute source.



75
76
77
# File 'lib/crimson-falcon/models/domain_cve.rb', line 75

def source
  @source
end

#source_typeObject

Returns the value of attribute source_type.



77
78
79
# File 'lib/crimson-falcon/models/domain_cve.rb', line 77

def source_type
  @source_type
end

#spotlight_published_dateObject

Returns the value of attribute spotlight_published_date.



79
80
81
# File 'lib/crimson-falcon/models/domain_cve.rb', line 79

def spotlight_published_date
  @spotlight_published_date
end

#typesObject

Returns the value of attribute types.



81
82
83
# File 'lib/crimson-falcon/models/domain_cve.rb', line 81

def types
  @types
end

#vectorObject

Returns the value of attribute vector.



83
84
85
# File 'lib/crimson-falcon/models/domain_cve.rb', line 83

def vector
  @vector
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/crimson-falcon/models/domain_cve.rb', line 117

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/crimson-falcon/models/domain_cve.rb', line 86

def self.attribute_map
  {
    :'actors' => :'actors',
    :'additional_info' => :'additional_info',
    :'base_score' => :'base_score',
    :'cisa_kev_info' => :'cisa_kev_info',
    :'content_packages' => :'content_packages',
    :'cps_rating' => :'cps_rating',
    :'cvss_v2_score' => :'cvss_v2_score',
    :'cvss_v3_score' => :'cvss_v3_score',
    :'cvss_version' => :'cvss_version',
    :'description' => :'description',
    :'exploitability_score' => :'exploitability_score',
    :'exploited' => :'exploited',
    :'id' => :'id',
    :'impact_score' => :'impact_score',
    :'is_supported' => :'is_supported',
    :'metadata_hash' => :'metadata_hash',
    :'name' => :'name',
    :'published_date' => :'published_date',
    :'references' => :'references',
    :'severity' => :'severity',
    :'source' => :'source',
    :'source_type' => :'source_type',
    :'spotlight_published_date' => :'spotlight_published_date',
    :'types' => :'types',
    :'vector' => :'vector'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



427
428
429
# File 'lib/crimson-falcon/models/domain_cve.rb', line 427

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



153
154
155
156
# File 'lib/crimson-falcon/models/domain_cve.rb', line 153

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/crimson-falcon/models/domain_cve.rb', line 122

def self.openapi_types
  {
    :'actors' => :'Array<String>',
    :'additional_info' => :'String',
    :'base_score' => :'Float',
    :'cisa_kev_info' => :'DomainCISAKnownExploitedVulnerabilitiesInfo',
    :'content_packages' => :'Array<DomainContentPackage>',
    :'cps_rating' => :'DomainCPSRating',
    :'cvss_v2_score' => :'DomainCVSSv2',
    :'cvss_v3_score' => :'DomainCVSSv3',
    :'cvss_version' => :'String',
    :'description' => :'String',
    :'exploitability_score' => :'Float',
    :'exploited' => :'DomainCVEExploit',
    :'id' => :'String',
    :'impact_score' => :'Float',
    :'is_supported' => :'Boolean',
    :'metadata_hash' => :'Integer',
    :'name' => :'String',
    :'published_date' => :'Time',
    :'references' => :'Array<DomainReference>',
    :'severity' => :'String',
    :'source' => :'String',
    :'source_type' => :'String',
    :'spotlight_published_date' => :'Time',
    :'types' => :'Array<String>',
    :'vector' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/crimson-falcon/models/domain_cve.rb', line 382

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      actors == o.actors &&
      additional_info == o.additional_info &&
      base_score == o.base_score &&
      cisa_kev_info == o.cisa_kev_info &&
      content_packages == o.content_packages &&
      cps_rating == o.cps_rating &&
      cvss_v2_score == o.cvss_v2_score &&
      cvss_v3_score == o.cvss_v3_score &&
      cvss_version == o.cvss_version &&
      description == o.description &&
      exploitability_score == o.exploitability_score &&
      exploited == o.exploited &&
      id == o.id &&
      impact_score == o.impact_score &&
      is_supported == o.is_supported &&
       == o. &&
      name == o.name &&
      published_date == o.published_date &&
      references == o.references &&
      severity == o.severity &&
      source == o.source &&
      source_type == o.source_type &&
      spotlight_published_date == o.spotlight_published_date &&
      types == o.types &&
      vector == o.vector
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/crimson-falcon/models/domain_cve.rb', line 458

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Falcon.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/crimson-falcon/models/domain_cve.rb', line 529

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/crimson-falcon/models/domain_cve.rb', line 434

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


414
415
416
# File 'lib/crimson-falcon/models/domain_cve.rb', line 414

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



420
421
422
# File 'lib/crimson-falcon/models/domain_cve.rb', line 420

def hash
  [actors, additional_info, base_score, cisa_kev_info, content_packages, cps_rating, cvss_v2_score, cvss_v3_score, cvss_version, description, exploitability_score, exploited, id, impact_score, is_supported, , name, published_date, references, severity, source, source_type, spotlight_published_date, types, vector].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/crimson-falcon/models/domain_cve.rb', line 284

def list_invalid_properties
  invalid_properties = Array.new
  if @actors.nil?
    invalid_properties.push('invalid value for "actors", actors cannot be nil.')
  end

  if @base_score.nil?
    invalid_properties.push('invalid value for "base_score", base_score cannot be nil.')
  end

  if @cisa_kev_info.nil?
    invalid_properties.push('invalid value for "cisa_kev_info", cisa_kev_info cannot be nil.')
  end

  if @cps_rating.nil?
    invalid_properties.push('invalid value for "cps_rating", cps_rating cannot be nil.')
  end

  if @cvss_version.nil?
    invalid_properties.push('invalid value for "cvss_version", cvss_version cannot be nil.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @is_supported.nil?
    invalid_properties.push('invalid value for "is_supported", is_supported cannot be nil.')
  end

  if @metadata_hash.nil?
    invalid_properties.push('invalid value for "metadata_hash", metadata_hash cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @published_date.nil?
    invalid_properties.push('invalid value for "published_date", published_date cannot be nil.')
  end

  if @references.nil?
    invalid_properties.push('invalid value for "references", references cannot be nil.')
  end

  if @severity.nil?
    invalid_properties.push('invalid value for "severity", severity cannot be nil.')
  end

  if @source.nil?
    invalid_properties.push('invalid value for "source", source cannot be nil.')
  end

  if @source_type.nil?
    invalid_properties.push('invalid value for "source_type", source_type cannot be nil.')
  end

  if @spotlight_published_date.nil?
    invalid_properties.push('invalid value for "spotlight_published_date", spotlight_published_date cannot be nil.')
  end

  if @types.nil?
    invalid_properties.push('invalid value for "types", types cannot be nil.')
  end

  if @vector.nil?
    invalid_properties.push('invalid value for "vector", vector cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



505
506
507
# File 'lib/crimson-falcon/models/domain_cve.rb', line 505

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/crimson-falcon/models/domain_cve.rb', line 511

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



499
500
501
# File 'lib/crimson-falcon/models/domain_cve.rb', line 499

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/crimson-falcon/models/domain_cve.rb', line 359

def valid?
  return false if @actors.nil?
  return false if @base_score.nil?
  return false if @cisa_kev_info.nil?
  return false if @cps_rating.nil?
  return false if @cvss_version.nil?
  return false if @id.nil?
  return false if @is_supported.nil?
  return false if @metadata_hash.nil?
  return false if @name.nil?
  return false if @published_date.nil?
  return false if @references.nil?
  return false if @severity.nil?
  return false if @source.nil?
  return false if @source_type.nil?
  return false if @spotlight_published_date.nil?
  return false if @types.nil?
  return false if @vector.nil?
  true
end