class SearchKit::CLI::Indices
Public Instance Methods
archive(slug)
click to toggle source
# File lib/search_kit/cli/indices.rb, line 22 def archive(slug) response = client.archive(slug) messages.info response.to_json rescue Errors::Unauthorized messages.unauthorized rescue Errors::IndexNotFound messages.not_found rescue Faraday::ConnectionFailed messages.no_service end
client()
click to toggle source
# File lib/search_kit/cli/indices.rb, line 12 def client @client ||= SearchKit::Clients::Indices.new end
create(name)
click to toggle source
# File lib/search_kit/cli/indices.rb, line 34 def create(name) response = client.create(name) messages.info response.to_json rescue Errors::Unauthorized messages.unauthorized rescue Errors::BadRequest messages.bad_request rescue Errors::Unprocessable messages.unprocessable rescue Faraday::ConnectionFailed messages.no_service end
messages()
click to toggle source
# File lib/search_kit/cli/indices.rb, line 16 def messages @messages ||= SearchKit::Messages.new end
show(slug)
click to toggle source
# File lib/search_kit/cli/indices.rb, line 48 def show(slug) response = client.show(slug) messages.info response.to_json rescue Errors::Unauthorized messages.unauthorized rescue Errors::IndexNotFound messages.not_found rescue Faraday::ConnectionFailed messages.no_service end
update(slug, update_json)
click to toggle source
# File lib/search_kit/cli/indices.rb, line 60 def update(slug, update_json) options = JSON.parse(update_json, symbolize_names: true) response = client.update(slug, options) messages.info response.to_json rescue Errors::Unauthorized messages.unauthorized rescue Errors::BadRequest messages.bad_request rescue Errors::IndexNotFound messages.not_found rescue Errors::Unprocessable messages.unprocessable rescue Faraday::ConnectionFailed messages.no_service rescue JSON::ParserError messages.json_parse_error end