Class: HttpDownloader::Http::Request
- Inherits:
-
Object
- Object
- HttpDownloader::Http::Request
- Defined in:
- lib/http_downloader/http/request.rb
Constant Summary collapse
- HTTP =
'http'- HTTPS =
'https'
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(uri, headers = {}, http_options = {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(uri, headers = {}, http_options = {}) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 |
# File 'lib/http_downloader/http/request.rb', line 7 def initialize(uri, headers = {}, = {}) @uri = uri @headers = headers @http_options = end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/http_downloader/http/request.rb', line 13 def execute response = nil byebug Net::HTTP.start(@uri.host, @uri.port, (@uri)) do |http| request = Net::HTTP::Get.new(@uri, @headers) http.request(request) do |http_response| response = http_response end end response end |