class PageDownloader::RemoteContentFetcher

Public Instance Methods

fetch(page_url) click to toggle source
# 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