Class: Hachi::Clients::Artifact
- Defined in:
- lib/hachi/clients/artifact.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(case_id, data:, data_type:, message: nil, tlp: nil, tags: nil) ⇒ Hash
Create an artifact.
-
#delete_by_id(id) ⇒ String
Delete an artifact.
-
#get_by_id(id) ⇒ Hash
Get an artifact.
-
#search(query, range: "all") ⇒ Array
Find artifacts.
-
#similar(id) ⇒ Array
Get list of similar observables.
Methods inherited from Base
#delete, #get, #initialize, #patch, #post
Constructor Details
This class inherits a constructor from Hachi::Clients::Base
Instance Method Details
#create(case_id, data:, data_type:, message: nil, tlp: nil, tags: nil) ⇒ Hash
Create an artifact
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/hachi/clients/artifact.rb', line 18 def create(case_id, data:, data_type:, message: nil, tlp: nil, tags: nil) artifact = Models::Artifact.new( data: data, data_type: data_type, message: , tlp: tlp, tags: , ) post("/api/case/#{case_id}/artifact", json: artifact.payload) { |json| json } end |
#delete_by_id(id) ⇒ String
Delete an artifact
48 49 50 |
# File 'lib/hachi/clients/artifact.rb', line 48 def delete_by_id(id) delete("/api/case/artifact/#{id}") { |json| json } end |
#get_by_id(id) ⇒ Hash
Get an artifact
37 38 39 |
# File 'lib/hachi/clients/artifact.rb', line 37 def get_by_id(id) get("/api/case/artifact/#{id}") { |json| json } end |
#search(query, range: "all") ⇒ Array
Find artifacts
60 61 62 |
# File 'lib/hachi/clients/artifact.rb', line 60 def search(query, range: "all") _search("/api/case/artifact/_search", query: query, range: range) { |json| json } end |
#similar(id) ⇒ Array
Get list of similar observables
71 72 73 |
# File 'lib/hachi/clients/artifact.rb', line 71 def similar(id) get("/api/case/artifact/#{id}/similar") { |json| json } end |