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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +1 -1
  6. data/README.md +18 -10
  7. data/SECURITY.md +3 -0
  8. data/algolia.gemspec +9 -3
  9. data/lib/algolia.rb +1 -1
  10. data/lib/algolia/analytics_client.rb +1 -1
  11. data/lib/algolia/config/analytics_config.rb +2 -2
  12. data/lib/algolia/config/base_config.rb +43 -0
  13. data/lib/algolia/config/insights_config.rb +2 -2
  14. data/lib/algolia/config/recommendation_config.rb +2 -2
  15. data/lib/algolia/config/search_config.rb +2 -2
  16. data/lib/algolia/defaults.rb +2 -2
  17. data/lib/algolia/error.rb +1 -2
  18. data/lib/algolia/helpers.rb +3 -2
  19. data/lib/algolia/insights_client.rb +1 -1
  20. data/lib/algolia/iterators/object_iterator.rb +5 -4
  21. data/lib/algolia/iterators/paginator_iterator.rb +5 -3
  22. data/lib/algolia/recommendation_client.rb +1 -1
  23. data/lib/algolia/search_client.rb +1 -1
  24. data/lib/algolia/search_index.rb +37 -37
  25. data/lib/algolia/transport/transport.rb +4 -4
  26. data/lib/algolia/version.rb +1 -1
  27. data/sig/config/algolia_config.rbs +3 -3
  28. data/sig/config/analytics_config.rbs +1 -1
  29. data/sig/config/insights_config.rbs +1 -1
  30. data/sig/config/recommendation_config.rbs +1 -1
  31. data/sig/config/search_config.rbs +1 -1
  32. data/test/algolia/integration/analytics_client_test.rb +6 -6
  33. data/test/algolia/integration/insights_client_test.rb +11 -11
  34. data/test/algolia/integration/search_client_test.rb +20 -11
  35. data/test/algolia/unit/algolia_config_test.rb +16 -0
  36. data/test/algolia/unit/helpers_test.rb +18 -1
  37. data/test/algolia/unit/retry_strategy_test.rb +3 -3
  38. data/test/test_helper.rb +1 -1
  39. data/upgrade_guide.md +30 -22
  40. metadata +20 -14
  41. 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