Class: PageDownloader::RemoteContentFetcher
- Inherits:
-
Object
- Object
- PageDownloader::RemoteContentFetcher
- Defined in:
- lib/page_downloader/remote_content_fetcher.rb
Instance Method Summary collapse
Instance Method Details
#fetch(page_url) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/page_downloader/remote_content_fetcher.rb', line 6 def fetch(page_url) puts "Fetching: #{page_url}" url = Addressable::URI.parse(page_url) ssl = url.scheme == "https" Net::HTTP.start(url.host, url.port, use_ssl: ssl) do |http| request = Net::HTTP::Get.new(url) http.request(request).body end end |