Class: HttpVanilli::NetHttp::Request
- Defined in:
- lib/http_vanilli/net_http/request.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#original_request ⇒ Object
readonly
Returns the value of attribute original_request.
-
#uri ⇒ Object
(also: #url)
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #body ⇒ Object
- #host ⇒ Object
-
#initialize(http, request, index, &block) ⇒ Request
constructor
A new instance of Request.
- #to_s ⇒ Object
Methods inherited from Request
Constructor Details
#initialize(http, request, index, &block) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/http_vanilli/net_http/request.rb', line 8 def initialize(http,request,index,&block) @http = http @original_request = request @index = index @block = block protocol = http.use_ssl? ? "https" : "http" path = request.path path = Addressable::URI.parse(request.path).request_uri if request.path =~ /^https?:/ @uri = Addressable::URI.parse( "#{protocol}://#{http.address}:#{http.port}#{path}" ) @method = request.method.downcase.to_sym end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/http_vanilli/net_http/request.rb', line 6 def block @block end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
6 7 8 |
# File 'lib/http_vanilli/net_http/request.rb', line 6 def index @index end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/http_vanilli/net_http/request.rb', line 6 def method @method end |
#original_request ⇒ Object (readonly)
Returns the value of attribute original_request.
6 7 8 |
# File 'lib/http_vanilli/net_http/request.rb', line 6 def original_request @original_request end |
#uri ⇒ Object (readonly) Also known as: url
Returns the value of attribute uri.
6 7 8 |
# File 'lib/http_vanilli/net_http/request.rb', line 6 def uri @uri end |
Instance Method Details
#body ⇒ Object
31 32 33 |
# File 'lib/http_vanilli/net_http/request.rb', line 31 def body @original_request.body end |
#host ⇒ Object
25 |
# File 'lib/http_vanilli/net_http/request.rb', line 25 def host; @uri.host end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/http_vanilli/net_http/request.rb', line 27 def to_s "#{@method} #{@uri.to_s}" end |