Class: ActiveStix::MarkingDefinition

Inherits:
ApplicationRecord show all
Defined in:
app/models/active_stix/marking_definition.rb

Overview

todo

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_by_id(id, parent_obj_id = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/models/active_stix/marking_definition.rb', line 9

def self.create_by_id(id, parent_obj_id = nil)
  if parent_obj_id == nil
    mark_def = find_or_create_by(stix_id:id)
  else
    mark_def = find_or_create_by(stix_id:id, relationship_ref: parent_obj_id)
  end
  mark_def
end

.ingest_json(obj) ⇒ Object



4
5
6
7
# File 'app/models/active_stix/marking_definition.rb', line 4

def self.ingest_json(obj)
  marking_def = find_or_create_by(stix_id:obj['id'])
  marking_def
end

Instance Method Details

#convert_to_jsonObject



18
19
20
# File 'app/models/active_stix/marking_definition.rb', line 18

def convert_to_json
  stix_id
end