Sha256: fb3d13677f895bb3e8ce5a0cddf90e226cbd3c6dd80afcd37f8d923436c8a89c

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'thor'
require 'scrapers/wunderground'

class Wunderground < Thor

  VERSION = '1.0.0'
  WUNDERGROUND_URL = "http://www.wunderground.com/"

  desc "current", "Show the current local weather conditions from #{WUNDERGROUND_URL}"
  def current
    current_conditions
  end

  desc "location", "Show location for current local weather"
  def location
    current_conditions["location"]
  end

  desc "image", "URL for current local weather conditions"
  def image
    current_conditions["image"]
  end

  desc "temp", "Current local temperature with units"
  def temp
    current_conditions["temp"]
  end

  desc "condition", "Current condition"
  def condition
    current_conditions["condition"]
  end

  desc "feel", "Feels like temperature"
  def feel
    current_conditions["feel"]
  end

  desc "high", "Forecast High Temperature"
  def high
    current_conditions["high"]
  end

  desc "low", "Forecast Low temperature"
  def low
    current_conditions["low"]
  end

  private

  def current_conditions
    @_current_conditions ||= Scrapers::Wunderground.scrape(WUNDERGROUND_URL)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scrapers-3.2.0 lib/wunderground_thor.rb
scrapers-3.1.0 lib/wunderground_thor.rb
scrapers-3.0.0 lib/wunderground_thor.rb
scrapers-2.1.0 lib/wunderground_thor.rb
scrapers-2.0.2 lib/wunderground_thor.rb