Class: Radar::DataExtensions::Rails2

Inherits:
Object
  • Object
show all
Includes:
RequestHelper
Defined in:
lib/radar/data_extensions/rails2.rb

Overview

Takes a :rails2_request from the ExceptionEvent extra data which is added by the rails 2 integrator and extracts it into the data hash.

This data extension is automatically enabled by the Rails 2 integrator.

Instance Method Summary collapse

Methods included from RequestHelper

#extract_http_headers

Constructor Details

#initialize(event) ⇒ Rails2

Returns a new instance of Rails2.



12
13
14
# File 'lib/radar/data_extensions/rails2.rb', line 12

def initialize(event)
  @event = event
end

Instance Method Details

#to_hashObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/radar/data_extensions/rails2.rb', line 16

def to_hash
  request = @event.extra[:rails2_request]
  return if !request

  { :request => {
      :request_method => request.request_method.to_s,
      :url => request.url.to_s,
      :parameters => request.parameters,
      :remote_ip => request.remote_ip,
      :headers => extract_http_headers(request.env)
    }
  }
end