algolia 2.0.0.pre.alpha.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/README.md +18 -10
- data/SECURITY.md +3 -0
- data/algolia.gemspec +9 -3
- data/lib/algolia.rb +1 -1
- data/lib/algolia/analytics_client.rb +1 -1
- data/lib/algolia/config/analytics_config.rb +2 -2
- data/lib/algolia/config/base_config.rb +43 -0
- data/lib/algolia/config/insights_config.rb +2 -2
- data/lib/algolia/config/recommendation_config.rb +2 -2
- data/lib/algolia/config/search_config.rb +2 -2
- data/lib/algolia/defaults.rb +2 -2
- data/lib/algolia/error.rb +1 -2
- data/lib/algolia/helpers.rb +3 -2
- data/lib/algolia/insights_client.rb +1 -1
- data/lib/algolia/iterators/object_iterator.rb +5 -4
- data/lib/algolia/iterators/paginator_iterator.rb +5 -3
- data/lib/algolia/recommendation_client.rb +1 -1
- data/lib/algolia/search_client.rb +1 -1
- data/lib/algolia/search_index.rb +37 -37
- data/lib/algolia/transport/transport.rb +4 -4
- data/lib/algolia/version.rb +1 -1
- data/sig/config/algolia_config.rbs +3 -3
- data/sig/config/analytics_config.rbs +1 -1
- data/sig/config/insights_config.rbs +1 -1
- data/sig/config/recommendation_config.rbs +1 -1
- data/sig/config/search_config.rbs +1 -1
- data/test/algolia/integration/analytics_client_test.rb +6 -6
- data/test/algolia/integration/insights_client_test.rb +11 -11
- data/test/algolia/integration/search_client_test.rb +20 -11
- data/test/algolia/unit/algolia_config_test.rb +16 -0
- data/test/algolia/unit/helpers_test.rb +18 -1
- data/test/algolia/unit/retry_strategy_test.rb +3 -3
- data/test/test_helper.rb +1 -1
- data/upgrade_guide.md +30 -22
- metadata +20 -14
- data/lib/algolia/config/algolia_config.rb +0 -40
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
|
3
|
-
module Algolia
|
4
|
-
# Class AlgoliaConfig
|
5
|
-
class AlgoliaConfig
|
6
|
-
attr_accessor :app_id, :api_key, :default_headers, :batch_size, :read_timeout, :write_timeout, :connect_timeout, :compression_type,
|
7
|
-
:symbolize_keys
|
8
|
-
|
9
|
-
#
|
10
|
-
# @option options [String] :app_id
|
11
|
-
# @option options [String] :api_key
|
12
|
-
# @option options [Integer] :batch_size
|
13
|
-
# @option options [Integer] :read_timeout
|
14
|
-
# @option options [Integer] :write_timeout
|
15
|
-
# @option options [Integer] :connect_timeout
|
16
|
-
# @option options [Boolean] :symbolize_keys
|
17
|
-
#
|
18
|
-
def initialize(opts = {})
|
19
|
-
raise AlgoliaError, 'No Application ID provided, please set :app_id' unless opts.has_key?(:app_id)
|
20
|
-
raise AlgoliaError, 'No API key provided, please set :api_key' unless opts.has_key?(:api_key)
|
21
|
-
|
22
|
-
@app_id = opts[:app_id]
|
23
|
-
@api_key = opts[:api_key]
|
24
|
-
|
25
|
-
@default_headers = {
|
26
|
-
Defaults::HEADER_API_KEY => @api_key,
|
27
|
-
Defaults::HEADER_APP_ID => @app_id,
|
28
|
-
'Content-Type' => 'application/json; charset=utf-8',
|
29
|
-
'User-Agent' => UserAgent.value
|
30
|
-
}
|
31
|
-
|
32
|
-
@batch_size = opts[:batch_size] || Defaults::BATCH_SIZE
|
33
|
-
@read_timeout = opts[:read_timeout] || Defaults::READ_TIMEOUT
|
34
|
-
@write_timeout = opts[:write_timeout] || Defaults::WRITE_TIMEOUT
|
35
|
-
@connect_timeout = opts[:connect_timeout] || Defaults::CONNECT_TIMEOUT
|
36
|
-
@compression_type = opts[:compression_type] || Defaults::NONE_ENCODING
|
37
|
-
@symbolize_keys = opts[:symbolize_keys] || true
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|