Class: Hachi::Clients::Case
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil) ⇒ Hash
Create a case.
-
#delete_by_id(id) ⇒ String
Delete a case.
-
#get_by_id(id) ⇒ Hash
Get a case.
-
#links(id) ⇒ Array
Get list of cases linked to this case.
-
#list ⇒ Array
List cases.
-
#merge(id1, id2) ⇒ Hash
Merge two cases.
-
#search(range: "all", **attributes) ⇒ Hash
Find cases.
-
#update(id, title: nil, description: nil, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil, status: nil, resolution_status: nil, impact_status: nil, summary: nil, end_date: nil, metrics: nil, custom_fields: nil) ⇒ Hash
Update a case.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hachi::Clients::Base
Instance Method Details
#create(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil) ⇒ Hash
Create a case
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/hachi/clients/case.rb', line 51 def create(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil) kase = Models::Case.new( title: title, description: description, severity: severity, start_date: start_date, owner: owner, flag: flag, tlp: tlp, tags: , ) post("/api/case", kase.payload) { |json| json } end |
#delete_by_id(id) ⇒ String
Delete a case
33 34 35 |
# File 'lib/hachi/clients/case.rb', line 33 def delete_by_id(id) delete("/api/case/#{id}") { |json| json } end |
#get_by_id(id) ⇒ Hash
Get a case
22 23 24 |
# File 'lib/hachi/clients/case.rb', line 22 def get_by_id(id) get("/api/case/#{id}") { |json| json } end |
#links(id) ⇒ Array
Get list of cases linked to this case
85 86 87 |
# File 'lib/hachi/clients/case.rb', line 85 def links(id) get("/api/case/#{id}/links") { |json| json } end |
#list ⇒ Array
List cases
11 12 13 |
# File 'lib/hachi/clients/case.rb', line 11 def list get("/api/case") { |json| json } end |
#merge(id1, id2) ⇒ Hash
Merge two cases
97 98 99 |
# File 'lib/hachi/clients/case.rb', line 97 def merge(id1, id2) post("/api/case/#{id1}/_merge/#{id2}") { |json| json } end |
#search(range: "all", **attributes) ⇒ Hash
Find cases
74 75 76 |
# File 'lib/hachi/clients/case.rb', line 74 def search(range: "all", **attributes) _search("/api/case/_search", attributes: attributes, range: range) { |json| json } end |
#update(id, title: nil, description: nil, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil, status: nil, resolution_status: nil, impact_status: nil, summary: nil, end_date: nil, metrics: nil, custom_fields: nil) ⇒ Hash
Update a case
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/hachi/clients/case.rb', line 123 def update(id, title: nil, description: nil, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil, status: nil, resolution_status: nil, impact_status: nil, summary: nil, end_date: nil, metrics: nil, custom_fields: nil ) attributes = { title: title, description: description, severity: severity, startDate: start_date, owner: owner, flag: flag, tlp: tlp, tags: , status: status, resolutionStatus: resolution_status, impactStatus: impact_status, summary: summary, endDate: end_date, metrics: metrics, customFields: custom_fields }.compact patch("/api/case/#{id}", attributes) { |json| json } end |