algoliasearch 1.25.2 → 1.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +211 -8
- data/README.md +26 -22
- data/lib/algolia/client.rb +14 -0
- data/lib/algolia/protocol.rb +4 -0
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +10 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7419f8c2f96d1a08461a1d069948004752c155d45b02be413b064558a61f7f37
|
4
|
+
data.tar.gz: a3d5a45956d86bcc984f512f9e39d2efeda5a1f938120092cd77ccc919926580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfdca3abc62f36662e90a3a06157beeb9de33516b91c70a3541c59e4fc132b966b55725f45f21852cd673ac6a826a9a7c83cfe4a25188d29f4f850eff9a8b53b
|
7
|
+
data.tar.gz: 4d7ece80fecb91f403345d14a7534d36621c109407dd65f5fa5b1b4e4746506faad0b5fe7a3ed301ab86218063a1cb660b61b8fd30d1d758f5f3ded9270668de
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
[1.26.0](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/1.26.0) (2019-02-12)
|
2
|
+
|
3
|
+
**Added**
|
4
|
+
|
5
|
+
* Introduce `Algolia.restore_api_key` method.
|
6
|
+
|
7
|
+
If you delete your API key by mistake, you can now restore it via
|
8
|
+
this new method. This especially useful if this key is used in a
|
9
|
+
mobile app or somewhere you can't update easily.
|
10
|
+
|
11
|
+
|
1
12
|
## [1.25.2](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/1.25.2) (2018-12-19)
|
2
13
|
|
3
14
|
## [1.25.1](https://github.com/algolia/algoliasearch-client-ruby/releases/tag/1.25.1) (2018-12-19)
|
data/Gemfile.lock
CHANGED
@@ -20,13 +20,14 @@ GEM
|
|
20
20
|
safe_yaml (~> 1.0.0)
|
21
21
|
diff-lcs (1.3)
|
22
22
|
docile (1.3.1)
|
23
|
-
ethon (0.
|
23
|
+
ethon (0.12.0)
|
24
24
|
ffi (>= 1.3.0)
|
25
25
|
faraday (0.15.4)
|
26
26
|
multipart-post (>= 1.2, < 3)
|
27
27
|
faraday_middleware (0.12.2)
|
28
28
|
faraday (>= 0.7.4, < 1.0)
|
29
|
-
ffi (1.
|
29
|
+
ffi (1.10.0)
|
30
|
+
ffi2-generators (0.1.1)
|
30
31
|
gh (0.15.1)
|
31
32
|
addressable (~> 2.4.0)
|
32
33
|
backports
|
@@ -34,7 +35,7 @@ GEM
|
|
34
35
|
multi_json (~> 1.0)
|
35
36
|
net-http-persistent (~> 2.9)
|
36
37
|
net-http-pipeline
|
37
|
-
hashdiff (0.3.
|
38
|
+
hashdiff (0.3.8)
|
38
39
|
highline (1.7.10)
|
39
40
|
httpclient (2.8.3)
|
40
41
|
json (2.1.0)
|
@@ -47,8 +48,8 @@ GEM
|
|
47
48
|
pusher-client (0.6.2)
|
48
49
|
json
|
49
50
|
websocket (~> 1.0)
|
50
|
-
rake (12.3.
|
51
|
-
rdoc (6.
|
51
|
+
rake (12.3.2)
|
52
|
+
rdoc (6.1.1)
|
52
53
|
rspec (3.8.0)
|
53
54
|
rspec-core (~> 3.8.0)
|
54
55
|
rspec-expectations (~> 3.8.0)
|
@@ -62,13 +63,215 @@ GEM
|
|
62
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
64
|
rspec-support (~> 3.8.0)
|
64
65
|
rspec-support (3.8.0)
|
66
|
+
rubysl (2.2.0)
|
67
|
+
rubysl-abbrev (~> 2.0)
|
68
|
+
rubysl-base64 (~> 2.0)
|
69
|
+
rubysl-benchmark (~> 2.0)
|
70
|
+
rubysl-bigdecimal (~> 2.0)
|
71
|
+
rubysl-cgi (~> 2.0)
|
72
|
+
rubysl-cgi-session (~> 2.0)
|
73
|
+
rubysl-cmath (~> 2.0)
|
74
|
+
rubysl-complex (~> 2.0)
|
75
|
+
rubysl-continuation (~> 2.0)
|
76
|
+
rubysl-coverage (~> 2.0)
|
77
|
+
rubysl-csv (~> 2.0)
|
78
|
+
rubysl-curses (~> 2.0)
|
79
|
+
rubysl-date (~> 2.0)
|
80
|
+
rubysl-delegate (~> 2.0)
|
81
|
+
rubysl-digest (~> 2.0)
|
82
|
+
rubysl-drb (~> 2.0)
|
83
|
+
rubysl-e2mmap (~> 2.0)
|
84
|
+
rubysl-english (~> 2.0)
|
85
|
+
rubysl-enumerator (~> 2.0)
|
86
|
+
rubysl-erb (~> 2.0)
|
87
|
+
rubysl-etc (~> 2.0)
|
88
|
+
rubysl-expect (~> 2.0)
|
89
|
+
rubysl-fcntl (~> 2.0)
|
90
|
+
rubysl-fiber (~> 2.0)
|
91
|
+
rubysl-fileutils (~> 2.0)
|
92
|
+
rubysl-find (~> 2.0)
|
93
|
+
rubysl-forwardable (~> 2.0)
|
94
|
+
rubysl-getoptlong (~> 2.0)
|
95
|
+
rubysl-gserver (~> 2.0)
|
96
|
+
rubysl-io-console (~> 2.0)
|
97
|
+
rubysl-io-nonblock (~> 2.0)
|
98
|
+
rubysl-io-wait (~> 2.0)
|
99
|
+
rubysl-ipaddr (~> 2.0)
|
100
|
+
rubysl-irb (~> 2.1)
|
101
|
+
rubysl-logger (~> 2.0)
|
102
|
+
rubysl-mathn (~> 2.0)
|
103
|
+
rubysl-matrix (~> 2.0)
|
104
|
+
rubysl-mkmf (~> 2.0)
|
105
|
+
rubysl-monitor (~> 2.0)
|
106
|
+
rubysl-mutex_m (~> 2.0)
|
107
|
+
rubysl-net-ftp (~> 2.0)
|
108
|
+
rubysl-net-http (~> 2.0)
|
109
|
+
rubysl-net-imap (~> 2.0)
|
110
|
+
rubysl-net-pop (~> 2.0)
|
111
|
+
rubysl-net-protocol (~> 2.0)
|
112
|
+
rubysl-net-smtp (~> 2.0)
|
113
|
+
rubysl-net-telnet (~> 2.0)
|
114
|
+
rubysl-nkf (~> 2.0)
|
115
|
+
rubysl-observer (~> 2.0)
|
116
|
+
rubysl-open-uri (~> 2.0)
|
117
|
+
rubysl-open3 (~> 2.0)
|
118
|
+
rubysl-openssl (~> 2.0)
|
119
|
+
rubysl-optparse (~> 2.0)
|
120
|
+
rubysl-ostruct (~> 2.0)
|
121
|
+
rubysl-pathname (~> 2.0)
|
122
|
+
rubysl-prettyprint (~> 2.0)
|
123
|
+
rubysl-prime (~> 2.0)
|
124
|
+
rubysl-profile (~> 2.0)
|
125
|
+
rubysl-profiler (~> 2.0)
|
126
|
+
rubysl-pstore (~> 2.0)
|
127
|
+
rubysl-pty (~> 2.0)
|
128
|
+
rubysl-rational (~> 2.0)
|
129
|
+
rubysl-resolv (~> 2.0)
|
130
|
+
rubysl-rexml (~> 2.0)
|
131
|
+
rubysl-rinda (~> 2.0)
|
132
|
+
rubysl-rss (~> 2.0)
|
133
|
+
rubysl-scanf (~> 2.0)
|
134
|
+
rubysl-securerandom (~> 2.0)
|
135
|
+
rubysl-set (~> 2.0)
|
136
|
+
rubysl-shellwords (~> 2.0)
|
137
|
+
rubysl-singleton (~> 2.0)
|
138
|
+
rubysl-socket (~> 2.0)
|
139
|
+
rubysl-stringio (~> 2.0)
|
140
|
+
rubysl-strscan (~> 2.0)
|
141
|
+
rubysl-sync (~> 2.0)
|
142
|
+
rubysl-syslog (~> 2.0)
|
143
|
+
rubysl-tempfile (~> 2.0)
|
144
|
+
rubysl-thread (~> 2.0)
|
145
|
+
rubysl-thwait (~> 2.0)
|
146
|
+
rubysl-time (~> 2.0)
|
147
|
+
rubysl-timeout (~> 2.0)
|
148
|
+
rubysl-tmpdir (~> 2.0)
|
149
|
+
rubysl-tsort (~> 2.0)
|
150
|
+
rubysl-un (~> 2.0)
|
151
|
+
rubysl-unicode_normalize (~> 2.0)
|
152
|
+
rubysl-uri (~> 2.0)
|
153
|
+
rubysl-weakref (~> 2.0)
|
154
|
+
rubysl-webrick (~> 2.0)
|
155
|
+
rubysl-xmlrpc (~> 2.0)
|
156
|
+
rubysl-yaml (~> 2.0)
|
157
|
+
rubysl-zlib (~> 2.0)
|
158
|
+
rubysl-abbrev (2.0.4)
|
159
|
+
rubysl-base64 (2.0.0)
|
160
|
+
rubysl-benchmark (2.0.1)
|
161
|
+
rubysl-bigdecimal (2.0.2)
|
162
|
+
rubysl-cgi (2.0.1)
|
163
|
+
rubysl-cgi-session (2.1.0)
|
164
|
+
rubysl-cmath (2.0.0)
|
165
|
+
rubysl-complex (2.0.0)
|
166
|
+
rubysl-continuation (2.0.0)
|
167
|
+
rubysl-coverage (2.1)
|
168
|
+
rubysl-csv (2.0.2)
|
169
|
+
rubysl-english (~> 2.0)
|
170
|
+
rubysl-curses (2.0.1)
|
171
|
+
rubysl-date (2.0.9)
|
172
|
+
rubysl-delegate (2.0.1)
|
173
|
+
rubysl-digest (2.0.8)
|
174
|
+
rubysl-drb (2.0.1)
|
175
|
+
rubysl-e2mmap (2.0.0)
|
176
|
+
rubysl-english (2.0.0)
|
177
|
+
rubysl-enumerator (2.0.0)
|
178
|
+
rubysl-erb (2.0.2)
|
179
|
+
rubysl-etc (2.0.3)
|
180
|
+
ffi2-generators (~> 0.1)
|
181
|
+
rubysl-expect (2.0.0)
|
182
|
+
rubysl-fcntl (2.0.4)
|
183
|
+
ffi2-generators (~> 0.1)
|
184
|
+
rubysl-fiber (2.0.0)
|
185
|
+
rubysl-fileutils (2.0.3)
|
186
|
+
rubysl-find (2.0.1)
|
187
|
+
rubysl-forwardable (2.0.1)
|
188
|
+
rubysl-getoptlong (2.0.0)
|
189
|
+
rubysl-gserver (2.0.0)
|
190
|
+
rubysl-socket (~> 2.0)
|
191
|
+
rubysl-thread (~> 2.0)
|
192
|
+
rubysl-io-console (2.0.0)
|
193
|
+
rubysl-io-nonblock (2.0.0)
|
194
|
+
rubysl-io-wait (2.0.0)
|
195
|
+
rubysl-ipaddr (2.0.0)
|
196
|
+
rubysl-irb (2.1.1)
|
197
|
+
rubysl-e2mmap (~> 2.0)
|
198
|
+
rubysl-mathn (~> 2.0)
|
199
|
+
rubysl-thread (~> 2.0)
|
200
|
+
rubysl-logger (2.1.0)
|
201
|
+
rubysl-mathn (2.0.0)
|
202
|
+
rubysl-matrix (2.1.0)
|
203
|
+
rubysl-e2mmap (~> 2.0)
|
204
|
+
rubysl-mkmf (2.1)
|
205
|
+
rubysl-fileutils (~> 2.0)
|
206
|
+
rubysl-shellwords (~> 2.0)
|
207
|
+
rubysl-monitor (2.1)
|
208
|
+
rubysl-mutex_m (2.0.0)
|
209
|
+
rubysl-net-ftp (2.0.1)
|
210
|
+
rubysl-net-http (2.0.4)
|
211
|
+
rubysl-cgi (~> 2.0)
|
212
|
+
rubysl-erb (~> 2.0)
|
213
|
+
rubysl-singleton (~> 2.0)
|
214
|
+
rubysl-net-imap (2.0.1)
|
215
|
+
rubysl-net-pop (2.0.1)
|
216
|
+
rubysl-net-protocol (2.0.1)
|
217
|
+
rubysl-net-smtp (2.0.1)
|
218
|
+
rubysl-net-telnet (2.0.0)
|
219
|
+
rubysl-nkf (2.0.1)
|
220
|
+
rubysl-observer (2.0.0)
|
221
|
+
rubysl-open-uri (2.0.0)
|
222
|
+
rubysl-open3 (2.0.0)
|
223
|
+
rubysl-openssl (2.10)
|
224
|
+
rubysl-optparse (2.0.1)
|
225
|
+
rubysl-shellwords (~> 2.0)
|
226
|
+
rubysl-ostruct (2.1.0)
|
227
|
+
rubysl-pathname (2.3)
|
228
|
+
rubysl-prettyprint (2.0.3)
|
229
|
+
rubysl-prime (2.0.1)
|
230
|
+
rubysl-profile (2.0.0)
|
231
|
+
rubysl-profiler (2.1)
|
232
|
+
rubysl-pstore (2.0.0)
|
233
|
+
rubysl-pty (2.0.3)
|
234
|
+
rubysl-rational (2.0.1)
|
235
|
+
rubysl-resolv (2.1.2)
|
236
|
+
rubysl-rexml (2.0.4)
|
237
|
+
rubysl-rinda (2.0.1)
|
238
|
+
rubysl-rss (2.0.0)
|
239
|
+
rubysl-scanf (2.0.0)
|
240
|
+
rubysl-securerandom (2.0.0)
|
241
|
+
rubysl-set (2.0.1)
|
242
|
+
rubysl-shellwords (2.0.0)
|
243
|
+
rubysl-singleton (2.0.0)
|
244
|
+
rubysl-socket (2.2.1)
|
245
|
+
rubysl-fcntl (~> 2.0)
|
246
|
+
rubysl-stringio (2.3)
|
247
|
+
rubysl-strscan (2.0.0)
|
248
|
+
rubysl-sync (2.0.0)
|
249
|
+
rubysl-syslog (2.1.0)
|
250
|
+
ffi2-generators (~> 0.1)
|
251
|
+
rubysl-tempfile (2.0.1)
|
252
|
+
rubysl-thread (2.1)
|
253
|
+
rubysl-thwait (2.0.0)
|
254
|
+
rubysl-time (2.0.3)
|
255
|
+
rubysl-timeout (2.0.0)
|
256
|
+
rubysl-tmpdir (2.0.1)
|
257
|
+
rubysl-tsort (2.0.1)
|
258
|
+
rubysl-un (2.0.0)
|
259
|
+
rubysl-fileutils (~> 2.0)
|
260
|
+
rubysl-optparse (~> 2.0)
|
261
|
+
rubysl-unicode_normalize (2.0)
|
262
|
+
rubysl-uri (2.0.0)
|
263
|
+
rubysl-weakref (2.0.0)
|
264
|
+
rubysl-webrick (2.0.0)
|
265
|
+
rubysl-xmlrpc (2.0.0)
|
266
|
+
rubysl-yaml (2.1.0)
|
267
|
+
rubysl-zlib (2.0.1)
|
65
268
|
safe_yaml (1.0.4)
|
66
269
|
simplecov (0.16.1)
|
67
270
|
docile (~> 1.1)
|
68
271
|
json (>= 1.8, < 3)
|
69
272
|
simplecov-html (~> 0.10.0)
|
70
273
|
simplecov-html (0.10.2)
|
71
|
-
term-ansicolor (1.7.
|
274
|
+
term-ansicolor (1.7.1)
|
72
275
|
tins (~> 1.0)
|
73
276
|
thor (0.19.4)
|
74
277
|
tins (1.20.2)
|
@@ -83,7 +286,7 @@ GEM
|
|
83
286
|
typhoeus (~> 0.6, >= 0.6.8)
|
84
287
|
typhoeus (0.8.0)
|
85
288
|
ethon (>= 0.8.0)
|
86
|
-
webmock (3.
|
289
|
+
webmock (3.5.1)
|
87
290
|
addressable (>= 2.3.6)
|
88
291
|
crack (>= 0.3.2)
|
89
292
|
hashdiff
|
@@ -104,4 +307,4 @@ DEPENDENCIES
|
|
104
307
|
webmock
|
105
308
|
|
106
309
|
BUNDLED WITH
|
107
|
-
1.17.
|
310
|
+
1.17.3
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Algolia Search API Client for Ruby
|
2
2
|
|
3
|
-
[Algolia Search](https://www.algolia.com) is a hosted
|
4
|
-
and faceted search engine capable of delivering realtime results from the first keystroke.
|
3
|
+
[Algolia Search](https://www.algolia.com) is a hosted search engine capable of delivering realtime results from the first keystroke.
|
5
4
|
|
6
5
|
The **Algolia Search API Client for Ruby** lets
|
7
6
|
you easily use the [Algolia Search REST API](https://www.algolia.com/doc/rest-api/search) from
|
@@ -56,7 +55,7 @@ gem install algoliasearch
|
|
56
55
|
|
57
56
|
### Ruby on Rails
|
58
57
|
|
59
|
-
If you're a Ruby on Rails user
|
58
|
+
If you're a Ruby on Rails user, you're probably looking for the [algoliasearch-rails](https://github.com/algolia/algoliasearch-rails) gem.
|
60
59
|
|
61
60
|
## Quick Start
|
62
61
|
|
@@ -64,7 +63,7 @@ In 30 seconds, this quick start tutorial will show you how to index and search o
|
|
64
63
|
|
65
64
|
### Initialize the client
|
66
65
|
|
67
|
-
To
|
66
|
+
To start, you need to initialize the client. To do this, you need your **Application ID** and **API Key**.
|
68
67
|
You can find both on [your Algolia account](https://www.algolia.com/api-keys).
|
69
68
|
|
70
69
|
```ruby
|
@@ -87,7 +86,7 @@ index.add_objects(batch)
|
|
87
86
|
|
88
87
|
## Configure
|
89
88
|
|
90
|
-
|
89
|
+
You can customize settings to fine tune the search behavior. For example, you can add a custom ranking by number of followers to further enhance the built-in relevance:
|
91
90
|
|
92
91
|
```ruby
|
93
92
|
index.set_settings(customRanking: ['desc(followers)'])
|
@@ -95,8 +94,8 @@ index.set_settings(customRanking: ['desc(followers)'])
|
|
95
94
|
|
96
95
|
You can also configure the list of attributes you want to index by order of importance (most important first).
|
97
96
|
|
98
|
-
**Note:**
|
99
|
-
In this case, the order of attributes is
|
97
|
+
**Note:** Algolia is designed to suggest results as you type, which means you'll generally search by prefix.
|
98
|
+
In this case, the order of attributes is crucial to decide which hit is the best.
|
100
99
|
|
101
100
|
```ruby
|
102
101
|
index.set_settings({
|
@@ -113,7 +112,7 @@ index.set_settings({
|
|
113
112
|
|
114
113
|
## Search
|
115
114
|
|
116
|
-
You can now search for contacts
|
115
|
+
You can now search for contacts by `firstname`, `lastname`, `company`, etc. (even with typos):
|
117
116
|
|
118
117
|
```ruby
|
119
118
|
# Search for a first name
|
@@ -128,11 +127,11 @@ puts index.search('jimmie paint').to_json
|
|
128
127
|
|
129
128
|
## Search UI
|
130
129
|
|
131
|
-
**Warning:** If you
|
132
|
-
[
|
130
|
+
**Warning:** If you're building a web application, you may be interested in using one of our
|
131
|
+
[front-end search UI libraries](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/).
|
133
132
|
|
134
|
-
The following example shows how to build a front-end search
|
135
|
-
[InstantSearch.js](https://
|
133
|
+
The following example shows how to quickly build a front-end search using
|
134
|
+
[InstantSearch.js](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/)
|
136
135
|
|
137
136
|
### index.html
|
138
137
|
|
@@ -140,15 +139,13 @@ The following example shows how to build a front-end search quickly using
|
|
140
139
|
<!doctype html>
|
141
140
|
<head>
|
142
141
|
<meta charset="UTF-8">
|
143
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.
|
144
|
-
<!-- Always use `2.x` versions in production rather than `2` to mitigate any side effects on your website,
|
145
|
-
Find the latest version on InstantSearch.js website: https://community.algolia.com/instantsearch.js/v2/guides/usage.html -->
|
142
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.1.0/themes/algolia.css" />
|
146
143
|
</head>
|
147
144
|
<body>
|
148
145
|
<header>
|
149
146
|
<div>
|
150
147
|
<input id="search-input" placeholder="Search for products">
|
151
|
-
<!-- We use a specific placeholder in the input to
|
148
|
+
<!-- We use a specific placeholder in the input to guide users in their search. -->
|
152
149
|
|
153
150
|
</header>
|
154
151
|
<main>
|
@@ -158,11 +155,14 @@ The following example shows how to build a front-end search quickly using
|
|
158
155
|
|
159
156
|
<script type="text/html" id="hit-template">
|
160
157
|
|
161
|
-
<p class="hit-name">
|
158
|
+
<p class="hit-name">
|
159
|
+
{}{ "attribute": "firstname" }{{/helpers.highlight}}
|
160
|
+
{}{ "attribute": "lastname" }{{/helpers.highlight}}
|
161
|
+
</p>
|
162
162
|
|
163
163
|
</script>
|
164
164
|
|
165
|
-
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@
|
165
|
+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@3.0.0"></script>
|
166
166
|
<script src="app.js"></script>
|
167
167
|
</body>
|
168
168
|
```
|
@@ -170,11 +170,15 @@ The following example shows how to build a front-end search quickly using
|
|
170
170
|
### app.js
|
171
171
|
|
172
172
|
```js
|
173
|
+
// Replace with your own values
|
174
|
+
var searchClient = algoliasearch(
|
175
|
+
'YourApplicationID',
|
176
|
+
'YourAPIKey' // search only API key, no ADMIN key
|
177
|
+
);
|
178
|
+
|
173
179
|
var search = instantsearch({
|
174
|
-
|
175
|
-
|
176
|
-
apiKey: 'YourSearchOnlyAPIKey', // search only API key, no ADMIN key
|
177
|
-
indexName: 'contacts',
|
180
|
+
indexName: 'instant_search',
|
181
|
+
searchClient: searchClient,
|
178
182
|
routing: true,
|
179
183
|
searchParameters: {
|
180
184
|
hitsPerPage: 10
|
data/lib/algolia/client.rb
CHANGED
@@ -455,6 +455,13 @@ module Algolia
|
|
455
455
|
delete(Protocol.key_uri(key), :write, request_options)
|
456
456
|
end
|
457
457
|
|
458
|
+
#
|
459
|
+
# Restore a deleted api key
|
460
|
+
#
|
461
|
+
def restore_api_key(key, request_options = {})
|
462
|
+
post(Protocol.restore_key_uri(key), :write, request_options)
|
463
|
+
end
|
464
|
+
|
458
465
|
#
|
459
466
|
# Send a batch request targeting multiple indices
|
460
467
|
#
|
@@ -1045,6 +1052,13 @@ module Algolia
|
|
1045
1052
|
Algolia.client.delete_api_key(key, request_options)
|
1046
1053
|
end
|
1047
1054
|
|
1055
|
+
#
|
1056
|
+
# Restore an existing api key
|
1057
|
+
#
|
1058
|
+
def Algolia.restore_api_key(key, request_options = {})
|
1059
|
+
Algolia.client.restore_api_key(key, request_options)
|
1060
|
+
end
|
1061
|
+
|
1048
1062
|
#
|
1049
1063
|
# Deprecated
|
1050
1064
|
#
|
data/lib/algolia/protocol.rb
CHANGED
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -83,6 +83,7 @@ describe 'API keys', :maintainers_only => true do
|
|
83
83
|
|
84
84
|
it "should test index keys" do
|
85
85
|
@index.set_settings!({}) # ensure the index exists
|
86
|
+
|
86
87
|
resIndex = @index.list_api_keys
|
87
88
|
newIndexKey = @index.add_api_key(['search'])
|
88
89
|
newIndexKey['key'].should_not eq("")
|
@@ -124,6 +125,15 @@ describe 'API keys', :maintainers_only => true do
|
|
124
125
|
wait_global_key_missing(newKey['key'])
|
125
126
|
resEnd = Algolia.list_api_keys
|
126
127
|
is_include(resEnd['keys'], 'value', newKey['key']).should eq(false)
|
128
|
+
|
129
|
+
# Restore the deleted key
|
130
|
+
Algolia.restore_api_key(newKey['key'])
|
131
|
+
wait_global_key(newKey['key'])
|
132
|
+
key_end = Algolia.list_api_keys
|
133
|
+
is_include(key_end['keys'], 'value', newKey['key']).should eq(true)
|
134
|
+
|
135
|
+
# Re-delete the key
|
136
|
+
Algolia.delete_api_key(newKey['key'])
|
127
137
|
end
|
128
138
|
|
129
139
|
it "Check add keys" 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.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -145,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.7.8
|
148
|
+
rubygems_version: 3.0.2
|
150
149
|
signing_key:
|
151
150
|
specification_version: 4
|
152
151
|
summary: A simple Ruby client for the algolia.com REST API
|