Class: HttpReactor::Request
- Inherits:
-
Object
- Object
- HttpReactor::Request
- Defined in:
- lib/http_reactor/request.rb
Overview
A class that represents an HTTP request.
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #headers ⇒ Object
-
#initialize(uri, method = 'GET', payload = nil, extra = {}) ⇒ Request
constructor
Initialize the request object.
Constructor Details
#initialize(uri, method = 'GET', payload = nil, extra = {}) ⇒ Request
Initialize the request object.
9 10 11 12 13 14 |
# File 'lib/http_reactor/request.rb', line 9 def initialize(uri, method='GET', payload=nil, extra={}) @uri = uri @method = method @payload = payload @extra = extra end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
6 7 8 |
# File 'lib/http_reactor/request.rb', line 6 def extra @extra end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
5 6 7 |
# File 'lib/http_reactor/request.rb', line 5 def method @method end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
5 6 7 |
# File 'lib/http_reactor/request.rb', line 5 def payload @payload end |
#uri ⇒ Object
Returns the value of attribute uri.
4 5 6 |
# File 'lib/http_reactor/request.rb', line 4 def uri @uri end |
Instance Method Details
#[](name) ⇒ Object
16 17 18 |
# File 'lib/http_reactor/request.rb', line 16 def [](name) headers[name] end |
#[]=(name, value) ⇒ Object
20 21 22 |
# File 'lib/http_reactor/request.rb', line 20 def []=(name, value) headers[name] = value end |
#headers ⇒ Object
24 25 26 |
# File 'lib/http_reactor/request.rb', line 24 def headers @headers ||= Hash.new end |