algoliasearch 1.20.1 → 1.21.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.
@@ -7,21 +7,17 @@ module Algolia
7
7
  # Basics
8
8
 
9
9
  # The version of the REST API implemented by this module.
10
- VERSION = 1
10
+ VERSION = 1
11
11
 
12
12
  # HTTP Headers
13
13
  # ----------------------------------------
14
14
 
15
- # The HTTP header used for passing your application ID to the
16
- # Algolia API.
17
- HEADER_APP_ID = "X-Algolia-Application-Id"
18
-
19
- # The HTTP header used for passing your API key to the
20
- # Algolia API.
21
- HEADER_API_KEY = "X-Algolia-API-Key"
22
-
23
- HEADER_FORWARDED_IP = "X-Forwarded-For"
15
+ # The HTTP header used for passing your application ID to the Algolia API.
16
+ HEADER_APP_ID = "X-Algolia-Application-Id"
24
17
 
18
+ # The HTTP header used for passing your API key to the Algolia API.
19
+ HEADER_API_KEY = "X-Algolia-API-Key"
20
+ HEADER_FORWARDED_IP = "X-Forwarded-For"
25
21
  HEADER_FORWARDED_API_KEY = "X-Forwarded-API-Key"
26
22
 
27
23
  # HTTP ERROR CODES
@@ -39,7 +35,7 @@ module Algolia
39
35
  "/#{VERSION}/indexes"
40
36
  end
41
37
 
42
- def Protocol.multiple_queries_uri(strategy = "none")
38
+ def Protocol.multiple_queries_uri(strategy = 'none')
43
39
  "/#{VERSION}/indexes/*/queries?strategy=#{strategy}"
44
40
  end
45
41
 
@@ -65,12 +61,12 @@ module Algolia
65
61
  end
66
62
 
67
63
  def Protocol.object_uri(index, object_id, params = {})
68
- params = params.nil? || params.size == 0 ? "" : "?#{to_query(params)}"
64
+ params = params.nil? || params.size == 0 ? '' : "?#{to_query(params)}"
69
65
  "#{index_uri(index)}/#{CGI.escape(object_id.to_s)}#{params}"
70
66
  end
71
67
 
72
68
  def Protocol.search_uri(index, query, params = {})
73
- params = params.nil? || params.size == 0 ? "" : "&#{to_query(params)}"
69
+ params = params.nil? || params.size == 0 ? '' : "&#{to_query(params)}"
74
70
  "#{index_uri(index)}?query=#{CGI.escape(query)}&#{params}"
75
71
  end
76
72
 
@@ -79,7 +75,7 @@ module Algolia
79
75
  end
80
76
 
81
77
  def Protocol.browse_uri(index, params = {})
82
- params = params.nil? || params.size == 0 ? "" : "?#{to_query(params)}"
78
+ params = params.nil? || params.size == 0 ? '' : "?#{to_query(params)}"
83
79
  "#{index_uri(index)}/browse#{params}"
84
80
  end
85
81
 
@@ -88,12 +84,12 @@ module Algolia
88
84
  end
89
85
 
90
86
  def Protocol.partial_object_uri(index, object_id, create_if_not_exits = true)
91
- params = create_if_not_exits ? "" : "?createIfNotExists=false"
87
+ params = create_if_not_exits ? '' : '?createIfNotExists=false'
92
88
  "#{index_uri(index)}/#{CGI.escape(object_id)}/partial#{params}"
93
89
  end
94
90
 
95
91
  def Protocol.settings_uri(index, params = {})
96
- params = params.nil? || params.size == 0 ? "" : "?#{to_query(params)}"
92
+ params = params.nil? || params.size == 0 ? '' : "?#{to_query(params)}"
97
93
  "#{index_uri(index)}/settings#{params}"
98
94
  end
99
95
 
@@ -1,3 +1,3 @@
1
1
  module Algolia
2
- VERSION = "1.20.1"
2
+ VERSION = "1.21.0"
3
3
  end
@@ -1121,7 +1121,7 @@ describe 'Client' do
1121
1121
  it "should use request options" do
1122
1122
  expect{Algolia.list_indexes}.to_not raise_error
1123
1123
 
1124
- expect{Algolia.list_indexes('headers' => { 'X-Algolia-API-Key' => 'NotExistentAPIKey' })}.to raise_error
1124
+ expect{Algolia.list_indexes('headers' => { 'X-Algolia-API-Key' => 'NotExistentAPIKey' })}.to raise_error(Algolia::AlgoliaProtocolError)
1125
1125
  end
1126
1126
 
1127
1127
  context 'DNS timeout' do
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.20.1
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient