module Swagger::Shell
Constants
- VERSION
Attributes
config_api[R]
config_pry[R]
env[R]
Public Class Methods
api()
click to toggle source
# File lib/swagger/shell.rb, line 43 def api @aip ||= DocLoader.new.load(config_env.docs_url) end
config_api=(config)
click to toggle source
# File lib/swagger/shell.rb, line 27 def config_api=(config) @config_api = hash_to_struct(config) end
config_env()
click to toggle source
# File lib/swagger/shell.rb, line 21 def config_env @config_env ||= @config_env_store[env].tap do |config| config.docs_url = File.join(config.api_url, config.docs_url) unless config.docs_url.start_with? "http" end end
config_env=(config)
click to toggle source
# File lib/swagger/shell.rb, line 17 def config_env=(config) @config_env_store = hash_to_struct(config) end
config_pry=(config)
click to toggle source
# File lib/swagger/shell.rb, line 31 def config_pry=(config) @config_pry = hash_to_struct(config).tap do |config| config.home = config.home.gsub(/^~/, Dir.home) if config.home.start_with?("~/") config.history_path = File.join(config.home, config.history_file) config.users_path = File.join(config.home, config.users_file) end end
env=(env)
click to toggle source
# File lib/swagger/shell.rb, line 13 def env=(env) @env = env end
hash_to_struct(hash)
click to toggle source
# File lib/swagger/shell.rb, line 64 def hash_to_struct(hash) JSON.parse hash.to_json, object_class: OpenStruct end
register_interface(interface_module)
click to toggle source
# File lib/swagger/shell.rb, line 51 def register_interface(interface_module) registered_interfaces << interface_module end
registered_interfaces()
click to toggle source
# File lib/swagger/shell.rb, line 47 def registered_interfaces @registered_interfaces ||= [] end
start(main, env = nil)
click to toggle source
# File lib/swagger/shell.rb, line 55 def start(main, env = nil) self.env = env || :default main.extend Swagger::Shell::Interface registered_interfaces.each do |interface| main.extend interface end main.start_shell end
user()
click to toggle source
# File lib/swagger/shell.rb, line 39 def user @user ||= User.new end