Class: Radar::DataExtensions::Rack
- Inherits:
-
Object
- Object
- Radar::DataExtensions::Rack
- Includes:
- RequestHelper
- Defined in:
- lib/radar/data_extensions/rack.rb
Overview
Data extensions which adds information about a rack request,
if it exists in the :rack_request
extra data of the ExceptionEvent.
Instance Method Summary collapse
-
#initialize(event) ⇒ Rack
constructor
A new instance of Rack.
- #to_hash ⇒ Object
Methods included from RequestHelper
Constructor Details
#initialize(event) ⇒ Rack
Returns a new instance of Rack.
10 11 12 |
# File 'lib/radar/data_extensions/rack.rb', line 10 def initialize(event) @event = event end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/radar/data_extensions/rack.rb', line 14 def to_hash result = {} request = @event.extra[:rack_request] if request Support::Hash.deep_merge!(result, { :request => { :request_method => request.request_method.to_s, :url => request.url.to_s, :parameters => request.params, :remote_ip => request.ip } }) end if @event.extra[:rack_env] Support::Hash.deep_merge!(result, :request => { :headers => extract_http_headers(@event.extra[:rack_env]) }) Support::Hash.deep_merge!(result, :request => { :rack_env => extract_rack_env(@event.extra[:rack_env]) }) end result end |