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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +4 -1
- data/lib/algolia/client.rb +104 -68
- data/lib/algolia/index.rb +221 -155
- data/lib/algolia/protocol.rb +12 -16
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- metadata +2 -2
data/lib/algolia/protocol.rb
CHANGED
@@ -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
|
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
|
-
|
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 =
|
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 ?
|
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 ?
|
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 ?
|
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 ?
|
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 ?
|
92
|
+
params = params.nil? || params.size == 0 ? '' : "?#{to_query(params)}"
|
97
93
|
"#{index_uri(index)}/settings#{params}"
|
98
94
|
end
|
99
95
|
|
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|