activesearch 0.0.14 → 0.0.15
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 +8 -8
- data/lib/activesearch/algolia/client.rb +26 -24
- data/lib/activesearch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGUxNThlNTAxNjhmY2YxNDU1NTdhNjA3OTBkMjExMWE2YzI1NjVhZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjRlM2NkNGU2MDRhODhiNmM2MmQ5NTkwNzY5YTRiZjIwZTNmY2QyZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWU2MzI4ZTQ4NTU0MjE0OTA1NGE4ZDY3NDE4OTViYmZkNjhhNmEyZTlhYWUy
|
10
|
+
NDJkYjczMmUxNmU4MzlkYjdjNzFmYTZmZjY0YmRjMWZjYjc4NTc5YzBiZjU0
|
11
|
+
ZDgyZWZiNGExYWU2YmMzMTFmZTE0YzgyODQ3NjQwZDFhMGZkOTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjQ2NDZlZmJjZDViYmNlZDI1ZDgyOTJiOWRlMGNlODI5ZDQ1YjQ3YzFjOWI5
|
14
|
+
YmRkNDg5ZTJlM2YzNmMyMjVlN2VlOTFiYjYwMWM1MTNjNjQ4MDBhOTVjYzFj
|
15
|
+
Y2JlYjI3N2M3YWY5YjRiN2VhNzg0NGZhODFhMDZmMzc0YWY4Yjg=
|
@@ -1,34 +1,36 @@
|
|
1
1
|
require "httparty"
|
2
2
|
require "active_support/core_ext/object/to_json"
|
3
3
|
|
4
|
-
module ActiveSearch
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
module ActiveSearch
|
5
|
+
module Algolia
|
6
|
+
class Client
|
7
|
+
include HTTParty
|
8
|
+
|
9
|
+
def self.configure(api_key, app_id, index = "activesearch")
|
10
|
+
base_uri "https://apieu1.algolia.com/1/indexes/#{index}"
|
11
|
+
headers({
|
12
|
+
"X-Algolia-API-Key" => api_key,
|
13
|
+
"X-Algolia-Application-Id" => app_id,
|
14
|
+
"Content-Type" => "application/json; charset=utf-8"
|
15
|
+
})
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def delete_index
|
19
|
+
self.class.delete("")
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
def delete(id)
|
23
|
+
return false if id.nil?
|
24
|
+
self.class.delete("/#{id}")
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
def save(id, object)
|
28
|
+
self.class.put("/#{id}", body: object.to_json)
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
def query(text, extras = {})
|
32
|
+
self.class.get("", query: extras.merge!(query: text))
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
data/lib/activesearch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alvarez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|