Sha256: 6624a93049909d7e08282f1c6d4797fe36a57a0fedbb819499bc0def2bb25c8d

Contents?: true

Size: 464 Bytes

Versions: 2

Compression:

Stored size: 464 Bytes

Contents

require 'net/http'

# All ugly providers who parse even uglier html code and rip off data
module WeatherFetcher
  class HtmlBased < Provider

    TYPE = :html_based

    # Get processed weather for one definition
    def fetch_and_process_single(d)
      url = d[:url]
      body = fetch_url(url)
      processed = process(body)
      return processed
    end

    # Download url
    def fetch_url(url)
      return Net::HTTP.get(URI.parse(url))
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weather_fetcher-0.0.1 lib/weather_fetcher/providers/html_based.rb
weather_fetcher-0.0.0 lib/weather_fetcher/providers/html_based.rb