algolia 2.2.3 → 2.2.4

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: c113b61e6f68cb0512af5184ec64500c3dfcce89cef1f72fa07c25c9276f5cb1
4
- data.tar.gz: 6474ee0b14ce28607a2a17bb2353fd7853128d48694f93d608b7faae728044b8
3
+ metadata.gz: 71515936ba0c1d3c3b9a0ac6726fb9ded765dd54207d7501a568884ff4517fff
4
+ data.tar.gz: 8324e0c88461a488ff126364ec4a2ed748d190b37ad461287fcd46a0a12424c4
5
5
  SHA512:
6
- metadata.gz: efab3e1d53bb186dc091e69e00962223adb1f7c17567e0fbcd97609ed07fc6cb99ae6552e08852f19c3815bd1164fde3475fc74f2445b8c4909f4de5258ee405
7
- data.tar.gz: 7c961f777ab5616edd3c59c0049ffd5b2b74126cd79697ebcdb4ffee42822866cab8fae0ab7a8922c434479fb032d9d865e83ba7b46543dd7a6b32a013d555ff
6
+ metadata.gz: 62a91b3e954b7b7766e50540e4122b77c8d2edc6aeefaa0595f49bc6b947f7dae64234ce3c0184249c55444fbe3811c7c2004969d7dddf722bf691ef7aa689d9
7
+ data.tar.gz: 31e6989001e9f936ec22b7940e27e5f0fa833cfab0dce6e61bba459d30887313135d93543c1ca8364cfc140577beed7753e7b3240fb9db134719a890d82b644a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # ChangeLog
2
2
 
3
- ## [Unreleased](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.3..master)
3
+ ## [Unreleased](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.4..master)
4
+
5
+ ## [2.2.4](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.3...2.2.4) (2022-05-24)
6
+ ### Fixed
7
+ - API endpoint URL mishandling in get_settings method ([`#473`](https://github.com/algolia/algoliasearch-client-ruby/pull/473))
8
+ - Confusing empty debug.log generation in gem users root ([`#474`](https://github.com/algolia/algoliasearch-client-ruby/pull/474))
4
9
 
5
10
  ## [2.2.3](https://github.com/algolia/algoliasearch-client-ruby/compare/2.2.2...2.2.3) (2022-04-21)
6
11
  ### Fixed
@@ -13,7 +13,7 @@ module Algolia
13
13
  def initialize(analytics_config, opts = {})
14
14
  @config = analytics_config
15
15
  adapter = opts[:adapter] || Defaults::ADAPTER
16
- logger = opts[:logger] || LoggerHelper.create('debug.log')
16
+ logger = opts[:logger] || LoggerHelper.create
17
17
  requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
18
18
  @transporter = Transport::Transport.new(@config, requester)
19
19
  end
@@ -13,7 +13,7 @@ module Algolia
13
13
  def initialize(insights_config, opts = {})
14
14
  @config = insights_config
15
15
  adapter = opts[:adapter] || Defaults::ADAPTER
16
- logger = opts[:logger] || LoggerHelper.create('debug.log')
16
+ logger = opts[:logger] || LoggerHelper.create
17
17
  requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
18
18
  @transporter = Transport::Transport.new(@config, requester)
19
19
  end
@@ -5,7 +5,7 @@ module Algolia
5
5
  # @param debug_file [nil|String] file used to output the logs
6
6
  #
7
7
  def self.create(debug_file = nil)
8
- file = debug_file || File.new('debug.log')
8
+ file = debug_file || (ENV['ALGOLIA_DEBUG'] ? File.new('debug.log') : $stderr)
9
9
  instance = ::Logger.new file
10
10
  instance.progname = 'algolia'
11
11
  instance
@@ -11,7 +11,7 @@ module Algolia
11
11
  def initialize(personalization_config, opts = {})
12
12
  @config = personalization_config
13
13
  adapter = opts[:adapter] || Defaults::ADAPTER
14
- logger = opts[:logger] || LoggerHelper.create('debug.log')
14
+ logger = opts[:logger] || LoggerHelper.create
15
15
  requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
16
16
  @transporter = Transport::Transport.new(@config, requester)
17
17
  end
@@ -18,7 +18,7 @@ module Algolia
18
18
  def initialize(recommend_config, opts = {})
19
19
  @config = recommend_config
20
20
  adapter = opts[:adapter] || Defaults::ADAPTER
21
- logger = opts[:logger] || LoggerHelper.create('debug.log')
21
+ logger = opts[:logger] || LoggerHelper.create
22
22
  requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
23
23
  @transporter = Transport::Transport.new(@config, requester)
24
24
  end
@@ -19,7 +19,7 @@ module Algolia
19
19
  def initialize(search_config, opts = {})
20
20
  @config = search_config
21
21
  adapter = opts[:adapter] || Defaults::ADAPTER
22
- logger = opts[:logger] || LoggerHelper.create('debug.log')
22
+ logger = opts[:logger] || LoggerHelper.create
23
23
  requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
24
24
  @transporter = Transport::Transport.new(@config, requester)
25
25
  end
@@ -974,7 +974,11 @@ module Algolia
974
974
  # @return [Hash]
975
975
  #
976
976
  def get_settings(opts = {})
977
- response = @transporter.read(:GET, path_encode('/1/indexes/%s/settings', @name) + handle_params({ getVersion: 2 }), {}, opts)
977
+ opts_default = {
978
+ getVersion: 2
979
+ }
980
+ opts = opts_default.merge(opts)
981
+ response = @transporter.read(:GET, path_encode('/1/indexes/%s/settings', @name), {}, opts)
978
982
 
979
983
  deserialize_settings(response, @config.symbolize_keys)
980
984
  end
@@ -1,3 +1,3 @@
1
1
  module Algolia
2
- VERSION = '2.2.3'.freeze
2
+ VERSION = '2.2.4'.freeze
3
3
  end
data/renovate.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
@@ -278,6 +278,34 @@ class SearchIndexTest < BaseTest
278
278
  # check that the forwardToReplicas parameter is passed correctly
279
279
  assert @index.set_settings!(settings, { forwardToReplicas: true })
280
280
  end
281
+
282
+ # Check version 1 API calling (ref. PR #473)
283
+ def test_version_param
284
+ @index.save_object!(generate_object('obj1')) # create index
285
+
286
+ # Check response's version value by actual access
287
+ assert_equal 2, @index.get_settings[:version]
288
+ assert_equal 1, @index.get_settings(getVersion: 1)[:version]
289
+ assert_equal 2, @index.get_settings(getVersion: 2)[:version]
290
+
291
+ # Check API endpoint handling by mock access
292
+ requester = MockRequester.new
293
+ client = Algolia::Search::Client.new(@@search_config, http_requester: requester)
294
+ index = client.init_index(@index_name)
295
+
296
+ index.get_settings # default
297
+ index.get_settings(getVersion: 1)
298
+ index.get_settings(getVersion: 2)
299
+
300
+ assert_requests(
301
+ requester,
302
+ [
303
+ { method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=2" },
304
+ { method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=1" },
305
+ { method: :get, path: "/1/indexes/#{@index_name}/settings?getVersion=2" }
306
+ ]
307
+ )
308
+ end
281
309
  end
282
310
 
283
311
  describe 'search' do
data/test/test_helper.rb CHANGED
@@ -38,7 +38,11 @@ def assert_requests(requester, requests)
38
38
  requests.each_with_index do |expected_request, i|
39
39
  request = actual_requests[i]
40
40
 
41
- assert_equal(expected_request[:body], request[:body])
41
+ if expected_request[:body].nil? # for GET requests w/ NO body.
42
+ assert_nil(request[:body])
43
+ else
44
+ assert_equal(expected_request[:body], request[:body])
45
+ end
42
46
  assert_equal(expected_request[:method], request[:method])
43
47
  assert_equal(expected_request[:path], request[:path])
44
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algolia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-21 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -256,6 +256,7 @@ files:
256
256
  - lib/algolia/transport/transport.rb
257
257
  - lib/algolia/user_agent.rb
258
258
  - lib/algolia/version.rb
259
+ - renovate.json
259
260
  - sig/config/algolia_config.rbs
260
261
  - sig/config/analytics_config.rbs
261
262
  - sig/config/insights_config.rbs