search_flip 2.0.0.beta8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/search_flip/bulk.rb +6 -5
- data/lib/search_flip/version.rb +1 -1
- data/spec/search_flip/bulk_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5b70606b0678f78ee8f63d8ba580a9dd5b8dfc79d0b1d1ee347c6a8467a40e
|
4
|
+
data.tar.gz: '027783a0a9097309f95df79a99f1dcedeadd7c40a007999d9c7918300fb737ee'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51792abe78d0b3863c26e7565c52a803180072db5ed3311336b9372619f978010835c789c71d340aee3070274d42fbeea8f3fc4d5c91c30486f43401e334782d
|
7
|
+
data.tar.gz: 1a72bb276814d2d965fed28c4f992e1d79a05cb9fcd597eb9f465991300618521c62e897279b70edfa9e47ba6115039d4baf3d3c0906c0c471349293cb69ac06
|
data/lib/search_flip/bulk.rb
CHANGED
@@ -54,7 +54,7 @@ module SearchFlip
|
|
54
54
|
@url = url
|
55
55
|
@options = options
|
56
56
|
@http_client = options[:http_client] || SearchFlip::HTTPClient.new
|
57
|
-
@ignore_errors = Array(options[:ignore_errors]
|
57
|
+
@ignore_errors = Array(options[:ignore_errors] || []).to_set
|
58
58
|
|
59
59
|
@bulk_limit = options[:bulk_limit] || SearchFlip::Config[:bulk_limit]
|
60
60
|
@bulk_max_mb = options[:bulk_max_mb] || SearchFlip::Config[:bulk_max_mb]
|
@@ -140,7 +140,7 @@ module SearchFlip
|
|
140
140
|
response =
|
141
141
|
@http_client
|
142
142
|
.headers(accept: "application/json", content_type: "application/x-ndjson")
|
143
|
-
.put(url, body: @payload
|
143
|
+
.put(url, body: @payload)
|
144
144
|
|
145
145
|
return if options[:raise] == false
|
146
146
|
|
@@ -148,13 +148,14 @@ module SearchFlip
|
|
148
148
|
|
149
149
|
return unless parsed_response["errors"]
|
150
150
|
|
151
|
-
raise(SearchFlip::Bulk::Error, response[0..30]) unless ignore_errors
|
152
|
-
|
153
151
|
parsed_response["items"].each do |item|
|
154
152
|
item.each do |_, element|
|
155
153
|
status = element["status"]
|
156
154
|
|
157
|
-
|
155
|
+
next if status.between?(200, 299)
|
156
|
+
next if ignore_errors.include?(status)
|
157
|
+
|
158
|
+
raise SearchFlip::Bulk::Error, SearchFlip::JSON.generate(element)
|
158
159
|
end
|
159
160
|
end
|
160
161
|
ensure
|
data/lib/search_flip/version.rb
CHANGED
@@ -62,7 +62,7 @@ RSpec.describe SearchFlip::Bulk do
|
|
62
62
|
it "uses the specified http_client" do
|
63
63
|
product = create(:product)
|
64
64
|
|
65
|
-
stub_request(:put, "#{ProductIndex.type_url}/_bulk
|
65
|
+
stub_request(:put, "#{ProductIndex.type_url}/_bulk")
|
66
66
|
.with(headers: { "X-Header" => "Value" })
|
67
67
|
.to_return(status: 500)
|
68
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: search_flip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Vetter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -229,9 +229,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
|
-
- - "
|
232
|
+
- - ">="
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
version:
|
234
|
+
version: '0'
|
235
235
|
requirements: []
|
236
236
|
rubyforge_project:
|
237
237
|
rubygems_version: 2.7.3
|