algolia 2.0.0.pre.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +146 -0
  3. data/.github/ISSUE_TEMPLATE.md +20 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  5. data/.gitignore +38 -0
  6. data/.rubocop.yml +186 -0
  7. data/.rubocop_todo.yml +14 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +18 -0
  10. data/LICENSE +21 -0
  11. data/README.md +56 -0
  12. data/Rakefile +45 -0
  13. data/Steepfile +6 -0
  14. data/algolia.gemspec +41 -0
  15. data/bin/console +21 -0
  16. data/bin/setup +8 -0
  17. data/lib/algolia.rb +42 -0
  18. data/lib/algolia/account_client.rb +65 -0
  19. data/lib/algolia/analytics_client.rb +105 -0
  20. data/lib/algolia/config/algolia_config.rb +40 -0
  21. data/lib/algolia/config/analytics_config.rb +20 -0
  22. data/lib/algolia/config/insights_config.rb +20 -0
  23. data/lib/algolia/config/recommendation_config.rb +20 -0
  24. data/lib/algolia/config/search_config.rb +40 -0
  25. data/lib/algolia/defaults.rb +35 -0
  26. data/lib/algolia/enums/call_type.rb +4 -0
  27. data/lib/algolia/enums/retry_outcome_type.rb +5 -0
  28. data/lib/algolia/error.rb +29 -0
  29. data/lib/algolia/helpers.rb +83 -0
  30. data/lib/algolia/http/http_requester.rb +84 -0
  31. data/lib/algolia/http/response.rb +23 -0
  32. data/lib/algolia/insights_client.rb +238 -0
  33. data/lib/algolia/iterators/base_iterator.rb +19 -0
  34. data/lib/algolia/iterators/object_iterator.rb +27 -0
  35. data/lib/algolia/iterators/paginator_iterator.rb +44 -0
  36. data/lib/algolia/iterators/rule_iterator.rb +9 -0
  37. data/lib/algolia/iterators/synonym_iterator.rb +9 -0
  38. data/lib/algolia/logger_helper.rb +14 -0
  39. data/lib/algolia/recommendation_client.rb +60 -0
  40. data/lib/algolia/responses/add_api_key_response.rb +38 -0
  41. data/lib/algolia/responses/base_response.rb +9 -0
  42. data/lib/algolia/responses/delete_api_key_response.rb +40 -0
  43. data/lib/algolia/responses/indexing_response.rb +28 -0
  44. data/lib/algolia/responses/multiple_batch_indexing_response.rb +29 -0
  45. data/lib/algolia/responses/multiple_response.rb +45 -0
  46. data/lib/algolia/responses/restore_api_key_response.rb +36 -0
  47. data/lib/algolia/responses/update_api_key_response.rb +39 -0
  48. data/lib/algolia/search_client.rb +614 -0
  49. data/lib/algolia/search_index.rb +1094 -0
  50. data/lib/algolia/transport/request_options.rb +94 -0
  51. data/lib/algolia/transport/retry_strategy.rb +117 -0
  52. data/lib/algolia/transport/stateful_host.rb +26 -0
  53. data/lib/algolia/transport/transport.rb +161 -0
  54. data/lib/algolia/user_agent.rb +25 -0
  55. data/lib/algolia/version.rb +3 -0
  56. data/sig/config/algolia_config.rbs +24 -0
  57. data/sig/config/analytics_config.rbs +11 -0
  58. data/sig/config/insights_config.rbs +11 -0
  59. data/sig/config/recommendation_config.rbs +11 -0
  60. data/sig/config/search_config.rbs +11 -0
  61. data/sig/enums/call_type.rbs +5 -0
  62. data/sig/helpers.rbs +12 -0
  63. data/sig/http/http_requester.rbs +17 -0
  64. data/sig/http/response.rbs +14 -0
  65. data/sig/interfaces/_connection.rbs +16 -0
  66. data/sig/iterators/base_iterator.rbs +15 -0
  67. data/sig/iterators/object_iterator.rbs +6 -0
  68. data/sig/iterators/paginator_iterator.rbs +8 -0
  69. data/sig/iterators/rule_iterator.rbs +5 -0
  70. data/sig/iterators/synonym_iterator.rbs +5 -0
  71. data/sig/transport/request_options.rbs +33 -0
  72. data/sig/transport/stateful_host.rbs +21 -0
  73. data/test/algolia/integration/account_client_test.rb +47 -0
  74. data/test/algolia/integration/analytics_client_test.rb +113 -0
  75. data/test/algolia/integration/base_test.rb +9 -0
  76. data/test/algolia/integration/insights_client_test.rb +80 -0
  77. data/test/algolia/integration/mocks/mock_requester.rb +45 -0
  78. data/test/algolia/integration/recommendation_client_test.rb +30 -0
  79. data/test/algolia/integration/search_client_test.rb +361 -0
  80. data/test/algolia/integration/search_index_test.rb +698 -0
  81. data/test/algolia/unit/helpers_test.rb +69 -0
  82. data/test/algolia/unit/retry_strategy_test.rb +139 -0
  83. data/test/algolia/unit/user_agent_test.rb +16 -0
  84. data/test/test_helper.rb +89 -0
  85. data/upgrade_guide.md +595 -0
  86. metadata +307 -0
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # typed: strong
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in algolia.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest-ci'
9
+
10
+ group :development do
11
+ gem 'git-precommit'
12
+ gem 'steep'
13
+ gem 'yard'
14
+ end
15
+
16
+ group :test do
17
+ gem 'simplecov'
18
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Algolia Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,56 @@
1
+ <p align="center">
2
+ <a href="https://www.algolia.com">
3
+ <img alt="Algolia for Ruby" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/ruby.png" >
4
+ </a>
5
+
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
+
8
+ <p align="center">
9
+ <a href="https://circleci.com/gh/algolia/algoliasearch-client-ruby/tree/release%2Fv2"><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/algoliasearch"><img src="https://badge.fury.io/rb/algoliasearch.svg" alt="Gem Version"></a>
11
+ <a href="https://rubygems.org/gems/algoliasearch"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="License"></a>
12
+ </p>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://www.algolia.com/doc/api-client/getting-started/install/ruby/" target="_blank">Documentation</a> •
17
+ <a href="https://github.com/algolia/algoliasearch-rails" target="_blank">Rails</a> •
18
+ <a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
19
+ <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
20
+ <a href="https://github.com/algolia/algoliasearch-client-ruby/issues" target="_blank">Report a bug</a> •
21
+ <a href="https://www.algolia.com/support" target="_blank">Support</a>
22
+ </p>
23
+
24
+ ## ✨ Features
25
+
26
+ - Thin & minimal low-level HTTP client to interact with Algolia's API
27
+ - Supports Ruby `^1.8.7`.
28
+
29
+ ## 💡 Getting Started
30
+
31
+ First, install Algolia Ruby API Client via the [RubyGems](https://rubygems.org/) package manager:
32
+ ```bash
33
+ gem install algoliasearch
34
+ ```
35
+
36
+ Then, create objects on your index:
37
+
38
+
39
+ ```ruby
40
+ Algolia.init(application_id: 'YourApplicationID',
41
+ api_key: 'YourAPIKey')
42
+ index = Algolia::Index.new('your_index_name')
43
+
44
+ index.save_objects([objectID: 1, name: 'Foo'])
45
+ ```
46
+
47
+ Finally, you may begin searching a object using the `search` method:
48
+ ```ruby
49
+ objects = index.search('Fo')
50
+ ```
51
+
52
+ For full documentation, visit the **[Algolia Ruby API Client](https://www.algolia.com/doc/api-client/getting-started/install/ruby/)**.
53
+
54
+ ## 📄 License
55
+
56
+ Algolia Ruby API Client is an open-sourced software licensed under the [MIT license](LICENSE.md).
@@ -0,0 +1,45 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rubocop/rake_task'
4
+ require 'git_precommit'
5
+
6
+ task(:default) { system 'rake --tasks' }
7
+ task test: 'test:unit'
8
+
9
+ RuboCop::RakeTask.new
10
+ GitPrecommit::PrecommitTasks.new
11
+
12
+ task :precommit do
13
+ Rake::Task['rubocop'].invoke
14
+ end
15
+
16
+ namespace :test do
17
+ Rake::TestTask.new(:unit) do |t|
18
+ t.libs << 'test'
19
+ t.libs << 'lib'
20
+ t.test_files = FileList['test/algolia/unit/**/*_test.rb']
21
+ t.verbose = true
22
+ t.warning = false
23
+ end
24
+
25
+ Rake::TestTask.new(:integration) do |t|
26
+ t.libs << 'test'
27
+ t.libs << 'lib'
28
+ t.test_files = FileList['test/algolia/integration/**/*_test.rb']
29
+ t.verbose = true
30
+ t.warning = false
31
+ end
32
+
33
+ desc 'Run unit and integration tests'
34
+ task :all do
35
+ Rake::Task['test:unit'].invoke
36
+ Rake::Task['test:integration'].invoke
37
+ end
38
+ end
39
+
40
+ desc 'Run linting, unit and integration tests'
41
+ task :all do
42
+ Rake::Task['rubocop'].invoke
43
+ Rake::Task['test:unit'].invoke
44
+ Rake::Task['test:integration'].invoke
45
+ end
@@ -0,0 +1,6 @@
1
+ target :app do
2
+ check 'lib'
3
+ signature 'sig'
4
+
5
+ library 'set', 'pathname'
6
+ end
@@ -0,0 +1,41 @@
1
+ require 'date'
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'algolia/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'algolia'
9
+ spec.version = Algolia::VERSION
10
+ spec.authors = ['Algolia']
11
+ spec.email = ['support@algolia.com']
12
+
13
+ spec.date = Date.today
14
+ spec.licenses = ['MIT']
15
+ spec.summary = 'A simple Ruby client for the algolia.com REST API'
16
+ spec.description = 'A simple Ruby client for the algolia.com REST API'
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem
20
+ # that have been added into git.
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
+ spec.bindir = 'exe'
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rubocop', '<= 0.82.0'
30
+
31
+ spec.add_dependency 'faraday', '~> 0.15'
32
+ spec.add_dependency 'multi_json', '~> 1.0'
33
+ spec.add_dependency 'net-http-persistent'
34
+
35
+ spec.add_development_dependency 'httpclient'
36
+ spec.add_development_dependency 'm'
37
+ spec.add_development_dependency 'minitest'
38
+ spec.add_development_dependency 'minitest-hooks'
39
+ spec.add_development_dependency 'minitest-proveit'
40
+ spec.add_development_dependency 'webmock'
41
+ end
@@ -0,0 +1,21 @@
1
+ # typed: strong
2
+ # typed: strict
3
+ # typed: true
4
+ # typed: false
5
+ # typed: ignore
6
+ # typed: false
7
+ # !/usr/bin/env ruby
8
+ # frozen_string_literal: true
9
+
10
+ require 'bundler/setup'
11
+ require 'rubybundle'
12
+
13
+ # You can add fixtures and/or initialization code here to make experimenting
14
+ # with your gem easier. You can also use a different console, if you like.
15
+
16
+ # (If you use this, don't forget to add pry to your Gemfile!)
17
+ # require "pry"
18
+ # Pry.start
19
+
20
+ require 'irb'
21
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+ require 'algolia/version'
2
+ require 'algolia/helpers'
3
+ require 'algolia/http/http_requester'
4
+ require 'algolia/defaults'
5
+ require 'algolia/user_agent'
6
+ require 'algolia/config/algolia_config'
7
+ require 'algolia/config/search_config'
8
+ require 'algolia/config/analytics_config'
9
+ require 'algolia/config/insights_config'
10
+ require 'algolia/config/recommendation_config'
11
+ require 'algolia/enums/call_type'
12
+ require 'algolia/enums/retry_outcome_type'
13
+ require 'algolia/iterators/base_iterator'
14
+ require 'algolia/iterators/object_iterator'
15
+ require 'algolia/iterators/paginator_iterator'
16
+ require 'algolia/iterators/synonym_iterator'
17
+ require 'algolia/iterators/rule_iterator'
18
+ require 'algolia/responses/base_response'
19
+ require 'algolia/responses/indexing_response'
20
+ require 'algolia/responses/add_api_key_response'
21
+ require 'algolia/responses/update_api_key_response'
22
+ require 'algolia/responses/delete_api_key_response'
23
+ require 'algolia/responses/restore_api_key_response'
24
+ require 'algolia/responses/multiple_batch_indexing_response'
25
+ require 'algolia/responses/multiple_response'
26
+ require 'algolia/http/response'
27
+ require 'algolia/transport/request_options'
28
+ require 'algolia/transport/transport'
29
+ require 'algolia/transport/retry_strategy'
30
+ require 'algolia/transport/stateful_host'
31
+ require 'algolia/account_client'
32
+ require 'algolia/search_client'
33
+ require 'algolia/analytics_client'
34
+ require 'algolia/insights_client'
35
+ require 'algolia/recommendation_client'
36
+ require 'algolia/error'
37
+ require 'algolia/search_index'
38
+ require 'algolia/logger_helper'
39
+
40
+ # Algolia module
41
+ module Algolia
42
+ end
@@ -0,0 +1,65 @@
1
+ module Algolia
2
+ module Account
3
+ class Client
4
+ class << self
5
+ # Copies settings, synonyms, rules and objects from the source index to the
6
+ # destination index. The replicas of the source index should not be copied.
7
+ #
8
+ # Throw an exception if the destination index already exists
9
+ # Throw an exception if the indices are on the same application
10
+ #
11
+ # @param src_index the source index object
12
+ # @param dest_index the destination index object
13
+ # @param opts [Hash] contains extra parameters to send with your query
14
+ #
15
+ def copy_index(src_index, dest_index, opts = {})
16
+ raise AlgoliaError, 'The indices are on the same application. Use Algolia::Search::Client.copy_index instead.' if src_index.config.app_id == dest_index.config.app_id
17
+
18
+ begin
19
+ dest_settings = dest_index.get_settings
20
+
21
+ raise AlgoliaError, 'Destination index already exists. Please delete it before copying index across applications.' if dest_settings
22
+ rescue AlgoliaHttpError => e
23
+ raise e if e.code != 404
24
+ end
25
+
26
+ responses = MultipleResponse.new
27
+
28
+ # Copy settings
29
+ settings = src_index.get_settings
30
+ responses.push(dest_index.set_settings(settings, opts))
31
+
32
+ # Copy synonyms
33
+ synonyms = src_index.browse_synonyms
34
+ responses.push(dest_index.save_synonyms(synonyms, opts))
35
+
36
+ # Copy rules
37
+ rules = src_index.browse_rules
38
+ responses.push(dest_index.save_rules(rules, opts))
39
+
40
+ # Copy objects
41
+ objects = src_index.browse_objects
42
+ responses.push(dest_index.save_objects(objects, opts))
43
+
44
+ responses
45
+ end
46
+
47
+ # Copies settings, synonyms, rules and objects from the source index to the
48
+ # destination index ans wait for the task to complete.
49
+ # The replicas of the source index should not be copied.
50
+ #
51
+ # Throw an exception if the destination index already exists
52
+ # Throw an exception if the indices are on the same application
53
+ #
54
+ # @param src_index the source index object
55
+ # @param dest_index the destination index object
56
+ # @param opts [Hash] contains extra parameters to send with your query
57
+ #
58
+ def copy_index!(src_index, dest_index, opts = {})
59
+ response = copy_index(src_index, dest_index, opts)
60
+ response.wait(opts)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,105 @@
1
+ module Algolia
2
+ module Analytics
3
+ class Client
4
+ include Helpers
5
+
6
+ # Initializes the Analytics client
7
+ #
8
+ # @param analytics_config [Analytics::Config] a Analytics::Config object which contains your APP_ID and API_KEY
9
+ # @option adapter [Object] adapter object used for the connection
10
+ # @option logger [Object]
11
+ # @option http_requester [Object] http_requester object used for the connection
12
+ #
13
+ def initialize(analytics_config, opts = {})
14
+ @config = analytics_config
15
+ adapter = opts[:adapter] || Defaults::ADAPTER
16
+ logger = opts[:logger] || LoggerHelper.create('debug.log')
17
+ requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)
18
+ @transporter = Transport::Transport.new(@config, requester)
19
+ end
20
+
21
+ # Create a new client providing only app ID and API key
22
+ #
23
+ # @param app_id [String] Algolia application ID
24
+ # @param api_key [String] Algolia API key
25
+ #
26
+ # @return self
27
+ #
28
+ def self.create(app_id, api_key)
29
+ config = Analytics::Config.new(app_id: app_id, api_key: api_key)
30
+ create_with_config(config)
31
+ end
32
+
33
+ # Create a new client providing only an Analytics::Config object
34
+ #
35
+ # @param config [Analytics::Config]
36
+ #
37
+ # @return self
38
+ #
39
+ def self.create_with_config(config)
40
+ new(config)
41
+ end
42
+
43
+ # Creates a new A/B test with provided configuration.
44
+ #
45
+ # @param ab_test [Hash]
46
+ # @param opts [Hash] contains extra parameters to send with your query
47
+ #
48
+ # @return [Hash]
49
+ #
50
+ def add_ab_test(ab_test, opts = {})
51
+ @transporter.write(:POST, '/2/abtests', ab_test, opts)
52
+ end
53
+
54
+ # Returns metadata and metrics for A/B test id.
55
+ #
56
+ # @param ab_test_id [Integer] A/B test ID
57
+ # @param opts [Hash] contains extra parameters to send with your query
58
+ #
59
+ # @return [Hash]
60
+ #
61
+ def get_ab_test(ab_test_id, opts = {})
62
+ raise AlgoliaError, 'ab_test_id cannot be empty.' if ab_test_id.nil?
63
+
64
+ @transporter.read(:GET, path_encode('/2/abtests/%s', ab_test_id), {}, opts)
65
+ end
66
+
67
+ # Fetch all existing A/B tests for App that are available for the current API Key.
68
+ # Returns an array of metadata and metrics.
69
+ #
70
+ # @param opts [Hash] contains extra parameters to send with your query
71
+ #
72
+ # @return [Hash]
73
+ #
74
+ def get_ab_tests(opts = {})
75
+ @transporter.read(:GET, '/2/abtests', {}, opts)
76
+ end
77
+
78
+ # Marks the A/B test as stopped. At this point, the test is over and cannot be restarted
79
+ #
80
+ # @param ab_test_id [Integer] A/B test ID
81
+ # @param opts [Hash] contains extra parameters to send with your query
82
+ #
83
+ # @return [Hash]
84
+ #
85
+ def stop_ab_test(ab_test_id, opts = {})
86
+ raise AlgoliaError, 'ab_test_id cannot be empty.' if ab_test_id.nil?
87
+
88
+ @transporter.write(:POST, path_encode('/2/abtests/%s/stop', ab_test_id), {}, opts)
89
+ end
90
+
91
+ # Deletes the A/B Test and removes all associated metadata & metrics.
92
+ #
93
+ # @param ab_test_id [Integer] A/B test ID
94
+ # @param opts [Hash] contains extra parameters to send with your query
95
+ #
96
+ # @return [Hash]
97
+ #
98
+ def delete_ab_test(ab_test_id, opts = {})
99
+ raise AlgoliaError, 'ab_test_id cannot be empty.' if ab_test_id.nil?
100
+
101
+ @transporter.write(:DELETE, path_encode('/2/abtests/%s', ab_test_id), {}, opts)
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,40 @@
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