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.1/lib/foobara/command_connectors/http/rack.rb,
foobara-rack-connector-0.1.1/lib/foobara/command_connectors/http/puma_runner.rb,
foobara-rack-connector-0.1.1/lib/foobara/command_connectors/http/rack/request.rb,
foobara-rack-connector-0.1.1/lib/foobara/command_connectors/http/rack/response.rb
Defined Under Namespace
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary
Attributes inherited from Foobara::CommandConnectors::Http
Attributes inherited from Foobara::CommandConnector
#auth_map, #authenticator, #capture_unknown_error, #command_registry, #name, #requires_allowed_rule
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
#add_default_errors_transformer, #add_default_inputs_transformer, #add_default_pre_commit_transformer, #add_default_response_mutator, #add_default_result_transformer, #add_default_serializer, #all_exposed_command_names, #all_exposed_commands, #all_transformed_command_classes, #allow, #allowed_rule, #allowed_rules, allowed_rules_to_register, always_allowed_rule, authenticator_registry, build_auth_mapper, #command, #command_connected?, #connect, #each_transformed_command_class, find_builtin_command_class, #find_builtin_command_class, #initialize, #lookup_command, register_allowed_rule, #register_allowed_rule, register_authenticator, #run, to_auth_user_mapper, to_authenticator, #transformed_command_from_name, #type_from_name
Methods included from Foobara::CommandConnector::Concerns::Reflection
#all_exposed_type_names, #foobara_manifest
Methods included from Foobara::Concern
foobara_class_methods_module_for, foobara_concern?, included
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 |