class Hachi::Clients::Case

Public Instance Methods

create(title:, description:, severity: nil, start_date: nil, owner: nil, flag: nil, tlp: nil, tags: nil) click to toggle source

Create a case

@param [String, nil] title @param [String, nil] description @param [Integer, nil] severity @param [String, nil] start_date @param [String, nil] owner @param [Boolean, nil] flag @param [Intege, nil] tlp @param [String, nil] tags

@return [Hash]

# 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: tags,
  )

  post("/api/case", json: kase.payload) { |json| json }
end
delete_by_id(id) click to toggle source

Delete a case

@param [String] id Case ID

@return [String]

# File lib/hachi/clients/case.rb, line 33
def delete_by_id(id)
  delete("/api/case/#{id}") { |json| json }
end
get_by_id(id) click to toggle source

Get a case

@param [String] id Case ID

@return [Hash]

# File lib/hachi/clients/case.rb, line 22
def get_by_id(id)
  get("/api/case/#{id}") { |json| json }
end
list() click to toggle source

List cases

@return [Array]

# File lib/hachi/clients/case.rb, line 11
def list
  get("/api/case") { |json| json }
end
merge(id1, id2) click to toggle source

Merge two cases

@param [String] id1 Case ID @param [String] id2 Case ID

@return [Hash]

# File lib/hachi/clients/case.rb, line 97
def merge(id1, id2)
  post("/api/case/#{id1}/_merge/#{id2}") { |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 ) click to toggle source

Update a case

@param [String, nil] id @param [String, nil] title @param [String, nil] description @param [String, nil] severity @param [String, nil] start_date @param [String, nil] owner @param [Boolean, nil] flag @param [Integer, nil] tlp @param [String, nil] tags @param [String, nil] status @param [String, nil] resolution_status @param [String, nil] impact_status @param [String, nil] summary @param [String, nil] end_date @param [String, nil] metrics @param [String, nil] custom_fields

@return [Hash]

# 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: tags,
    status: status,
    resolutionStatus: resolution_status,
    impactStatus: impact_status,
    summary: summary,
    endDate: end_date,
    metrics: metrics,
    customFields: custom_fields
  }.compact
  patch("/api/case/#{id}", json: attributes) { |json| json }
end