Sha256: 99dd23e3dd83c6fe476dbd994287b2b46a6a63a0126c390aa357b9f5013dfc6d
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
require 'faraday' require 'json' require 'search_kit/thor' require 'thor' module SearchKit module CLI class Indices < Thor namespace :indices no_commands do def client @client ||= SearchKit::Clients::Indices.new end def messages @messages ||= Messages.new end end document :archive 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 document :create 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 document :show 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 document :update 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search-kit-0.0.6 | lib/search_kit/cli/indices.rb |