algolia 2.0.0 → 2.0.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: 555e432d41a84d3031f58dc7c74acf5297df48fe693fadf977c6b15547a82d6b
4
- data.tar.gz: a3fbbc9ba6552b0b432a20e34cd5cf7a311f339c2df7f7a3c549ced84f409ba0
3
+ metadata.gz: 271072f79f6138528fb80d730cdfbe2c8e20f325a4ca77e7989a257ccc708aa9
4
+ data.tar.gz: 4ab56efe14117faa1b901924a3b0a894cdde133dcf949b95d0ac6ec92d5e7df4
5
5
  SHA512:
6
- metadata.gz: 757d57c2723f3f036bfb7faa38615fd751311e99b0a3f5e1b3c13087c53a9010af88c99a5412e31bb3e6d3cdb9201478d7100c71080b3fe948004170a870f875
7
- data.tar.gz: ede51228b6bc2498b65434102f8b25b17d7db74ae74cd2b50a1ec7184f42692e4b24d94de8c621ec91a8192c924e71ac1067bfdde038a03936407f12147b6175
6
+ metadata.gz: e7ca70dc42740641c681adb146d7da699a36722249a2728305d07d3ff0d8149adc660e008f06d640e8c0217b79e3e2cb5734abf42e193c8fd7259d86924f6238
7
+ data.tar.gz: eec4f95bc050fa5c2b52cc58e8886e8cef330ab2c56fb1e3b6bc7bdc583c50d44d6b7ff285cbb8c6a5dcbcd91ad68630ff027ff26718195aac0733481f95c964
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [2.0.1](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/2.0.1) (2020-11-02)
6
+
7
+ * Fix: simplify merge of headers in `Transport` class
8
+ * Fix: `deserialize_settings` function to take into account `symbolize_keys` parameter
9
+
5
10
  ## [2.0.0](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/2.0.0) (2020-10-27)
6
11
 
7
12
  * Initial release of v2
data/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  <h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Ruby project</h4>
7
7
 
8
8
  <p align="center">
9
- <a href="https://circleci.com/gh/algolia/algoliasearch-client-ruby"><img src="https://circleci.com/gh/algolia/algoliasearch-client-ruby/tree/release%2Fv2.svg?style=shield" alt="CircleCI" /></a>
10
- <a href="https://rubygems.org/gems/algolia"><img src="https://badge.fury.io/rb/algoliasearch.svg" alt="Gem Version"></a>
9
+ <a href="https://circleci.com/gh/algolia/algoliasearch-client-ruby"><img src="https://circleci.com/gh/algolia/algoliasearch-client-ruby.svg?style=shield" alt="CircleCI" /></a>
10
+ <a href="https://rubygems.org/gems/algolia"><img src="https://badge.fury.io/rb/algolia.svg" alt="Gem Version"></a>
11
11
  <a href="https://rubygems.org/gems/algolia"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="License"></a>
12
12
  </p>
13
13
  </p>
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rake'
36
36
  spec.add_development_dependency 'rubocop', '<= 0.82.0'
37
37
 
38
- spec.add_dependency 'faraday', '~> 0.15'
38
+ spec.add_dependency 'faraday', ['>= 0.15', '< 2.0']
39
39
  spec.add_dependency 'multi_json', '~> 1.0'
40
40
  spec.add_dependency 'net-http-persistent'
41
41
 
@@ -53,7 +53,7 @@ module Helpers
53
53
  # Support to convert old settings to their new names
54
54
  #
55
55
  def deserialize_settings(data, symbolize_keys)
56
- settings = symbolize_hash(data)
56
+ settings = data
57
57
  keys = {
58
58
  attributesToIndex: 'searchableAttributes',
59
59
  numericAttributesToIndex: 'numericAttributesForFiltering',
@@ -61,6 +61,7 @@ module Helpers
61
61
  }
62
62
 
63
63
  keys.each do |deprecated_key, current_key|
64
+ deprecated_key = symbolize_keys ? deprecated_key : deprecated_key.to_s
64
65
  if settings.has_key?(deprecated_key)
65
66
  key = symbolize_keys ? current_key.to_sym : current_key.to_s
66
67
  settings[key] = settings.delete(deprecated_key)
@@ -34,7 +34,7 @@ module Algolia
34
34
  def add_headers(opts = {})
35
35
  unless opts[:headers].nil?
36
36
  opts[:headers].each do |opt, value|
37
- @headers[opt.to_sym] = value
37
+ @headers[opt.to_s] = value
38
38
  end
39
39
  opts.delete(:headers)
40
40
  end
@@ -127,15 +127,12 @@ module Algolia
127
127
 
128
128
  # Generates headers from config headers and optional parameters
129
129
  #
130
- # @option options [String] :headers
130
+ # @param request_options [RequestOptions]
131
131
  #
132
132
  # @return [Hash] merged headers
133
133
  #
134
134
  def generate_headers(request_options = {})
135
- headers = {}
136
- extra_headers = request_options.headers || {}
137
- @config.headers.each { |key, val| headers[key.to_s] = val }
138
- extra_headers.each { |key, val| headers[key.to_s] = val }
135
+ headers = @config.headers.merge(request_options.headers)
139
136
  if request_options.compression_type == Defaults::GZIP_ENCODING
140
137
  headers['Accept-Encoding'] = Defaults::GZIP_ENCODING
141
138
  end
@@ -1,3 +1,3 @@
1
1
  module Algolia
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
@@ -26,13 +26,15 @@ class HelpersTest
26
26
  old_settings = {
27
27
  'attributesToIndex' => %w(attr1 attr2),
28
28
  'numericAttributesToIndex' => %w(attr1 attr2),
29
- 'slaves' => %w(index1 index2)
29
+ 'slaves' => %w(index1 index2),
30
+ 'minWordSizefor1Typo' => 1
30
31
  }
31
32
 
32
33
  new_settings = {
33
34
  'searchableAttributes' => %w(attr1 attr2),
34
35
  'numericAttributesForFiltering' => %w(attr1 attr2),
35
- 'replicas' => %w(index1 index2)
36
+ 'replicas' => %w(index1 index2),
37
+ 'minWordSizefor1Typo' => 1
36
38
  }
37
39
 
38
40
  deserialized_settings = deserialize_settings(old_settings, false)
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.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-27 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: faraday
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.15'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '2.0'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
67
70
  - !ruby/object:Gem::Version
68
71
  version: '0.15'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: multi_json
71
77
  requirement: !ruby/object:Gem::Requirement