Class: WebSystem::RequestCommand
- Inherits:
-
DevSystem::SimpleCommand
- Object
- Liza::Unit
- Liza::Controller
- DevSystem::Command
- DevSystem::BaseCommand
- DevSystem::SimpleCommand
- WebSystem::RequestCommand
- Defined in:
- lib/web_system/subsystems/request/commands/request_command.rb
Instance Attribute Summary
Attributes inherited from Liza::Controller
Class Method Summary collapse
-
.call_get_command_sign ⇒ Object
TODO: fix this.
Instance Method Summary collapse
- #call_default ⇒ Object
- #call_get ⇒ Object
- #call_post ⇒ Object
- #help ⇒ Object
-
#request_panel ⇒ Object
helpers.
Methods inherited from DevSystem::SimpleCommand
#after, #ask?, #before, #default_args, #default_booleans, #default_strings, #given_args, #given_booleans, #given_strings, #input_args, #input_booleans, #input_strings, #set_arg, #set_boolean, #set_default_arg, #set_default_array, #set_default_boolean, #set_default_string, #set_input_arg, #set_input_array, #set_input_boolean, #set_input_string, #set_string, #simple_arg, #simple_arg_ask, #simple_arg_ask_snakecase, #simple_args, #simple_args_from_2, #simple_array, #simple_boolean, #simple_boolean_yes, #simple_booleans, #simple_color, #simple_controller_placement, #simple_string, #simple_strings
Methods inherited from DevSystem::BaseCommand
#action_method_name, #action_name, #after, #around, #before, #call, call, #env, get_command_signatures, #not_found, typo, #typo
Methods inherited from DevSystem::Command
Methods inherited from Liza::Controller
#`, `, attr_accessor, attr_reader, attr_writer, #attrs, box, #box, call, color, division, division!, division?, inherited, menv_accessor, menv_reader, menv_writer, on_connected, panel, #panel, plural, require, requirements, sh, #sh, singular, subsystem, subsystem!, subsystem?, subsystem_token, token
Methods inherited from Liza::Unit
_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff
Class Method Details
.call_get_command_sign ⇒ Object
TODO: fix this
62 63 64 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 62 def self.call_get_command_sign super << {name: "get", description: "# no description"} end |
Instance Method Details
#call_default ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 3 def call_default log "args = #{args.inspect}" path, qs = args.first.split("?") help # always show help @request_env = {} @request_env["PATH_INFO"] = path @request_env["QUERY_STRING"] = qs request_panel.find @request_env @request_class = @request_env["LIZA_REQUEST_CLASS"] || raise("No request class found") puts render :find, format: :txt end |
#call_get ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 23 def call_get return superclass.method(__method__).call(args) unless args.is_a? Array log "args = #{args.inspect}" path, qs = args.first.split("?") return help if path.nil? @request_env = {} @request_env["REQUEST_METHOD"] = "GET" @request_env["PATH_INFO"] = path @request_env["QUERY_STRING"] = qs @status, @headers, @body = request_panel.call! @request_env log "STATUS #{@status} with #{@headers.count} headers and a #{@body.first.size} byte body" puts render :response, format: :http end |
#call_post ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 39 def call_post return superclass.method(__method__).call(args) unless args.is_a? Array log "args = #{args.inspect}" path, qs = args.first.split("?") return help if path.nil? @request_env = {} @request_env["REQUEST_METHOD"] = "POST" @request_env["PATH_INFO"] = path @request_env["QUERY_STRING"] = qs @status, @headers, @body = request_panel.call! @request_env log "STATUS #{@status} with #{@headers.count} headers and a #{@body.first.size} byte body" puts render :response, format: :http end |
#help ⇒ Object
18 19 20 21 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 18 def help log "args = #{args.inspect}" puts render :help, format: :txt end |
#request_panel ⇒ Object
helpers
57 58 59 |
# File 'lib/web_system/subsystems/request/commands/request_command.rb', line 57 def request_panel @request_panel ||= WebBox[:request] end |