Sha256: 8c442ba9754b44204460b1c5d2dda767d97561b53522337f6203fec3196f0973
Contents?: true
Size: 855 Bytes
Versions: 2
Compression:
Stored size: 855 Bytes
Contents
require "httparty" require "active_support/core_ext/object/to_json" module ActiveSearch module Algolia class Client include HTTParty def self.configure(api_key, app_id, index = "activesearch") base_uri "https://#{app_id}.algolia.io/1/indexes/#{index}" headers({ "X-Algolia-API-Key" => api_key, "X-Algolia-Application-Id" => app_id, "Content-Type" => "application/json; charset=utf-8" }) end def delete_index self.class.delete("") end def delete(id) return false if id.nil? self.class.delete("/#{id}") end def save(id, object) self.class.put("/#{id}", body: object.to_json) end def query(text, extras = {}) self.class.get("", query: extras.merge!(query: text)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activesearch-0.1.3 | lib/activesearch/algolia/client.rb |
activesearch-0.1.2 | lib/activesearch/algolia/client.rb |