Class: Falcon::DomainNewsDocument

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DomainNewsDocument

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
281
282
283
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
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 189

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::DomainNewsDocument` 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::DomainNewsDocument`. 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?(:'active')
    self.active = attributes[:'active']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#activeObject

legacy field, not used



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

def active
  @active
end

#actorsObject

Actors mentioned, related or referenced in the news/report



38
39
40
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 38

def actors
  @actors
end

#attachmentsObject

News attachment, containing either pdf url or feeds zip and/or gzip archive



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

def attachments
  @attachments
end

#created_dateObject

Date of the news document creation, Unix timestamp



44
45
46
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 44

def created_date
  @created_date
end

#descriptionObject

Full report description, extracted from the document



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

def description
  @description
end

#entitlementsObject

internal property used for permissions check of access, not returned or explicitly filterable



50
51
52
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 50

def entitlements
  @entitlements
end

#idObject

Integer ID of the News document



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

def id
  @id
end

#imageObject

Returns the value of attribute image.



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

def image
  @image
end

#last_modified_dateObject

Date of the news document last modification, Unix timestamp



58
59
60
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 58

def last_modified_date
  @last_modified_date
end

#malwareObject

Malware mentioned, related or referenced in the news/report



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

def malware
  @malware
end

#motivationsObject

News mentioned motivation or motivation of related actors and malware families



64
65
66
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 64

def motivations
  @motivations
end

#nameObject

News title



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

def name
  @name
end

#notify_usersObject

internal field, not used



70
71
72
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 70

def notify_users
  @notify_users
end

#read_time_in_minutesObject

Time it takes an average user to read the news content



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

def read_time_in_minutes
  @read_time_in_minutes
end

#rich_text_descriptionObject

Rich text description with markup



76
77
78
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 76

def rich_text_description
  @rich_text_description
end

#rich_text_short_descriptionObject

Rich text short description with markup



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

def rich_text_short_description
  @rich_text_short_description
end

#short_descriptionObject

Short description of the report content



82
83
84
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 82

def short_description
  @short_description
end

#slugObject

News title in a url friendly way, which is title in lowercase and special characters including space replaced with dash



85
86
87
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 85

def slug
  @slug
end

#sub_typeObject

Returns the value of attribute sub_type.



87
88
89
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 87

def sub_type
  @sub_type
end

#summaryObject

Summary of the report content



90
91
92
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 90

def summary
  @summary
end

#tagsObject

News tags, which contains MITRE, Vulnerability community identifiers, capabilities, malware family name, customer target, activity cluster, notable event, geopolitical issue



93
94
95
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 93

def tags
  @tags
end

#target_countriesObject

News mentioned target countries or related actor’s target countries



96
97
98
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 96

def target_countries
  @target_countries
end

#target_industriesObject

News mentioned target industries or related actor’s target industries



99
100
101
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 99

def target_industries
  @target_industries
end

#thumbnailObject

Returns the value of attribute thumbnail.



101
102
103
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 101

def thumbnail
  @thumbnail
end

#topicObject

Returns the value of attribute topic.



103
104
105
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 103

def topic
  @topic
end

#typeObject

Returns the value of attribute type.



105
106
107
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 105

def type
  @type
end

#urlObject

URL of the news document where it can be accessed in the Falcon Portal



108
109
110
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 108

def url
  @url
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



144
145
146
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 144

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 111

def self.attribute_map
  {
    :'active' => :'active',
    :'actors' => :'actors',
    :'attachments' => :'attachments',
    :'created_date' => :'created_date',
    :'description' => :'description',
    :'entitlements' => :'entitlements',
    :'id' => :'id',
    :'image' => :'image',
    :'last_modified_date' => :'last_modified_date',
    :'malware' => :'malware',
    :'motivations' => :'motivations',
    :'name' => :'name',
    :'notify_users' => :'notify_users',
    :'read_time_in_minutes' => :'read_time_in_minutes',
    :'rich_text_description' => :'rich_text_description',
    :'rich_text_short_description' => :'rich_text_short_description',
    :'short_description' => :'short_description',
    :'slug' => :'slug',
    :'sub_type' => :'sub_type',
    :'summary' => :'summary',
    :'tags' => :'tags',
    :'target_countries' => :'target_countries',
    :'target_industries' => :'target_industries',
    :'thumbnail' => :'thumbnail',
    :'topic' => :'topic',
    :'type' => :'type',
    :'url' => :'url'
  }
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



444
445
446
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 444

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

.openapi_nullableObject

List of attributes with nullable: true



182
183
184
185
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 182

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

.openapi_typesObject

Attribute type mapping.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 149

def self.openapi_types
  {
    :'active' => :'Boolean',
    :'actors' => :'Array<DomainSimpleActor>',
    :'attachments' => :'Array<DomainFile>',
    :'created_date' => :'Integer',
    :'description' => :'String',
    :'entitlements' => :'Array<DomainEntity>',
    :'id' => :'Integer',
    :'image' => :'DomainImage',
    :'last_modified_date' => :'Integer',
    :'malware' => :'Array<DomainReportMalware>',
    :'motivations' => :'Array<DomainEntity>',
    :'name' => :'String',
    :'notify_users' => :'Boolean',
    :'read_time_in_minutes' => :'Integer',
    :'rich_text_description' => :'String',
    :'rich_text_short_description' => :'String',
    :'short_description' => :'String',
    :'slug' => :'String',
    :'sub_type' => :'DomainEntity',
    :'summary' => :'String',
    :'tags' => :'Array<DomainEntity>',
    :'target_countries' => :'Array<DomainEntity>',
    :'target_industries' => :'Array<DomainEntity>',
    :'thumbnail' => :'DomainImage',
    :'topic' => :'DomainEntity',
    :'type' => :'DomainEntity',
    :'url' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 397

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      active == o.active &&
      actors == o.actors &&
      attachments == o.attachments &&
      created_date == o.created_date &&
      description == o.description &&
      entitlements == o.entitlements &&
      id == o.id &&
      image == o.image &&
      last_modified_date == o.last_modified_date &&
      malware == o.malware &&
      motivations == o.motivations &&
      name == o.name &&
      notify_users == o.notify_users &&
      read_time_in_minutes == o.read_time_in_minutes &&
      rich_text_description == o.rich_text_description &&
      rich_text_short_description == o.rich_text_short_description &&
      short_description == o.short_description &&
      slug == o.slug &&
      sub_type == o.sub_type &&
      summary == o.summary &&
      tags == o.tags &&
      target_countries == o.target_countries &&
      target_industries == o.target_industries &&
      thumbnail == o.thumbnail &&
      topic == o.topic &&
      type == o.type &&
      url == o.url
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



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 475

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



546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 546

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



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 451

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


431
432
433
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 431

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



437
438
439
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 437

def hash
  [active, actors, attachments, created_date, description, entitlements, id, image, last_modified_date, malware, motivations, name, notify_users, read_time_in_minutes, rich_text_description, rich_text_short_description, short_description, slug, sub_type, summary, tags, target_countries, target_industries, thumbnail, topic, type, url].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 329

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

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

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

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

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

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

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

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

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

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

  if @thumbnail.nil?
    invalid_properties.push('invalid value for "thumbnail", thumbnail 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



522
523
524
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 522

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



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

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



516
517
518
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 516

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



380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/crimson-falcon/models/domain_news_document.rb', line 380

def valid?
  return false if @actors.nil?
  return false if @created_date.nil?
  return false if @id.nil?
  return false if @last_modified_date.nil?
  return false if @motivations.nil?
  return false if @name.nil?
  return false if @slug.nil?
  return false if @tags.nil?
  return false if @target_countries.nil?
  return false if @target_industries.nil?
  return false if @thumbnail.nil?
  true
end