Class: HttpEventLogger::Event::Request
- Inherits:
-
Object
- Object
- HttpEventLogger::Event::Request
- Defined in:
- lib/http_event_logger/event/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #base_uri ⇒ Object
-
#initialize(args) ⇒ Request
constructor
A new instance of Request.
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/http_event_logger/event/request.rb', line 6 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/http_event_logger/event/request.rb', line 6 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/http_event_logger/event/request.rb', line 6 def method @method end |
#uri ⇒ Object (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_uri ⇒ Object
16 17 18 19 |
# File 'lib/http_event_logger/event/request.rb', line 16 def base_uri matcher = @uri.match(/\/\/([^\/\?]*)/) matcher ? matcher[1] : "" end |