elastic_search_framework 2.3.0 → 2.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: 3cb32d84eb11d74afb4b32b129fc7b6fb3654714ffc8cc68a22837641437c92a
4
- data.tar.gz: bddf4744857f12fcb44272813c6c644b373c32029c46ae470f17b239e3279762
3
+ metadata.gz: 660bab65bf91d16e1788d6f43c47e979ab70d6367b6d964c5db5edb2fd94405e
4
+ data.tar.gz: 6132de6d0f951d36382e1d5023eb1b22240b66df004192f291434dae80284ff4
5
5
  SHA512:
6
- metadata.gz: a7606703ced3bd3bf8e47312e408a687c45fdee2362a19d92cd007782b2748d9b1fc5bfa8d998d67040884697236c976d7c128eb4021173a758a713b9b2e725d
7
- data.tar.gz: 721beafb796c691392c037b4651f3f51ea29ab24ce4d1b047fb8ade55887356c15cd4fb85af807125364382c5c387467ef466c23526f037ae06b6378354b287b
6
+ metadata.gz: 35187a0efc4484e04f90db902db59fe7f599e83986ff16621c8b554bcc35c0d54167fc8663e11bb53d8048088707e31bf3fc191f5dcb970eaa244ebe7daeed7b
7
+ data.tar.gz: 82da0e555366738552a4bb4c522e0c6a4d31d83e82e3f4774851d2fc0ac72f291bcf351aa0e2012e31cfaf3058be8b9b1d1cacf8750ec85da5b84db72b89e5f9
@@ -172,8 +172,8 @@ module ElasticSearchFramework
172
172
  repository.get(index: self, id: id, type: type)
173
173
  end
174
174
 
175
- def put_item(type: 'default', item:)
176
- repository.set(entity: item, index: self, type: type)
175
+ def put_item(type: 'default', item:, op_type: 'index')
176
+ repository.set(entity: item, index: self, type: type, op_type: op_type)
177
177
  end
178
178
 
179
179
  def delete_item(id:, type: 'default')
@@ -127,9 +127,9 @@ module ElasticSearchFramework
127
127
  repository.get(index: self, id: id, type: type)
128
128
  end
129
129
 
130
- def put_item(type: "default", item:)
130
+ def put_item(type: "default", item:, op_type: 'index')
131
131
  indexes.each do |index|
132
- repository.set(entity: item, index: index[:klass], type: type)
132
+ repository.set(entity: item, index: index[:klass], type: type, op_type: op_type)
133
133
  end
134
134
  end
135
135
 
@@ -1,3 +1,3 @@
1
1
  module ElasticSearchFramework
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
@@ -125,10 +125,26 @@ RSpec.describe ElasticSearchFramework::Index do
125
125
  i.number = 5
126
126
  end
127
127
  end
128
- it 'should call set on the repository for each index of the alias' do
129
- expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type).once
130
- expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type).once
131
- ExampleIndexAlias.put_item(type: type, item: item)
128
+ context 'without specifying op_type' do
129
+ it 'should call set on the repository for each index of the alias with default op_type (index)' do
130
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'index').once
131
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'index').once
132
+ ExampleIndexAlias.put_item(type: type, item: item)
133
+ end
134
+ end
135
+
136
+ context 'with specified op_type' do
137
+ it 'should call set on the repository for each index of the alias with supplied op_type (index)' do
138
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'index').once
139
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'index').once
140
+ ExampleIndexAlias.put_item(type: type, item: item, op_type: 'index')
141
+ end
142
+
143
+ it 'should call set on the repository for each index of the alias with supplied op_type (create)' do
144
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type, op_type: 'create').once
145
+ expect(ExampleIndexAlias.repository).to receive(:set).with(entity: item, index: ExampleIndex2, type: type, op_type: 'create').once
146
+ ExampleIndexAlias.put_item(type: type, item: item, op_type: 'create')
147
+ end
132
148
  end
133
149
  end
134
150
 
@@ -301,9 +301,24 @@ RSpec.describe ElasticSearchFramework::Index do
301
301
  i.number = 5
302
302
  end
303
303
  end
304
- it 'should call set on the repository' do
305
- expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, type: type)
306
- ExampleIndex.put_item(type: type, item: item)
304
+
305
+ context 'without specifying op_type' do
306
+ it 'should call set on the repository with default op_type (index)' do
307
+ expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'index', type: type)
308
+ ExampleIndex.put_item(type: type, item: item)
309
+ end
310
+ end
311
+
312
+ context 'with specified op_type' do
313
+ it 'should call set on the repository with supplied op_type (index)' do
314
+ expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'index', type: type)
315
+ ExampleIndex.put_item(type: type, item: item, op_type: 'index')
316
+ end
317
+
318
+ it 'should call set on the repository with supplied op_type (create)' do
319
+ expect_any_instance_of(ElasticSearchFramework::Repository).to receive(:set).with(entity: item, index: ExampleIndex, op_type: 'create', type: type)
320
+ ExampleIndex.put_item(type: type, item: item, op_type: 'create')
321
+ end
307
322
  end
308
323
  end
309
324
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_search_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler