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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f9a9b030a56e1b3688964be50aed6c66cbe367239a7377c37ebc2045180d4ed
4
- data.tar.gz: d1a90f539bf2b63d708bcc415b1fb5fae95d967fd539a73f716e10ef04c86754
3
+ metadata.gz: ea5b70606b0678f78ee8f63d8ba580a9dd5b8dfc79d0b1d1ee347c6a8467a40e
4
+ data.tar.gz: '027783a0a9097309f95df79a99f1dcedeadd7c40a007999d9c7918300fb737ee'
5
5
  SHA512:
6
- metadata.gz: '08a14b0c86bcf6744c4dfba020959c6c2fe9002a20ae8c2866cbc745cbe7ea002369c954a3441caaaf07d31bdcc4e68e8ab0ad6a52c236d5bb5f994db6643c5e'
7
- data.tar.gz: bd9f9aa18dc818bd1da8a2ce9d70e38abc6919bf359508b4d0344195cff9546964bfcfa30345fd8b7ff28c86746b352e21c78530f2e3e0522d108e1bc5338574
6
+ metadata.gz: 51792abe78d0b3863c26e7565c52a803180072db5ed3311336b9372619f978010835c789c71d340aee3070274d42fbeea8f3fc4d5c91c30486f43401e334782d
7
+ data.tar.gz: 1a72bb276814d2d965fed28c4f992e1d79a05cb9fcd597eb9f465991300618521c62e897279b70edfa9e47ba6115039d4baf3d3c0906c0c471349293cb69ac06
@@ -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]).to_set if 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, params: ignore_errors ? {} : { filter_path: "errors" })
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
- raise(SearchFlip::Bulk::Error, SearchFlip::JSON.generate(element)) if !status.between?(200, 299) && !ignore_errors.include?(status)
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
@@ -1,5 +1,5 @@
1
1
 
2
2
  module SearchFlip
3
- VERSION = "2.0.0.beta8"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
 
@@ -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?filter_path=errors")
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.beta8
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-04-17 00:00:00.000000000 Z
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: 1.3.1
234
+ version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
237
  rubygems_version: 2.7.3