Sha256: ae92e61a003be82ae37ee26c49b4674761166e549cc6a911643b48205eadf69b
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
require 'faraday' require 'json' require 'search_kit/thor' require 'thor' module SearchKit module CLI class Scaffolds < Thor namespace :scaffolds no_commands do def client @client ||= SearchKit::Clients::Scaffold.new end def messages @messages ||= Messages.new end end document :scaffold def create(name, json = "[]") documents = JSON.parse(json, symbolize_names: true) response = client.create(name, documents) 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 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/scaffolds.rb |