Class: SearchKit::Search
- Inherits:
-
Object
- Object
- SearchKit::Search
- Defined in:
- lib/search_kit/search.rb,
lib/search_kit/search/cli.rb,
lib/search_kit/search/cli/actions.rb
Defined Under Namespace
Classes: CLI
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize ⇒ Search
constructor
A new instance of Search.
- #search(slug, options) ⇒ Object
Constructor Details
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
9 10 11 |
# File 'lib/search_kit/search.rb', line 9 def connection @connection end |
Instance Method Details
#search(slug, options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/search_kit/search.rb', line 16 def search(slug, ) params = { data: { type: "searches", attributes: } } 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 |