Class: Falcon::DomainItemDetailsV1

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DomainItemDetailsV1

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 191

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#actor_slugObject

Threat actor associated with the raw intelligence item, if available



36
37
38
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 36

def actor_slug
  @actor_slug
end

#attachmentsObject

Pointers to attachments items linked to this item



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

def attachments
  @attachments
end

#authorObject

The raw intelligence item author username



42
43
44
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 42

def author
  @author
end

#author_idObject

The raw intelligence item author identifier in our system



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

def author_id
  @author_id
end

#categoryObject

Category of the source where the item was found



48
49
50
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 48

def category
  @category
end

#collection_dateObject

The date when the raw intelligence item was scraped from the original source



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

def collection_date
  @collection_date
end

#contentObject

Highlighted content based on the rule that generated the notifications. Highlights are surrounded with a ‘<cs-highlight>` tag



54
55
56
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 54

def content
  @content
end

#created_dateObject

The date when the raw intelligence item was created



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

def created_date
  @created_date
end

#file_typeObject

Mime type of the file for file type items



60
61
62
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 60

def file_type
  @file_type
end

#fragment_infoObject

Returns the value of attribute fragment_info.



62
63
64
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 62

def fragment_info
  @fragment_info
end

#ioc_typesObject

IOC types available in the raw intelligence item. List of keys populated in the iocs field



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

def ioc_types
  @ioc_types
end

#iocsObject

Returns the value of attribute iocs.



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

def iocs
  @iocs
end

#labelsObject

The raw intelligence item labels. These contain hints around what is actually included in the item (malware, IPs, emails, etc).



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

def labels
  @labels
end

#languageObject

The raw intelligence item language



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

def language
  @language
end

#marketplace_productObject

Returns the value of attribute marketplace_product.



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

def marketplace_product
  @marketplace_product
end

#mime_typeObject

Mime type of the file for file type items



78
79
80
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 78

def mime_type
  @mime_type
end

#sha256Object

SHA256 of the file contents for file type items



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

def sha256
  @sha256
end

#siteObject

The site where the raw intelligence item was found



84
85
86
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 84

def site
  @site
end

#site_idObject

The ID of the site where the raw intelligence item was found



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

def site_id
  @site_id
end

#sizeObject

Size of the item’s content in bytes, if available



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

def size
  @size
end

#telegram_infoObject

Returns the value of attribute telegram_info.



92
93
94
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 92

def telegram_info
  @telegram_info
end

#thread_idObject

Identifier that groups all raw intelligence items belonging to the same ‘conversation stream’, i.e. chatroom, forum thread, etc.



95
96
97
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 95

def thread_id
  @thread_id
end

#titleObject

The raw intelligence item title



98
99
100
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 98

def title
  @title
end

#typeObject

The type of the raw intelligence item



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

def type
  @type
end

#updated_dateObject

The date when the raw intelligence item was updated



104
105
106
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 104

def updated_date
  @updated_date
end

#urlObject

The raw intelligence item URL



107
108
109
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 107

def url
  @url
end

#user_idObject

The raw intelligence item author identifier in the original site



110
111
112
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 110

def user_id
  @user_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



146
147
148
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 146

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
142
143
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 113

def self.attribute_map
  {
    :'actor_slug' => :'actor_slug',
    :'attachments' => :'attachments',
    :'author' => :'author',
    :'author_id' => :'author_id',
    :'category' => :'category',
    :'collection_date' => :'collection_date',
    :'content' => :'content',
    :'created_date' => :'created_date',
    :'file_type' => :'file_type',
    :'fragment_info' => :'fragment_info',
    :'ioc_types' => :'ioc_types',
    :'iocs' => :'iocs',
    :'labels' => :'labels',
    :'language' => :'language',
    :'marketplace_product' => :'marketplace_product',
    :'mime_type' => :'mime_type',
    :'sha256' => :'sha256',
    :'site' => :'site',
    :'site_id' => :'site_id',
    :'size' => :'size',
    :'telegram_info' => :'telegram_info',
    :'thread_id' => :'thread_id',
    :'title' => :'title',
    :'type' => :'type',
    :'updated_date' => :'updated_date',
    :'url' => :'url',
    :'user_id' => :'user_id'
  }
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



411
412
413
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 411

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

.openapi_nullableObject

List of attributes with nullable: true



184
185
186
187
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 184

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

.openapi_typesObject

Attribute type mapping.



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
180
181
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 151

def self.openapi_types
  {
    :'actor_slug' => :'String',
    :'attachments' => :'Array<DomainAttachment>',
    :'author' => :'String',
    :'author_id' => :'String',
    :'category' => :'String',
    :'collection_date' => :'Time',
    :'content' => :'String',
    :'created_date' => :'Time',
    :'file_type' => :'String',
    :'fragment_info' => :'DomainFragmentInfo',
    :'ioc_types' => :'Array<String>',
    :'iocs' => :'DomainIOC',
    :'labels' => :'Array<String>',
    :'language' => :'String',
    :'marketplace_product' => :'DomainMarketplaceProduct',
    :'mime_type' => :'String',
    :'sha256' => :'String',
    :'site' => :'String',
    :'site_id' => :'String',
    :'size' => :'Integer',
    :'telegram_info' => :'DomainTelegramInfo',
    :'thread_id' => :'String',
    :'title' => :'String',
    :'type' => :'String',
    :'updated_date' => :'Time',
    :'url' => :'String',
    :'user_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 364

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      actor_slug == o.actor_slug &&
      attachments == o.attachments &&
      author == o.author &&
      author_id == o.author_id &&
      category == o.category &&
      collection_date == o.collection_date &&
      content == o.content &&
      created_date == o.created_date &&
      file_type == o.file_type &&
      fragment_info == o.fragment_info &&
      ioc_types == o.ioc_types &&
      iocs == o.iocs &&
      labels == o.labels &&
      language == o.language &&
      marketplace_product == o.marketplace_product &&
      mime_type == o.mime_type &&
      sha256 == o.sha256 &&
      site == o.site &&
      site_id == o.site_id &&
      size == o.size &&
      telegram_info == o.telegram_info &&
      thread_id == o.thread_id &&
      title == o.title &&
      type == o.type &&
      updated_date == o.updated_date &&
      url == o.url &&
      user_id == o.user_id
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



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 442

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



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

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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 418

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


398
399
400
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 398

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



404
405
406
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 404

def hash
  [actor_slug, attachments, author, author_id, category, collection_date, content, created_date, file_type, fragment_info, ioc_types, iocs, labels, language, marketplace_product, mime_type, sha256, site, site_id, size, telegram_info, thread_id, title, type, updated_date, url, user_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 321

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

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

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

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

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

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



489
490
491
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 489

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



495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 495

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



483
484
485
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 483

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



352
353
354
355
356
357
358
359
360
# File 'lib/crimson-falcon/models/domain_item_details_v1.rb', line 352

def valid?
  return false if @category.nil?
  return false if @content.nil?
  return false if @created_date.nil?
  return false if @site_id.nil?
  return false if @type.nil?
  return false if @updated_date.nil?
  true
end