Class: RorVsWild::Execution::Request
- Inherits:
-
RorVsWild::Execution
- Object
- RorVsWild::Execution
- RorVsWild::Execution::Request
- Defined in:
- lib/rorvswild/execution.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes inherited from RorVsWild::Execution
#error, #error_context, #name, #parameters, #runtime, #section_stack, #sections
Instance Method Summary collapse
- #add_exception(exception) ⇒ Object
- #as_json(options = nil) ⇒ Object
- #headers ⇒ Object
-
#initialize(path) ⇒ Request
constructor
A new instance of Request.
Methods inherited from RorVsWild::Execution
#add_queue_time, #add_section, #merge_error_context, #stop
Constructor Details
#initialize(path) ⇒ Request
101 102 103 104 |
# File 'lib/rorvswild/execution.rb', line 101 def initialize(path) @path = path super(nil, nil) end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
99 100 101 |
# File 'lib/rorvswild/execution.rb', line 99 def controller @controller end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
97 98 99 |
# File 'lib/rorvswild/execution.rb', line 97 def path @path end |
Instance Method Details
#add_exception(exception) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/rorvswild/execution.rb', line 106 def add_exception(exception) super(exception) @error && @error.details = { parameters: controller.request.filtered_parameters, request: { headers: headers, name: "#{controller.class}##{controller.action_name}", method: controller.request.method, url: controller.request.url, } } @error end |
#as_json(options = nil) ⇒ Object
129 130 131 |
# File 'lib/rorvswild/execution.rb', line 129 def as_json( = nil) super().merge(path: @path) end |
#headers ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/rorvswild/execution.rb', line 120 def headers controller.request.filtered_env.reduce({}) do |hash, (name, value)| if name.start_with?("HTTP_") && name != "HTTP_COOKIE" hash[name.delete_prefix("HTTP_").split("_").each(&:capitalize!).join("-")] = value end hash end end |