Class: Benchy::Request
- Inherits:
-
Object
- Object
- Benchy::Request
- Defined in:
- lib/benchy.rb
Overview
Represents an HTTP Request, but can’t actually be executed
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#em ⇒ Object
Grab an instance of an Em::Http request so we can run it somewhere.
-
#initialize(url, method, headers, body = nil) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(url, method, headers, body = nil) ⇒ Request
Returns a new instance of Request.
65 66 67 |
# File 'lib/benchy.rb', line 65 def initialize(url, method, headers, body=nil) @url, @method, @headers, @body = url, method, (headers || {}), body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
63 64 65 |
# File 'lib/benchy.rb', line 63 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
63 64 65 |
# File 'lib/benchy.rb', line 63 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
63 64 65 |
# File 'lib/benchy.rb', line 63 def method @method end |
#url ⇒ Object
Returns the value of attribute url.
63 64 65 |
# File 'lib/benchy.rb', line 63 def url @url end |
Instance Method Details
#em ⇒ Object
Grab an instance of an Em::Http request so we can run it somewhere.
70 71 72 73 74 75 76 77 |
# File 'lib/benchy.rb', line 70 def em EventMachine::HttpRequest.new(url).send(method.downcase, :head => headers, :body => body, :connect_timeout => 9000, # Disable :inactivity_timeout => 9000 # Disable ) end |