hachi 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '086d5b7a1c871c39a5913f99bc98e215bc2a51abba1ce645be1e8de47565ebcd'
4
- data.tar.gz: db42c7b0091cf6a58f75a22df7591452a3a1f53c2e4b7bf8850cbc08ce4a2461
3
+ metadata.gz: e065fd460cb9324e124aef7c1f779c2c4d2eb4368248be8b64de1ccff687dc99
4
+ data.tar.gz: ee69559c7d0d3d2e494bf8fc64fc743b60404f15701f8ad2acfec1fb7d629e9f
5
5
  SHA512:
6
- metadata.gz: 6729860b84933e9b3d7100426a45394a3047f305c1eb323263f55d8219d1559e8cb6131b33b1407d129349b5733f012e6b8fa9a0073946968953dfb6d53640f9
7
- data.tar.gz: 1b4ed73ac933cad2b503a2b9ee8a49eb92efaf046465aab04cb6192eb4547d58c4569c710dbb2917b77e94835b14afb12423d42c845dc4a3f933f4c6968bde55
6
+ metadata.gz: efd71a3a72134fd70f2caf17b6e835212972640b7535b294c26224ce944ac77e5d7866889b78b3836449cbd04b6169203af76da167443524ca4dd4397974fce7
7
+ data.tar.gz: 0b052f52652fb095bd1786c2394439f774e876d48175628a1e701a32debe487b65ece8881d24cdea3b00231d811ef8b80817507c12901dfe58c1dcb2df57e157
@@ -129,7 +129,7 @@ module Hachi
129
129
  #
130
130
  def merge_into_case(*ids, case_id)
131
131
  params = {
132
- alertIds: ids,
132
+ alertIds: ids.flatten,
133
133
  caseId: case_id
134
134
  }
135
135
  post("/api/alert/merge/_bulk", params) { |json| json }
@@ -134,7 +134,7 @@ module Hachi
134
134
  if key == :data && value.is_a?(Array)
135
135
  { _or: decompose_data(value) }
136
136
  else
137
- { _string: "#{key}:#{value}" }
137
+ { _string: "#{key}:\"#{value}\"" }
138
138
  end
139
139
  end
140
140
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hachi
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
4
+
5
+ require "hachi"
6
+
7
+ def api
8
+ @api ||= Hachi::API.new
9
+ end
10
+
11
+ description = ARGV[0].to_s
12
+ case_id = ARGV[1].to_s
13
+
14
+ alerts = api.alert.search(description: description)
15
+ alert_ids = alerts.map { |alert| alert.dig "id" }
16
+
17
+ api.alert.merge_into_case(alert_ids, case_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hachi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
@@ -127,6 +127,7 @@ files:
127
127
  - samples/01_create_an_alert.rb
128
128
  - samples/02_search_artifacts.rb
129
129
  - samples/03_list_cases.rb
130
+ - samples/04_merge_alerts.rb
130
131
  homepage: https://github.com/ninoseki/hachi
131
132
  licenses:
132
133
  - MIT