Class: EventParsers::Http11Parser::Request
- Inherits:
-
Object
- Object
- EventParsers::Http11Parser::Request
- Defined in:
- bin/httphere
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_version ⇒ Object
Returns the value of attribute http_version.
-
#method ⇒ Object
Returns the value of attribute method.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
-
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #basic_auth ⇒ Object
- #has_entity? ⇒ Boolean
-
#initialize(request_params = {}) ⇒ Request
constructor
A new instance of Request.
- #inspect ⇒ Object
- #params ⇒ Object
- #ready! ⇒ Object
- #ready? ⇒ Boolean
Constructor Details
#initialize(request_params = {}) ⇒ Request
Returns a new instance of Request.
371 372 373 374 375 376 377 378 379 |
# File 'bin/httphere', line 371 def initialize(request_params={}) @http_version = request_params[:http_version] if request_params.has_key? :http_version @resource_uri = request_params[:resource_uri] if request_params.has_key? :resource_uri @headers = request_params[:headers] if request_params.has_key? :headers @entity = request_params[:entity] if request_params.has_key? :entity @headers ||= {} @entity ||= '' end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
363 364 365 |
# File 'bin/httphere', line 363 def connection @connection end |
#entity ⇒ Object
Returns the value of attribute entity.
363 364 365 |
# File 'bin/httphere', line 363 def entity @entity end |
#headers ⇒ Object
Returns the value of attribute headers.
363 364 365 |
# File 'bin/httphere', line 363 def headers @headers end |
#http_version ⇒ Object
Returns the value of attribute http_version.
363 364 365 |
# File 'bin/httphere', line 363 def http_version @http_version end |
#method ⇒ Object
Returns the value of attribute method.
363 364 365 |
# File 'bin/httphere', line 363 def method @method end |
#query_params ⇒ Object
Returns the value of attribute query_params.
363 364 365 |
# File 'bin/httphere', line 363 def query_params @query_params end |
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
363 364 365 |
# File 'bin/httphere', line 363 def resource_uri @resource_uri end |
#response ⇒ Object
Returns the value of attribute response.
363 364 365 |
# File 'bin/httphere', line 363 def response @response end |
Instance Method Details
#basic_auth ⇒ Object
389 390 391 |
# File 'bin/httphere', line 389 def basic_auth BasicAuth.parse(@headers['authorization']) if @headers['authorization'] end |
#has_entity? ⇒ Boolean
385 386 387 |
# File 'bin/httphere', line 385 def has_entity? @entity != '' end |
#inspect ⇒ Object
381 382 383 |
# File 'bin/httphere', line 381 def inspect "HTTP Request:\n\t#{@method} #{@resource_uri} HTTP/#{@http_version}\n\t#{@headers.map {|k,v| "#{k}: #{v}"}.join("\n\t")}\n\n\t#{@entity.to_s.gsub(/\n/,"\n\t")}" end |
#params ⇒ Object
393 394 395 |
# File 'bin/httphere', line 393 def params query_params end |
#ready! ⇒ Object
364 365 366 |
# File 'bin/httphere', line 364 def ready! @ready = true end |
#ready? ⇒ Boolean
367 368 369 |
# File 'bin/httphere', line 367 def ready? !!@ready end |