Class: HttpEventLogger::Event::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/http_event_logger/event/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Request

Returns a new instance of Request.


8
9
10
11
12
13
14
# File 'lib/http_event_logger/event/request.rb', line 8

def initialize(args)
  @method  = args[:method].to_s.upcase
  @uri     = args[:uri].to_s
  @headers = HttpEventLogger::Event::Headers.new(args[:headers])
  @body    = args[:body]
  HttpEventLogger::Event::Observer.observe(:sent, self)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body


6
7
8
# File 'lib/http_event_logger/event/request.rb', line 6

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers


6
7
8
# File 'lib/http_event_logger/event/request.rb', line 6

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method


6
7
8
# File 'lib/http_event_logger/event/request.rb', line 6

def method
  @method
end

#uriObject (readonly)

Returns the value of attribute uri


6
7
8
# File 'lib/http_event_logger/event/request.rb', line 6

def uri
  @uri
end

Instance Method Details

#base_uriObject


16
17
18
19
# File 'lib/http_event_logger/event/request.rb', line 16

def base_uri
  matcher = @uri.match(/\/\/([^\/\?]*)/)
  matcher ? matcher[1] : ""
end