Class: Foobara::CommandConnectors::Http::Commands::GetOptions
- Inherits:
-
Foobara::Command
- Object
- Foobara::Command
- Foobara::CommandConnectors::Http::Commands::GetOptions
- Defined in:
- foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb
Overview
TODO: this is a bit of a hack, just a total no-op… shouldn’t really need this command at all ideally
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary
Attributes included from Foobara::CommandPatternImplementation::Concerns::Subcommands
Attributes included from Foobara::CommandPatternImplementation::Concerns::Runtime
Attributes included from Foobara::CommandPatternImplementation::Concerns::Errors
Attributes included from Foobara::CommandPatternImplementation::Concerns::Inputs
Instance Method Summary collapse
- #execute ⇒ Object
- #initialize_response_headers ⇒ Object
- #set_access_control_max_age ⇒ Object
- #set_allow_headers ⇒ Object
- #set_allow_methods ⇒ Object
Methods inherited from Foobara::Command
Methods included from Foobara::Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from Foobara::CommandPatternImplementation::Concerns::Reflection
Methods included from Foobara::CommandPatternImplementation::Concerns::DomainMappers
#domain_map, #domain_map!, #run_mapped_subcommand!
Methods included from Foobara::CommandPatternImplementation::Concerns::Subcommands
#run_subcommand!, #subcommand?
Methods included from Foobara::CommandPatternImplementation::Concerns::Entities
Methods included from Foobara::CommandPatternImplementation::Concerns::Transactions
#auto_detect_current_transactions, #commit_transaction, #open_transaction, #opened_transactions, #relevant_entity_classes, #rollback_transaction, #transactions
Methods included from Foobara::CommandPatternImplementation::Concerns::StateMachine
Methods included from Foobara::CommandPatternImplementation::Concerns::Runtime
#halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records
Methods included from Foobara::CommandPatternImplementation::Concerns::Errors
Methods included from Foobara::CommandPatternImplementation::Concerns::Inputs
#cast_and_validate_inputs, #initialize, #method_missing, #respond_to_missing?, #respond_to_missing_for_inputs?
Methods included from TruncatedInspect
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb', line 12 def execute initialize_response_headers set_allow_methods set_allow_headers set_access_control_max_age # TODO: what's with this empty string? "" end |
#initialize_response_headers ⇒ Object
23 24 25 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb', line 23 def initialize_response_headers request.response_headers ||= {} end |
#set_access_control_max_age ⇒ Object
44 45 46 47 48 49 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb', line 44 def set_access_control_max_age access_control_max_age = ENV.fetch("FOOBARA_HTTP_RESPONSE_HEADER_ACCESS_CONTROL_MAX_AGE", nil) if access_control_max_age request.response_headers["access-control-max-age"] = access_control_max_age end end |
#set_allow_headers ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb', line 34 def set_allow_headers allow_headers = ENV.fetch("FOOBARA_HTTP_RESPONSE_HEADER_ACCESS_CONTROL_ALLOW_HEADERS", nil) if allow_headers if allow_headers == "*" allow_headers = request.headers["access-control-request-headers"] end request.response_headers["access-control-allow-headers"] = allow_headers end end |
#set_allow_methods ⇒ Object
27 28 29 30 31 32 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/get_options.rb', line 27 def set_allow_methods allow_methods = ENV.fetch("FOOBARA_HTTP_RESPONSE_HEADER_ACCESS_CONTROL_ALLOW_METHODS", nil) if allow_methods request.response_headers["access-control-allow-methods"] = allow_methods end end |