Sha256: 13e8fcaa5b61faceaf6d8511bce840c9f1fcd9b02c3d7da2924382e926626d95
Contents?: true
Size: 695 Bytes
Versions: 1
Compression:
Stored size: 695 Bytes
Contents
require 'faraday' require 'json' require 'uri' module SearchKit class Search autoload :CLI, 'search_kit/search/cli' attr_reader :connection def initialize uri = [SearchKit.config.app_uri, "search"].join("/") @connection = Faraday.new(uri) end def search(slug, options) params = { data: { type: "searches", attributes: options } } response = connection.post(slug, params) body = JSON.parse(response.body, symbolize_names: true) fail Errors::BadRequest if response.status == 400 fail Errors::IndexNotFound if response.status == 404 fail Errors::Unprocessable if response.status == 422 body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search-kit-0.0.2 | lib/search_kit/search.rb |