search_flip 4.0.0.beta7 → 4.0.0.beta8

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: e9fcc6487802a3f4f2c26081fbb09a22cad112284a4faee6c144320c044fbbcd
4
- data.tar.gz: 0caa17894a15d7eb03ad0a3e171ad94f80d85998caaa80b88162e5fc04a5bf97
3
+ metadata.gz: d63abc415f8eaad5ade7de6fc4ca424a8695b72016266a49a1d221f49530ca49
4
+ data.tar.gz: a6170648ed2663b769b123ae443c5d0863a4456ec39be35c2762186b93383cff
5
5
  SHA512:
6
- metadata.gz: 2cf53c265c31136c50a0158f96f2c143a053304656dfcb7db3dd8ca3344031ebd724b3c3f5382451cfd6a805149619fe892b28eb47c2275d86bda042f4dfe526
7
- data.tar.gz: e3ffe6f6ba945c62b45379607295af790df866b86489cc9d9f63fdf91f528e071b9da93d7067b16fab93e509e8acf87644de303bd7a63b6010e18b5439507fc3
6
+ metadata.gz: 7c7879bcf95f3e53c5186ec50592cf7e46b703b819c34e7d7e91229972652daf132b7a73b3f85051c6d86117f66278f83b5ac2f2b12c23272bb36130b0e7aa72
7
+ data.tar.gz: a04b20cbcf16eceb905798d1e5e2ea8dd60bb27b45bee9a0ab6f52aaed7d58e648a2f3139981117332a9824570db429f069ed749873dffd27ceb7cc274b3a7b4
@@ -13,9 +13,9 @@ jobs:
13
13
  - docker.elastic.co/elasticsearch/elasticsearch:7.0.0
14
14
  - docker.elastic.co/elasticsearch/elasticsearch:7.11.2
15
15
  ruby:
16
- - 2.5
17
16
  - 2.6
18
17
  - 2.7
18
+ - 3.0
19
19
  services:
20
20
  elasticsearch:
21
21
  image: ${{ matrix.elasticsearch }}
data/CHANGELOG.md CHANGED
@@ -11,6 +11,16 @@
11
11
  * Added `SearchFlip::Connection#get_cluster_settings` and
12
12
  `#update_cluster_settings`
13
13
 
14
+ ## v3.4.0
15
+
16
+ * Expose `Http#timeout` via `SearchFlip::HTTPClient`
17
+
18
+ ## v3.3.0
19
+
20
+ * Update httprb
21
+ * Changed oj default options
22
+ * Allow to set oj json options
23
+
14
24
  ## v3.2.1
15
25
 
16
26
  * Fix `refresh` having a empty body breaking in elasticsearch 7.11
data/README.md CHANGED
@@ -756,7 +756,7 @@ end
756
756
  This allows to use different clusters per index e.g. when migrating indices to
757
757
  new versions of Elasticsearch.
758
758
 
759
- You can specify basic auth, additional headers, etc via:
759
+ You can specify basic auth, additional headers, request timeouts, etc via:
760
760
 
761
761
  ```ruby
762
762
  http_client = SearchFlip::HTTPClient.new
@@ -773,6 +773,9 @@ http_client = http_client.via("proxy.host", 8080)
773
773
  # Custom headers
774
774
  http_client = http_client.headers(key: "value")
775
775
 
776
+ # Timeouts
777
+ http_client = http_client.timeout(20)
778
+
776
779
  SearchFlip::Connection.new(base_url: "...", http_client: http_client)
777
780
  ```
778
781
 
@@ -1,7 +1,28 @@
1
1
  module SearchFlip
2
- # The SearchFlip::HTTPClient class wraps the http gem, is for internal use
3
- # and responsible for the http request/response handling, ie communicating
4
- # with Elasticsearch.
2
+ # The SearchFlip::HTTPClient class wraps the http gem and responsible for the
3
+ # http request/response handling, ie communicating with Elasticsearch. You
4
+ # only need to use it directly if you need authentication to communicate with
5
+ # Elasticsearch or if you want to set some custom http settings.
6
+ #
7
+ # @example
8
+ # http_client = SearchFlip::HTTPClient.new
9
+ #
10
+ # # Basic Auth
11
+ # http_client = http_client.basic_auth(user: "username", pass: "password")
12
+ #
13
+ # # Raw Auth Header
14
+ # http_client = http_client.auth("Bearer VGhlIEhUVFAgR2VtLCBST0NLUw")
15
+ #
16
+ # # Proxy Settings
17
+ # http_client = http_client.via("proxy.host", 8080)
18
+ #
19
+ # # Custom headers
20
+ # http_client = http_client.headers(key: "value")
21
+ #
22
+ # # Timeouts
23
+ # http_client = http_client.timeout(20)
24
+ #
25
+ # SearchFlip::Connection.new(base_url: "...", http_client: http_client)
5
26
 
6
27
  class HTTPClient
7
28
  attr_accessor :request, :plugins
@@ -14,11 +35,11 @@ module SearchFlip
14
35
  class << self
15
36
  extend Forwardable
16
37
 
17
- def_delegators :new, :headers, :via, :basic_auth, :auth
38
+ def_delegators :new, :headers, :via, :basic_auth, :auth, :timeout
18
39
  def_delegators :new, :get, :post, :put, :delete, :head
19
40
  end
20
41
 
21
- [:headers, :via, :basic_auth, :auth].each do |method|
42
+ [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
22
43
  define_method method do |*args|
23
44
  dup.tap do |client|
24
45
  client.request = request.send(method, *args)
@@ -1,3 +1,3 @@
1
1
  module SearchFlip
2
- VERSION = "4.0.0.beta7"
2
+ VERSION = "4.0.0.beta8"
3
3
  end
@@ -7,7 +7,7 @@ class HttpTestRequest
7
7
  self.calls = []
8
8
  end
9
9
 
10
- [:via, :basic_auth, :auth].each do |method|
10
+ [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
11
11
  define_method method do |*args|
12
12
  dup.tap do |request|
13
13
  request.calls = calls + [[method, args]]
@@ -20,7 +20,7 @@ RSpec.describe SearchFlip::HTTPClient do
20
20
  describe "delegation" do
21
21
  subject { SearchFlip::HTTPClient }
22
22
 
23
- [:headers, :via, :basic_auth, :auth].each do |method|
23
+ [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
24
24
  it { should delegate(method).to(:new) }
25
25
  end
26
26
 
@@ -56,8 +56,12 @@ RSpec.describe SearchFlip::HTTPClient do
56
56
  end
57
57
  end
58
58
 
59
- [:via, :basic_auth, :auth].each do |method|
59
+ [:headers, :via, :basic_auth, :auth, :timeout].each do |method|
60
60
  describe "##{method}" do
61
+ it "is understood by HTTP" do
62
+ expect(HTTP.respond_to?(method)).to eq(true)
63
+ end
64
+
61
65
  it "creates a dupped instance" do
62
66
  client = SearchFlip::HTTPClient.new
63
67
  client.request = HttpTestRequest.new
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: 4.0.0.beta7
4
+ version: 4.0.0.beta8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-20 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord