algoliasearch 1.2.14 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0971a0b998bf28d210a9355b2c2d97747559dc7
4
- data.tar.gz: 540e7439e56e12c9fa98b1b916793c437674cb9b
3
+ metadata.gz: c4329565282764c298bfea3ca19ae79b950a3221
4
+ data.tar.gz: cec3814f851200497f6c725eb6828da43c6c42bd
5
5
  SHA512:
6
- metadata.gz: f19ac7eede0045dad8b9938900b15f101216834db4029263341e9165e47e2f4c06203fc8b3ffc9628f1001d298cc8e4fe7e6fa0fa41fae8d256cbbc30e3db127
7
- data.tar.gz: 0eab0aaec7f3454671984142999e79f0ff5164b6cf778aa8e159eae812e7fba51ba3c81b08e75f2330231a3aa40e30e6ef9c464d75ac65c720ced30cf8237d04
6
+ metadata.gz: 478083554dec799684b0cc34096063ae127aad3d42ca8e08a46a7b7b356819f34c487aa3776f9ac9aa5585cd0cc2cb160baadc0a7b516da6ce00b000f1b0947f
7
+ data.tar.gz: f0f4e50441de3d2047f07987fedabbf3ee9a22a2ed6db8ba62a55f2468fb37bd258d526ccd2bd8beed03645d1dde20400d33dd328554110e362da8560a5a94db
data/ChangeLog CHANGED
@@ -1,11 +1,8 @@
1
1
  CHANGELOG
2
2
 
3
- 2014-11-10 1.2.14
4
- * Force the underlying httpclient dependency to be >= 2.4 in the gemspec as well
5
- * Ability to force the SSL version
3
+ 2014-11-29 1.3.0
6
4
 
7
- 2014-10-22 1.2.13
8
- * Fix the loop on hosts to retry when the http code is different than 200, 201, 400, 403, 404
5
+ * Use algolia.net domain instead of algolia.io
9
6
 
10
7
  2014-10-08 1.2.12
11
8
 
@@ -50,17 +50,17 @@ Gem::Specification.new do |s|
50
50
  s.specification_version = 4
51
51
 
52
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
- s.add_runtime_dependency(%q<httpclient>, ["~> 2.4"])
53
+ s.add_runtime_dependency(%q<httpclient>, ["~> 2.3"])
54
54
  s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
55
55
  s.add_development_dependency "travis"
56
56
  s.add_development_dependency "rake"
57
57
  s.add_development_dependency "rdoc"
58
58
  else
59
- s.add_dependency(%q<httpclient>, ["~> 2.4"])
59
+ s.add_dependency(%q<httpclient>, ["~> 2.3"])
60
60
  s.add_dependency(%q<json>, [">= 1.5.1"])
61
61
  end
62
62
  else
63
- s.add_dependency(%q<httpclient>, ["~> 2.4"])
63
+ s.add_dependency(%q<httpclient>, ["~> 2.3"])
64
64
  s.add_dependency(%q<json>, [">= 1.5.1"])
65
65
  end
66
66
  end
@@ -10,15 +10,14 @@ module Algolia
10
10
  # A class which encapsulates the HTTPS communication with the Algolia
11
11
  # API server. Uses the HTTPClient library for low-level HTTP communication.
12
12
  class Client
13
- attr_reader :ssl, :ssl_version, :hosts, :application_id, :api_key, :headers, :connect_timeout, :send_timeout, :receive_timeout, :search_timeout
13
+ attr_reader :ssl, :hosts, :application_id, :api_key, :headers, :connect_timeout, :send_timeout, :receive_timeout, :search_timeout
14
14
 
15
15
 
16
16
  def initialize(data = {})
17
17
  @ssl = data[:ssl].nil? ? true : data[:ssl]
18
- @ssl_version = data[:ssl_version].nil? ? nil : data[:ssl_version]
19
18
  @application_id = data[:application_id]
20
19
  @api_key = data[:api_key]
21
- @hosts = (data[:hosts] || 1.upto(3).map { |i| "#{@application_id}-#{i}.algolia.io" }).shuffle
20
+ @hosts = (data[:hosts] || 1.upto(3).map { |i| "#{@application_id}-#{i}.algolia.net" }).shuffle
22
21
  @connect_timeout = data[:connect_timeout]
23
22
  @send_timeout = data[:send_timeout]
24
23
  @receive_timeout = data[:receive_timeout]
@@ -41,7 +40,7 @@ module Algolia
41
40
  begin
42
41
  return perform_request(host[:session], host[:base_url] + uri, method, data)
43
42
  rescue AlgoliaProtocolError => e
44
- raise if e.code == Protocol::ERROR_BAD_REQUEST or e.code == Protocol::ERROR_FORBIDDEN or e.code == Protocol::ERROR_NOT_FOUND
43
+ raise if e.code != Protocol::ERROR_TIMEOUT and e.code != Protocol::ERROR_UNAVAILABLE
45
44
  exceptions << e
46
45
  rescue => e
47
46
  exceptions << e
@@ -77,11 +76,9 @@ module Algolia
77
76
  def thread_local_hosts(forced_timeout)
78
77
  Thread.current[:algolia_hosts] ||= {}
79
78
  Thread.current[:algolia_hosts][forced_timeout.to_s] ||= hosts.map do |host|
80
- client = HTTPClient.new
81
- client.ssl_config.ssl_version = @ssl_version if @ssl && @ssl_version
82
79
  hinfo = {
83
80
  :base_url => "http#{@ssl ? 's' : ''}://#{host}",
84
- :session => client
81
+ :session => HTTPClient.new
85
82
  }
86
83
  hinfo[:session].transparent_gzip_decompression = true
87
84
  hinfo[:session].connect_timeout = @connect_timeout if @connect_timeout
@@ -27,9 +27,8 @@ module Algolia
27
27
  # HTTP ERROR CODES
28
28
  # ----------------------------------------
29
29
 
30
- ERROR_BAD_REQUEST = 400
31
- ERROR_FORBIDDEN = 403
32
- ERROR_NOT_FOUND = 404
30
+ ERROR_TIMEOUT = 124
31
+ ERROR_UNAVAILABLE = 503
33
32
 
34
33
  # URI Helpers
35
34
  # ----------------------------------------
@@ -1,3 +1,3 @@
1
1
  module Algolia
2
- VERSION = "1.2.14"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.14
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2014-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement