lib/search_kit/clients/documents.rb in search-kit-0.0.7 vs lib/search_kit/clients/documents.rb in search-kit-0.0.8
- old
+ new
@@ -10,14 +10,14 @@
uri = [SearchKit.config.app_uri, "documents"].join("/")
@connection = Faraday.new(uri)
@token = SearchKit.config.app_token
end
- def create(slug, options)
+ def create(slug, document)
document = {
token: token,
- data: { type: "documents", attributes: options }
+ data: { type: "documents", attributes: document }
}
response = connection.post(slug, document)
body = JSON.parse(response.body, symbolize_names: true)
@@ -47,13 +47,13 @@
fail Errors::IndexNotFound if response.status == 404
body
end
- def update(slug, id, options)
+ def update(slug, id, document)
document = {
token: token,
- data: { type: "documents", id: id, attributes: options }
+ data: { type: "documents", id: id, attributes: document }
}
response = connection.patch("#{slug}/#{id}", document)
body = JSON.parse(response.body, symbolize_names: true)