waistband 6.0.0 → 6.1.0

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
  SHA1:
3
- metadata.gz: f87e6b41460a84bed7fdc6624edffbe047d4d2e5
4
- data.tar.gz: eca12065cf817dd784b9383b694617c5bda4738f
3
+ metadata.gz: d390f407bb9044bc047201802d63469d94d12b85
4
+ data.tar.gz: 2f2c0bd1e853334fbc616a0b9ffa2a9105c146ae
5
5
  SHA512:
6
- metadata.gz: c2eed76001e1fd04ec2122ce19272e83812839f07f35d4440fc10e543b844aeae277cf27241f19e56b3c5ada449423c55291da7bb518723d155c6d6a61e01fd2
7
- data.tar.gz: bc41d59f250958433a4b95ebb7f2844465dcb6ce0b2c1811d21bd23e4277856f3da81051294e5ecb78281ddcaad7b15a7aa906d421241da19b1a438f6b2d65b0
6
+ metadata.gz: 1910ab48eb02d26b5990d41cd96c4bbe2450e41b4e630ba5276222aff5389977d650b3f1988cef3d13c98565fbbe81404dfbd74b286642ecaa73588d07fffd43
7
+ data.tar.gz: 68e0765716a8f88847bea76b601816486066969ffa2172d35cf0db63a93c3db22da8c7d7fe0594c0fe368a839bc63518df06da8d43b048c48b4f10a62aaba506
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [6.1.0] - 2019-05-10
8
+ ### Added
9
+ - `#delete_by_query`
10
+
7
11
  ## [6.0.0] - 2019-02-04
8
12
  ### Added
9
13
  - Support for Elasticsearch 6.x
data/lib/waistband.rb CHANGED
@@ -2,14 +2,15 @@ require "waistband/version"
2
2
 
3
3
  module Waistband
4
4
 
5
- autoload :Errors, "waistband/errors"
6
- autoload :StringifiedArray, "waistband/stringified_array"
7
- autoload :StringifiedHash, "waistband/stringified_hash"
8
- autoload :Client, "waistband/client"
9
- autoload :Configuration, "waistband/configuration"
10
- autoload :Index, "waistband/index"
11
- autoload :SearchResults, "waistband/search_results"
12
- autoload :Result, "waistband/result"
5
+ autoload :Errors, "waistband/errors"
6
+ autoload :StringifiedArray, "waistband/stringified_array"
7
+ autoload :StringifiedHash, "waistband/stringified_hash"
8
+ autoload :Client, "waistband/client"
9
+ autoload :Configuration, "waistband/configuration"
10
+ autoload :Index, "waistband/index"
11
+ autoload :SearchResults, "waistband/search_results"
12
+ autoload :DeleteByQueryResult, "waistband/delete_by_query_result"
13
+ autoload :Result, "waistband/result"
13
14
 
14
15
  class << self
15
16
 
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Waistband
4
+ class DeleteByQueryResult
5
+ attr_reader :deleted, :full_response
6
+
7
+ def initialize(response)
8
+ @full_response = response
9
+ @deleted = response['deleted']
10
+ end
11
+ end
12
+ end
@@ -207,6 +207,10 @@ module Waistband
207
207
  ::Waistband::SearchResults.new(search_hash, page: page, page_size: page_size)
208
208
  end
209
209
 
210
+ def delete_by_query(query)
211
+ ::Waistband::DeleteByQueryResult.new(client.delete_by_query(index: config_name, body: query))
212
+ end
213
+
210
214
  def alias(alias_name)
211
215
  alias_name = full_alias_name alias_name
212
216
  client.indices.put_alias(
@@ -1,3 +1,3 @@
1
1
  module Waistband
2
- VERSION = "6.0.0"
2
+ VERSION = "6.1.0"
3
3
  end
@@ -356,4 +356,20 @@ describe Waistband::Index do
356
356
 
357
357
  end
358
358
 
359
+ describe '#delete_by_query' do
360
+ let(:delete_query) { { query: { match_all: {} } } }
361
+ let(:result) { index.delete_by_query(delete_query) }
362
+
363
+ before do
364
+ index.save('__test_write1', {'data' => 'index_1'})
365
+ index.save('__test_write2', {'data' => 'index_2'})
366
+ index.refresh
367
+ end
368
+
369
+ it "returns a DeleteByQueryResult object with expected properties" do
370
+ expect(result).to be_a Waistband::DeleteByQueryResult
371
+ expect(result.deleted).to eq(2)
372
+ expect(result.full_response).to be_a Hash
373
+ end
374
+ end
359
375
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waistband
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Jairala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -101,6 +101,7 @@ files:
101
101
  - lib/waistband.rb
102
102
  - lib/waistband/client.rb
103
103
  - lib/waistband/configuration.rb
104
+ - lib/waistband/delete_by_query_result.rb
104
105
  - lib/waistband/errors.rb
105
106
  - lib/waistband/index.rb
106
107
  - lib/waistband/result.rb