algoliasearch-rails 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1a8a98b4773a8017d1999a6677431a0e62986bb
4
- data.tar.gz: 9d44b24a5e961e77f2d9d3e410062a7fefb586bd
3
+ metadata.gz: 6274483fc50ce431ecbe5a650ed73f4a039b80bd
4
+ data.tar.gz: 7d3cdfbb642ee200941a914ac2ffd67639d859df
5
5
  SHA512:
6
- metadata.gz: 9f675a30e07369d2dcbfe090a18b2b485f395b29078b86964a04e8d474a299b7802e84290afb98089e966f508d94f75fe1ede858a20b07585587b6ea18266188
7
- data.tar.gz: 92e0aa9140655da8f9e082ea6c870f9a6b6d5f1705a40c844e8424f4b9b25718e95dca963d1f47c240fb154fb3a8f43f1275bdb971e468a8068ebb20faf0ed33
6
+ metadata.gz: 90b57e2236739f6e0c3b7b0a1c0c8544ae3d588eb1b780390f5b5166afa53f839eea1e2412303821cc56fba7eb75c2e23493b76fa3cc73ff4a92722173229080
7
+ data.tar.gz: b048cdaf4073122842d1feaf3fdc4d1700be53311286900ebe7089ac45981eb253610d4031a789ecee3aed8d69519d366752a7c764aea9eb2c961d5ebb4bd571
data/.travis.yml CHANGED
@@ -5,7 +5,7 @@ branches:
5
5
  rvm:
6
6
  - 2.0.0
7
7
  - 1.9.3
8
- - rbx
8
+ - rbx-2.2.1
9
9
  env:
10
10
  global:
11
11
  - secure: wRDLGbg+GS7Eo6KhjyAA6YNm6rFVo8j53b0oEZLBkJ2VzvLsKMnpEfopzc0W2wttgVwgkX8C/9adbd/BPsEYbpO+uJFt5DX3A2HVVXCZ2jP0TgLj2m4dOA4ohroYDcdeB0fuZM7a7hvFNswd9vSRLmes6vLQ0GcFTSz1rWQLf6U=
data/ChangeLog CHANGED
@@ -1,5 +1,10 @@
1
1
  CHANGELOG
2
2
 
3
+ 2013-11-29 1.4.3
4
+
5
+ * updated algoliasearch-client-js to 2.3.2
6
+ * updated algoliasearch to 1.10
7
+
3
8
  2013-11-25 1.4.2
4
9
 
5
10
  * fixed const_get calls with ruby 1.9.3
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ gem 'rubysl', platform: :rbx
3
4
  gem 'json', '>= 1.5.1'
4
5
  gem 'algoliasearch', '>= 1.1.7'
5
6
 
data/Gemfile.lock CHANGED
@@ -24,7 +24,7 @@ GEM
24
24
  thread_safe (~> 0.1)
25
25
  tzinfo (~> 0.3.37)
26
26
  addressable (2.3.5)
27
- algoliasearch (1.1.7)
27
+ algoliasearch (1.1.10)
28
28
  curb
29
29
  arel (4.0.1)
30
30
  atomic (1.1.14)
@@ -35,7 +35,7 @@ GEM
35
35
  autotest-growl (0.2.16)
36
36
  backports (3.3.5)
37
37
  builder (3.1.4)
38
- coderay (1.0.9)
38
+ coderay (1.1.0)
39
39
  curb (0.8.5)
40
40
  diff-lcs (1.2.5)
41
41
  erubis (2.7.0)
@@ -47,6 +47,7 @@ GEM
47
47
  faraday_middleware (0.9.0)
48
48
  faraday (>= 0.7.4, < 0.9)
49
49
  ffi (1.9.3)
50
+ ffi2-generators (0.1.1)
50
51
  gh (0.13.0)
51
52
  addressable
52
53
  backports
@@ -78,13 +79,13 @@ GEM
78
79
  json (1.8.1)
79
80
  jwt (0.1.8)
80
81
  multi_json (>= 1.5)
81
- kaminari (0.14.1)
82
+ kaminari (0.15.0)
82
83
  actionpack (>= 3.0.0)
83
84
  activesupport (>= 3.0.0)
84
- launchy (2.3.0)
85
+ launchy (2.4.2)
85
86
  addressable (~> 2.3)
86
87
  method_source (0.8.2)
87
- mime-types (1.25)
88
+ mime-types (1.25.1)
88
89
  minitest (4.7.5)
89
90
  multi_json (1.8.2)
90
91
  multi_xml (0.5.5)
@@ -100,8 +101,8 @@ GEM
100
101
  multi_json (~> 1.0)
101
102
  multi_xml (~> 0.5)
102
103
  rack (~> 1.2)
103
- pry (0.9.12.2)
104
- coderay (~> 1.0.5)
104
+ pry (0.9.12.4)
105
+ coderay (~> 1.0)
105
106
  method_source (~> 0.8)
106
107
  slop (~> 3.4)
107
108
  pusher-client (0.4.0)
@@ -121,13 +122,215 @@ GEM
121
122
  rspec-expectations (2.14.4)
122
123
  diff-lcs (>= 1.1.3, < 2.0)
123
124
  rspec-mocks (2.14.4)
124
- slop (3.4.6)
125
+ rubysl (2.0.15)
126
+ rubysl-abbrev (~> 2.0)
127
+ rubysl-base64 (~> 2.0)
128
+ rubysl-benchmark (~> 2.0)
129
+ rubysl-bigdecimal (~> 2.0)
130
+ rubysl-cgi (~> 2.0)
131
+ rubysl-cgi-session (~> 2.0)
132
+ rubysl-cmath (~> 2.0)
133
+ rubysl-complex (~> 2.0)
134
+ rubysl-continuation (~> 2.0)
135
+ rubysl-coverage (~> 2.0)
136
+ rubysl-csv (~> 2.0)
137
+ rubysl-curses (~> 2.0)
138
+ rubysl-date (~> 2.0)
139
+ rubysl-delegate (~> 2.0)
140
+ rubysl-digest (~> 2.0)
141
+ rubysl-drb (~> 2.0)
142
+ rubysl-e2mmap (~> 2.0)
143
+ rubysl-english (~> 2.0)
144
+ rubysl-enumerator (~> 2.0)
145
+ rubysl-erb (~> 2.0)
146
+ rubysl-etc (~> 2.0)
147
+ rubysl-expect (~> 2.0)
148
+ rubysl-fcntl (~> 2.0)
149
+ rubysl-fiber (~> 2.0)
150
+ rubysl-fileutils (~> 2.0)
151
+ rubysl-find (~> 2.0)
152
+ rubysl-forwardable (~> 2.0)
153
+ rubysl-getoptlong (~> 2.0)
154
+ rubysl-gserver (~> 2.0)
155
+ rubysl-io-console (~> 2.0)
156
+ rubysl-io-nonblock (~> 2.0)
157
+ rubysl-io-wait (~> 2.0)
158
+ rubysl-ipaddr (~> 2.0)
159
+ rubysl-irb (~> 2.0)
160
+ rubysl-logger (~> 2.0)
161
+ rubysl-mathn (~> 2.0)
162
+ rubysl-matrix (~> 2.0)
163
+ rubysl-mkmf (~> 2.0)
164
+ rubysl-monitor (~> 2.0)
165
+ rubysl-mutex_m (~> 2.0)
166
+ rubysl-net-ftp (~> 2.0)
167
+ rubysl-net-http (~> 2.0)
168
+ rubysl-net-imap (~> 2.0)
169
+ rubysl-net-pop (~> 2.0)
170
+ rubysl-net-protocol (~> 2.0)
171
+ rubysl-net-smtp (~> 2.0)
172
+ rubysl-net-telnet (~> 2.0)
173
+ rubysl-nkf (~> 2.0)
174
+ rubysl-observer (~> 2.0)
175
+ rubysl-open-uri (~> 2.0)
176
+ rubysl-open3 (~> 2.0)
177
+ rubysl-openssl (~> 2.0)
178
+ rubysl-optparse (~> 2.0)
179
+ rubysl-ostruct (~> 2.0)
180
+ rubysl-pathname (~> 2.0)
181
+ rubysl-prettyprint (~> 2.0)
182
+ rubysl-prime (~> 2.0)
183
+ rubysl-profile (~> 2.0)
184
+ rubysl-profiler (~> 2.0)
185
+ rubysl-pstore (~> 2.0)
186
+ rubysl-pty (~> 2.0)
187
+ rubysl-rational (~> 2.0)
188
+ rubysl-readline (~> 2.0)
189
+ rubysl-resolv (~> 2.0)
190
+ rubysl-rexml (~> 2.0)
191
+ rubysl-rinda (~> 2.0)
192
+ rubysl-rss (~> 2.0)
193
+ rubysl-scanf (~> 2.0)
194
+ rubysl-securerandom (~> 2.0)
195
+ rubysl-set (~> 2.0)
196
+ rubysl-shellwords (~> 2.0)
197
+ rubysl-singleton (~> 2.0)
198
+ rubysl-socket (~> 2.0)
199
+ rubysl-stringio (~> 2.0)
200
+ rubysl-strscan (~> 2.0)
201
+ rubysl-sync (~> 2.0)
202
+ rubysl-syslog (~> 2.0)
203
+ rubysl-tempfile (~> 2.0)
204
+ rubysl-thread (~> 2.0)
205
+ rubysl-thwait (~> 2.0)
206
+ rubysl-time (~> 2.0)
207
+ rubysl-timeout (~> 2.0)
208
+ rubysl-tmpdir (~> 2.0)
209
+ rubysl-tsort (~> 2.0)
210
+ rubysl-un (~> 2.0)
211
+ rubysl-uri (~> 2.0)
212
+ rubysl-weakref (~> 2.0)
213
+ rubysl-webrick (~> 2.0)
214
+ rubysl-xmlrpc (~> 2.0)
215
+ rubysl-yaml (~> 2.0)
216
+ rubysl-zlib (~> 2.0)
217
+ rubysl-abbrev (2.0.4)
218
+ rubysl-base64 (2.0.0)
219
+ rubysl-benchmark (2.0.1)
220
+ rubysl-bigdecimal (2.0.2)
221
+ rubysl-cgi (2.0.1)
222
+ rubysl-cgi-session (2.0.1)
223
+ rubysl-cmath (2.0.0)
224
+ rubysl-complex (2.0.0)
225
+ rubysl-continuation (2.0.0)
226
+ rubysl-coverage (2.0.3)
227
+ rubysl-csv (2.0.2)
228
+ rubysl-english (~> 2.0)
229
+ rubysl-curses (2.0.0)
230
+ rubysl-date (2.0.6)
231
+ rubysl-delegate (2.0.1)
232
+ rubysl-digest (2.0.3)
233
+ rubysl-drb (2.0.1)
234
+ rubysl-e2mmap (2.0.0)
235
+ rubysl-english (2.0.0)
236
+ rubysl-enumerator (2.0.0)
237
+ rubysl-erb (2.0.1)
238
+ rubysl-etc (2.0.3)
239
+ ffi2-generators (~> 0.1)
240
+ rubysl-expect (2.0.0)
241
+ rubysl-fcntl (2.0.4)
242
+ ffi2-generators (~> 0.1)
243
+ rubysl-fiber (2.0.0)
244
+ rubysl-fileutils (2.0.3)
245
+ rubysl-find (2.0.1)
246
+ rubysl-forwardable (2.0.1)
247
+ rubysl-getoptlong (2.0.0)
248
+ rubysl-gserver (2.0.0)
249
+ rubysl-socket (~> 2.0)
250
+ rubysl-thread (~> 2.0)
251
+ rubysl-io-console (2.0.0)
252
+ rubysl-io-nonblock (2.0.0)
253
+ rubysl-io-wait (2.0.0)
254
+ rubysl-ipaddr (2.0.0)
255
+ rubysl-irb (2.0.4)
256
+ rubysl-e2mmap (~> 2.0)
257
+ rubysl-mathn (~> 2.0)
258
+ rubysl-readline (~> 2.0)
259
+ rubysl-thread (~> 2.0)
260
+ rubysl-logger (2.0.0)
261
+ rubysl-mathn (2.0.0)
262
+ rubysl-matrix (2.1.0)
263
+ rubysl-e2mmap (~> 2.0)
264
+ rubysl-mkmf (2.0.1)
265
+ rubysl-fileutils (~> 2.0)
266
+ rubysl-shellwords (~> 2.0)
267
+ rubysl-monitor (2.0.0)
268
+ rubysl-mutex_m (2.0.0)
269
+ rubysl-net-ftp (2.0.1)
270
+ rubysl-net-http (2.0.4)
271
+ rubysl-cgi (~> 2.0)
272
+ rubysl-erb (~> 2.0)
273
+ rubysl-singleton (~> 2.0)
274
+ rubysl-net-imap (2.0.1)
275
+ rubysl-net-pop (2.0.1)
276
+ rubysl-net-protocol (2.0.1)
277
+ rubysl-net-smtp (2.0.1)
278
+ rubysl-net-telnet (2.0.0)
279
+ rubysl-nkf (2.0.1)
280
+ rubysl-observer (2.0.0)
281
+ rubysl-open-uri (2.0.0)
282
+ rubysl-open3 (2.0.0)
283
+ rubysl-openssl (2.0.5)
284
+ rubysl-optparse (2.0.1)
285
+ rubysl-shellwords (~> 2.0)
286
+ rubysl-ostruct (2.0.4)
287
+ rubysl-pathname (2.0.0)
288
+ rubysl-prettyprint (2.0.2)
289
+ rubysl-prime (2.0.0)
290
+ rubysl-profile (2.0.0)
291
+ rubysl-profiler (2.0.1)
292
+ rubysl-pstore (2.0.0)
293
+ rubysl-pty (2.0.2)
294
+ rubysl-rational (2.0.1)
295
+ rubysl-readline (2.0.2)
296
+ rubysl-resolv (2.0.0)
297
+ rubysl-rexml (2.0.2)
298
+ rubysl-rinda (2.0.0)
299
+ rubysl-rss (2.0.0)
300
+ rubysl-scanf (2.0.0)
301
+ rubysl-securerandom (2.0.0)
302
+ rubysl-set (2.0.1)
303
+ rubysl-shellwords (2.0.0)
304
+ rubysl-singleton (2.0.0)
305
+ rubysl-socket (2.0.1)
306
+ rubysl-stringio (2.0.0)
307
+ rubysl-strscan (2.0.0)
308
+ rubysl-sync (2.0.0)
309
+ rubysl-syslog (2.0.1)
310
+ ffi2-generators (~> 0.1)
311
+ rubysl-tempfile (2.0.1)
312
+ rubysl-thread (2.0.2)
313
+ rubysl-thwait (2.0.0)
314
+ rubysl-time (2.0.3)
315
+ rubysl-timeout (2.0.0)
316
+ rubysl-tmpdir (2.0.0)
317
+ rubysl-tsort (2.0.1)
318
+ rubysl-un (2.0.0)
319
+ rubysl-fileutils (~> 2.0)
320
+ rubysl-optparse (~> 2.0)
321
+ rubysl-uri (2.0.0)
322
+ rubysl-weakref (2.0.0)
323
+ rubysl-webrick (2.0.0)
324
+ rubysl-xmlrpc (2.0.0)
325
+ rubysl-yaml (2.0.4)
326
+ rubysl-zlib (2.0.1)
327
+ slop (3.4.7)
125
328
  sqlite3 (1.3.8)
126
329
  sys-uname (0.9.2)
127
330
  ffi (>= 1.0.0)
128
331
  thread_safe (0.1.3)
129
332
  atomic
130
- travis (1.6.2)
333
+ travis (1.6.3)
131
334
  addressable (~> 2.3)
132
335
  backports
133
336
  faraday (~> 0.8.7)
@@ -159,6 +362,7 @@ DEPENDENCIES
159
362
  kaminari
160
363
  redgreen
161
364
  rspec (>= 2.5.0)
365
+ rubysl
162
366
  sqlite3
163
367
  travis
164
368
  will_paginate (>= 2.3.15)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "algoliasearch-rails"
8
- s.version = "1.4.2"
8
+ s.version = "1.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Algolia"]
12
- s.date = "2013-11-25"
12
+ s.date = "2013-11-29"
13
13
  s.description = "AlgoliaSearch integration to your favorite ORM"
14
14
  s.email = "contact@algolia.com"
15
15
  s.extra_rdoc_files = [
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  s.specification_version = 4
55
55
 
56
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<rubysl>, [">= 0"])
57
58
  s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
58
59
  s.add_runtime_dependency(%q<algoliasearch>, [">= 1.1.7"])
59
60
  s.add_development_dependency(%q<jeweler>, [">= 0"])
@@ -61,6 +62,7 @@ Gem::Specification.new do |s|
61
62
  s.add_development_dependency(%q<kaminari>, [">= 0"])
62
63
  s.add_development_dependency(%q<travis>, [">= 0"])
63
64
  else
65
+ s.add_dependency(%q<rubysl>, [">= 0"])
64
66
  s.add_dependency(%q<json>, [">= 1.5.1"])
65
67
  s.add_dependency(%q<algoliasearch>, [">= 1.1.7"])
66
68
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -69,6 +71,7 @@ Gem::Specification.new do |s|
69
71
  s.add_dependency(%q<travis>, [">= 0"])
70
72
  end
71
73
  else
74
+ s.add_dependency(%q<rubysl>, [">= 0"])
72
75
  s.add_dependency(%q<json>, [">= 1.5.1"])
73
76
  s.add_dependency(%q<algoliasearch>, [">= 1.1.7"])
74
77
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -176,7 +176,13 @@ AlgoliaSearch.prototype = {
176
176
  this.indexName = indexName;
177
177
  this.as = algoliasearch;
178
178
  this.typeAheadArgs = null;
179
- this.typeAheadPropertyName = null;
179
+ this.typeAheadValueOption = null;
180
+ },
181
+ setExtraHeader: function(key, value) {
182
+ extraHeaders.push({
183
+ key: key,
184
+ value: value
185
+ });
180
186
  },
181
187
  _sendQueriesBatch: function(params, callback) {
182
188
  this._jsonRequest({
@@ -250,6 +256,9 @@ AlgoliaSearch.prototype = {
250
256
  xmlHttp.open(opts.method, url, true);
251
257
  xmlHttp.setRequestHeader("X-Algolia-API-Key", this.apiKey);
252
258
  xmlHttp.setRequestHeader("X-Algolia-Application-Id", this.applicationID);
259
+ for (var i = 0; i < extraHeaders.length; ++i) {
260
+ xmlHttp.setRequestHeader(extraHeaders[i].key, extraHeaders[i].value);
261
+ }
253
262
  if (body != null) {
254
263
  xmlHttp.setRequestHeader("Content-type", "application/json");
255
264
  }
@@ -293,7 +302,8 @@ AlgoliaSearch.prototype = {
293
302
  applicationID: null,
294
303
  apiKey: null,
295
304
  hosts: [],
296
- cache: {}
305
+ cache: {},
306
+ extraHeaders: []
297
307
  };
298
308
 
299
309
  AlgoliaSearch.prototype.Index.prototype = {
@@ -423,10 +433,10 @@ AlgoliaSearch.prototype.Index.prototype = {
423
433
  this._search(params, callback);
424
434
  }
425
435
  },
426
- getTypeaheadTransport: function(args, propertyName) {
436
+ getTypeaheadTransport: function(args, valueOption) {
427
437
  this.typeAheadArgs = args;
428
- if (typeof propertyName !== "undefined") {
429
- this.typeAheadPropertyName = propertyName;
438
+ if (typeof valueOption !== "undefined") {
439
+ this.typeAheadValueOption = valueOption;
430
440
  }
431
441
  return this;
432
442
  },
@@ -435,12 +445,18 @@ AlgoliaSearch.prototype.Index.prototype = {
435
445
  this.search(query, function(success, content) {
436
446
  if (success) {
437
447
  for (var i = 0; i < content.hits.length; ++i) {
438
- var obj = content.hits[i];
448
+ var obj = content.hits[i], found = false;
439
449
  if (typeof obj.value === "undefined") {
440
- if (self.typeAheadPropertyName != null && typeof obj[self.typeAheadPropertyName] !== "undefined") {
441
- obj.value = obj[self.typeAheadPropertyName];
442
- } else {
443
- var found = false;
450
+ if (self.typeAheadValueOption != null) {
451
+ if (typeof self.typeAheadValueOption === "function") {
452
+ obj.value = self.typeAheadValueOption(obj);
453
+ found = true;
454
+ } else if (typeof obj[self.typeAheadValueOption] !== "undefined") {
455
+ obj.value = obj[self.typeAheadValueOption];
456
+ found = true;
457
+ }
458
+ }
459
+ if (!found) {
444
460
  for (var propertyName in obj) {
445
461
  if (!found && obj.hasOwnProperty(propertyName) && typeof obj[propertyName] === "string") {
446
462
  obj.value = obj[propertyName];
@@ -563,6 +579,6 @@ AlgoliaSearch.prototype.Index.prototype = {
563
579
  indexName: null,
564
580
  cache: {},
565
581
  typeAheadArgs: null,
566
- typeAheadPropertyName: null,
582
+ typeAheadValueOption: null,
567
583
  emptyConstructor: function() {}
568
584
  };
@@ -4,4 +4,4 @@
4
4
  * Copyright 2013 Algolia SAS; Licensed MIT
5
5
  */
6
6
 
7
- var VERSION="2.3.2",AlgoliaSearch=function(a,b,c,d,e){this.applicationID=a,this.apiKey=b,this._isUndefined(e)&&(e=[a+"-1.algolia.io",a+"-2.algolia.io",a+"-3.algolia.io"]),this.hosts=[];for(var f=0;f<e.length;++f)Math.random()>.5&&this.hosts.reverse(),this._isUndefined(c)||null==c?this.hosts.push(("https:"==document.location.protocol?"https":"http")+"://"+e[f]):"https"===c||"HTTPS"===c?this.hosts.push("https://"+e[f]):this.hosts.push("http://"+e[f]);Math.random()>.5&&this.hosts.reverse(),(this._isUndefined(d)||d)&&this._jsonRequest({method:"GET",url:"/1/isalive"})};AlgoliaSearch.prototype={deleteIndex:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),callback:b})},moveIndex:function(a,b,c){var d={operation:"move",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},copyIndex:function(a,b,c){var d={operation:"copy",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},getLogs:function(a,b,c){this._isUndefined(b)&&(b=0),this._isUndefined(c)&&(c=10),this._jsonRequest({method:"GET",url:"/1/logs?offset="+b+"&length="+c,callback:a})},listIndexes:function(a){this._jsonRequest({method:"GET",url:"/1/indexes/",callback:a})},initIndex:function(a){return new this.Index(this,a)},listUserKeys:function(a){this._jsonRequest({method:"GET",url:"/1/keys",callback:a})},getUserKeyACL:function(a,b){this._jsonRequest({method:"GET",url:"/1/keys/"+a,callback:b})},deleteUserKey:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/keys/"+a,callback:b})},addUserKey:function(a,b){var c={};c.acl=a,this._jsonRequest({method:"POST",url:"/1/keys",body:c,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this._jsonRequest({method:"POST",url:"/1/indexes/"+f.indexName+"/keys",body:g,callback:e})},startQueriesBatch:function(){this.batch=[]},addQueryInBatch:function(a,b,c){var d="query="+b;this._isUndefined(c)||null==c||(d=this._getSearchParams(c,d)),this.batch.push({indexName:a,params:d})},clearCache:function(){this.cache={}},sendQueriesBatch:function(a,b){for(var c=this,d={requests:[],apiKey:this.apiKey,appID:this.applicationID},e=0;e<c.batch.length;++e)d.requests.push(c.batch[e]);if(window.clearTimeout(c.onDelayTrigger),!this._isUndefined(b)&&null!=b&&b>0){var f=window.setTimeout(function(){c._sendQueriesBatch(d,a)},b);c.onDelayTrigger=f}else this._sendQueriesBatch(d,a)},Index:function(a,b){this.indexName=b,this.as=a,this.typeAheadArgs=null,this.typeAheadPropertyName=null},_sendQueriesBatch:function(a,b){this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:b})},_jsonRequest:function(a){var b=this,c=a.callback,d=null,e=a.url;if(this._isUndefined(a.body)||(e=a.url+"_body_"+JSON.stringify(a.body)),!this._isUndefined(a.cache)&&(d=a.cache,!this._isUndefined(d[e])))return this._isUndefined(c)||c(!0,d[e]),void 0;var f=function(g){var h=0;return b._isUndefined(g)||(h=g),b.hosts.length<=h?(b._isUndefined(c)||c(!1,{message:"Cannot contact server"}),void 0):(a.callback=function(g,i,j,k){i||b._isUndefined(k)||console.log("Error: "+k.message),i&&!b._isUndefined(a.cache)&&(d[e]=k),!i&&g&&h+1<b.hosts.length?f(h+1):b._isUndefined(c)||c(i,k)},a.hostname=b.hosts[h],b._jsonRequestByHost(a),void 0)};f()},_jsonRequestByHost:function(a){var b=null,c=this;this._isUndefined(a.body)||(b=JSON.stringify(a.body));var d=a.hostname+a.url,e=null;e=new XMLHttpRequest,"withCredentials"in e?(e.open(a.method,d,!0),e.setRequestHeader("X-Algolia-API-Key",this.apiKey),e.setRequestHeader("X-Algolia-Application-Id",this.applicationID),null!=b&&e.setRequestHeader("Content-type","application/json")):"undefined"!=typeof XDomainRequest?(e=new XDomainRequest,e.open(a.method,d)):console.log("your browser is too old to support CORS requests"),e.send(b),e.onload=function(b){if(c._isUndefined(b))a.callback(!1,!0,b,JSON.parse(e.responseText));else{var d=0===b.target.status||503===b.target.status,f=200===b.target.status||201===b.target.status;a.callback(d,f,b.target,null!=b.target.response?JSON.parse(b.target.response):null)}},e.onerror=function(){a.callback(!0,!1,null,{message:"Could not connect to Host"})}},_getSearchParams:function(a,b){if(this._isUndefined(a)||null==a)return b;for(var c in a)null!=c&&a.hasOwnProperty(c)&&(b+=0===b.length?"?":"&",b+=c+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[c])?JSON.stringify(a[c]):a[c]));return b},_isUndefined:function(a){return void 0===a},applicationID:null,apiKey:null,hosts:[],cache:{}},AlgoliaSearch.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,b,c){var d=this;this.as._isUndefined(c)?this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(d.indexName),body:a,callback:b}):this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(c),body:a,callback:b})},addObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"addObject",body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},getObject:function(a,b,c){var d=this,e="";if(!this.as._isUndefined(c)){e="?attributes=";for(var f=0;f<c.length;++f)0!==f&&(e+=","),e+=c[f]}this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(a)+e,callback:b})},partialUpdateObject:function(a,b){var c=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID)+"/partial",body:a,callback:b})},saveObject:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID),body:a,callback:b})},saveObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"updateObject",objectID:encodeURIComponent(a[e].objectID),body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},deleteObject:function(a,b){if(null==a||0===a.length)return b(!1,{message:"empty objectID"}),void 0;var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a),callback:b})},search:function(a,b,c,d){var e=this,f="query="+encodeURIComponent(a);if(this.as._isUndefined(c)||null==c||(f=this.as._getSearchParams(c,f)),window.clearTimeout(e.onDelayTrigger),!this.as._isUndefined(d)&&null!=d&&d>0){var g=window.setTimeout(function(){e._search(f,b)},d);e.onDelayTrigger=g}else this._search(f,b)},getTypeaheadTransport:function(a,b){return this.typeAheadArgs=a,"undefined"!=typeof b&&(this.typeAheadPropertyName=b),this},get:function(a,b,c,d,e){return self=this,this.search(a,function(a,b){if(a){for(var f=0;f<b.hits.length;++f){var g=b.hits[f];if("undefined"==typeof g.value)if(null!=self.typeAheadPropertyName&&"undefined"!=typeof g[self.typeAheadPropertyName])g.value=g[self.typeAheadPropertyName];else{var h=!1;for(var i in g)!h&&g.hasOwnProperty(i)&&"string"==typeof g[i]&&(g.value=g[i],h=!0)}e.push(c._transformDatum(g))}d&&d(e)}},self.typeAheadArgs),!0},waitTask:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/task/"+a,callback:function(d,e){if(d&&"published"===e.status)b(!0,e);else{if(d&&e.pendingTask)return c.waitTask(a,b);b(!1,e)}}})},clearIndex:function(a){var b=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/clear",callback:a})},getSettings:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/settings",callback:a})},setSettings:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/settings",body:a,callback:b})},listUserKeys:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/keys",callback:a})},getUserKeyACL:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},deleteUserKey:function(a,b){var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},addUserKey:function(a,b){var c=this,d={};d.acl=a,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys",body:d,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(f.indexName)+"/keys",body:g,callback:e})},_search:function(a,b){this.as._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:a,apiKey:this.as.apiKey,appID:this.as.applicationID},callback:b})},as:null,indexName:null,cache:{},typeAheadArgs:null,typeAheadPropertyName:null,emptyConstructor:function(){}};
7
+ var VERSION="2.3.2",AlgoliaSearch=function(a,b,c,d,e){this.applicationID=a,this.apiKey=b,this._isUndefined(e)&&(e=[a+"-1.algolia.io",a+"-2.algolia.io",a+"-3.algolia.io"]),this.hosts=[];for(var f=0;f<e.length;++f)Math.random()>.5&&this.hosts.reverse(),this._isUndefined(c)||null==c?this.hosts.push(("https:"==document.location.protocol?"https":"http")+"://"+e[f]):"https"===c||"HTTPS"===c?this.hosts.push("https://"+e[f]):this.hosts.push("http://"+e[f]);Math.random()>.5&&this.hosts.reverse(),(this._isUndefined(d)||d)&&this._jsonRequest({method:"GET",url:"/1/isalive"})};AlgoliaSearch.prototype={deleteIndex:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),callback:b})},moveIndex:function(a,b,c){var d={operation:"move",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},copyIndex:function(a,b,c){var d={operation:"copy",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},getLogs:function(a,b,c){this._isUndefined(b)&&(b=0),this._isUndefined(c)&&(c=10),this._jsonRequest({method:"GET",url:"/1/logs?offset="+b+"&length="+c,callback:a})},listIndexes:function(a){this._jsonRequest({method:"GET",url:"/1/indexes/",callback:a})},initIndex:function(a){return new this.Index(this,a)},listUserKeys:function(a){this._jsonRequest({method:"GET",url:"/1/keys",callback:a})},getUserKeyACL:function(a,b){this._jsonRequest({method:"GET",url:"/1/keys/"+a,callback:b})},deleteUserKey:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/keys/"+a,callback:b})},addUserKey:function(a,b){var c={};c.acl=a,this._jsonRequest({method:"POST",url:"/1/keys",body:c,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this._jsonRequest({method:"POST",url:"/1/indexes/"+f.indexName+"/keys",body:g,callback:e})},startQueriesBatch:function(){this.batch=[]},addQueryInBatch:function(a,b,c){var d="query="+b;this._isUndefined(c)||null==c||(d=this._getSearchParams(c,d)),this.batch.push({indexName:a,params:d})},clearCache:function(){this.cache={}},sendQueriesBatch:function(a,b){for(var c=this,d={requests:[],apiKey:this.apiKey,appID:this.applicationID},e=0;e<c.batch.length;++e)d.requests.push(c.batch[e]);if(window.clearTimeout(c.onDelayTrigger),!this._isUndefined(b)&&null!=b&&b>0){var f=window.setTimeout(function(){c._sendQueriesBatch(d,a)},b);c.onDelayTrigger=f}else this._sendQueriesBatch(d,a)},Index:function(a,b){this.indexName=b,this.as=a,this.typeAheadArgs=null,this.typeAheadValueOption=null},setExtraHeader:function(a,b){extraHeaders.push({key:a,value:b})},_sendQueriesBatch:function(a,b){this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:b})},_jsonRequest:function(a){var b=this,c=a.callback,d=null,e=a.url;if(this._isUndefined(a.body)||(e=a.url+"_body_"+JSON.stringify(a.body)),!this._isUndefined(a.cache)&&(d=a.cache,!this._isUndefined(d[e])))return this._isUndefined(c)||c(!0,d[e]),void 0;var f=function(g){var h=0;return b._isUndefined(g)||(h=g),b.hosts.length<=h?(b._isUndefined(c)||c(!1,{message:"Cannot contact server"}),void 0):(a.callback=function(g,i,j,k){i||b._isUndefined(k)||console.log("Error: "+k.message),i&&!b._isUndefined(a.cache)&&(d[e]=k),!i&&g&&h+1<b.hosts.length?f(h+1):b._isUndefined(c)||c(i,k)},a.hostname=b.hosts[h],b._jsonRequestByHost(a),void 0)};f()},_jsonRequestByHost:function(a){var b=null,c=this;this._isUndefined(a.body)||(b=JSON.stringify(a.body));var d=a.hostname+a.url,e=null;if(e=new XMLHttpRequest,"withCredentials"in e){e.open(a.method,d,!0),e.setRequestHeader("X-Algolia-API-Key",this.apiKey),e.setRequestHeader("X-Algolia-Application-Id",this.applicationID);for(var f=0;f<extraHeaders.length;++f)e.setRequestHeader(extraHeaders[f].key,extraHeaders[f].value);null!=b&&e.setRequestHeader("Content-type","application/json")}else"undefined"!=typeof XDomainRequest?(e=new XDomainRequest,e.open(a.method,d)):console.log("your browser is too old to support CORS requests");e.send(b),e.onload=function(b){if(c._isUndefined(b))a.callback(!1,!0,b,JSON.parse(e.responseText));else{var d=0===b.target.status||503===b.target.status,f=200===b.target.status||201===b.target.status;a.callback(d,f,b.target,null!=b.target.response?JSON.parse(b.target.response):null)}},e.onerror=function(){a.callback(!0,!1,null,{message:"Could not connect to Host"})}},_getSearchParams:function(a,b){if(this._isUndefined(a)||null==a)return b;for(var c in a)null!=c&&a.hasOwnProperty(c)&&(b+=0===b.length?"?":"&",b+=c+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[c])?JSON.stringify(a[c]):a[c]));return b},_isUndefined:function(a){return void 0===a},applicationID:null,apiKey:null,hosts:[],cache:{},extraHeaders:[]},AlgoliaSearch.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,b,c){var d=this;this.as._isUndefined(c)?this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(d.indexName),body:a,callback:b}):this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(c),body:a,callback:b})},addObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"addObject",body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},getObject:function(a,b,c){var d=this,e="";if(!this.as._isUndefined(c)){e="?attributes=";for(var f=0;f<c.length;++f)0!==f&&(e+=","),e+=c[f]}this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(a)+e,callback:b})},partialUpdateObject:function(a,b){var c=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID)+"/partial",body:a,callback:b})},saveObject:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID),body:a,callback:b})},saveObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"updateObject",objectID:encodeURIComponent(a[e].objectID),body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},deleteObject:function(a,b){if(null==a||0===a.length)return b(!1,{message:"empty objectID"}),void 0;var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a),callback:b})},search:function(a,b,c,d){var e=this,f="query="+encodeURIComponent(a);if(this.as._isUndefined(c)||null==c||(f=this.as._getSearchParams(c,f)),window.clearTimeout(e.onDelayTrigger),!this.as._isUndefined(d)&&null!=d&&d>0){var g=window.setTimeout(function(){e._search(f,b)},d);e.onDelayTrigger=g}else this._search(f,b)},getTypeaheadTransport:function(a,b){return this.typeAheadArgs=a,"undefined"!=typeof b&&(this.typeAheadValueOption=b),this},get:function(a,b,c,d,e){return self=this,this.search(a,function(a,b){if(a){for(var f=0;f<b.hits.length;++f){var g=b.hits[f],h=!1;if("undefined"==typeof g.value&&(null!=self.typeAheadValueOption&&("function"==typeof self.typeAheadValueOption?(g.value=self.typeAheadValueOption(g),h=!0):"undefined"!=typeof g[self.typeAheadValueOption]&&(g.value=g[self.typeAheadValueOption],h=!0)),!h))for(var i in g)!h&&g.hasOwnProperty(i)&&"string"==typeof g[i]&&(g.value=g[i],h=!0);e.push(c._transformDatum(g))}d&&d(e)}},self.typeAheadArgs),!0},waitTask:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/task/"+a,callback:function(d,e){if(d&&"published"===e.status)b(!0,e);else{if(d&&e.pendingTask)return c.waitTask(a,b);b(!1,e)}}})},clearIndex:function(a){var b=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/clear",callback:a})},getSettings:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/settings",callback:a})},setSettings:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/settings",body:a,callback:b})},listUserKeys:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/keys",callback:a})},getUserKeyACL:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},deleteUserKey:function(a,b){var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},addUserKey:function(a,b){var c=this,d={};d.acl=a,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys",body:d,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(f.indexName)+"/keys",body:g,callback:e})},_search:function(a,b){this.as._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:a,apiKey:this.as.apiKey,appID:this.as.applicationID},callback:b})},as:null,indexName:null,cache:{},typeAheadArgs:null,typeAheadValueOption:null,emptyConstructor:function(){}};
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubysl
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: json
15
29
  requirement: !ruby/object:Gem::Requirement