Sha256: 8e57483ced0716ecc6dc75ed656847ddf3bc53ec8281edf415a9cad4e260bafc
Contents?: true
Size: 853 Bytes
Versions: 4
Compression:
Stored size: 853 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://apieu1.algolia.com/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
4 entries across 4 versions & 1 rubygems