Class: Foobara::CommandConnectors::Http::Rack
- Inherits:
-
Foobara::CommandConnectors::Http
- Object
- Foobara::CommandConnector
- Foobara::CommandConnectors::Http
- Foobara::CommandConnectors::Http::Rack
- Defined in:
- foobara-rack-connector-0.1.0/lib/foobara/command_connectors/http/rack.rb,
foobara-rack-connector-0.1.0/lib/foobara/command_connectors/http/puma_runner.rb,
foobara-rack-connector-0.1.0/lib/foobara/command_connectors/http/rack/request.rb
Defined Under Namespace
Classes: Request
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary
Attributes inherited from Foobara::CommandConnectors::Http
Attributes inherited from Foobara::CommandConnector
#authenticator, #capture_unknown_error, #command_registry, #name
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#run_puma ⇒ Object
Just a convenience method for demos.
Methods inherited from Foobara::CommandConnectors::Http
#headers_for, #initialize, #mutate_response, #request_to_command_class, #request_to_command_inputs, #run, #set_response_status
Methods included from TruncatedInspect
Methods inherited from Foobara::CommandConnector
#all_exposed_command_names, #all_exposed_commands, allowed_rules_to_register, authenticator_registry, #command_connected?, #connect, find_builtin_command_class, #find_builtin_command_class, #initialize, #lookup_command, register_allowed_rule, register_authenticator, #run, to_authenticator, #type_from_name
Constructor Details
This class inherits a constructor from Foobara::CommandConnectors::Http
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/foobara/command_connectors/http/rack.rb', line 5 def call(env) response = run(env) [response.status, response.headers, [response.body]] rescue NotFoundError, InvalidContextError => e [404, {}, [e.]] rescue => e # :nocov: env["rack.errors"].puts e.to_s env["rack.errors"].puts e.backtrace raise e # :nocov: end |
#run_puma ⇒ Object
Just a convenience method for demos. In real projects use rackup/config.ru or set it all up with ‘foob g rack-connector`
7 8 9 10 11 12 13 14 |
# File 'lib/foobara/command_connectors/http/puma_runner.rb', line 7 def run_puma(**) # :nocov: require "puma" require "rack/handler/puma" ::Rack::Handler::Puma.run(self, **) # :nocov: end |