Class: WeatherHacker

Inherits:
Object
  • Object
show all
Defined in:
lib/weather_hacker.rb,
lib/weather_hacker/client.rb,
lib/weather_hacker/version.rb,
lib/weather_hacker/area_data.rb

Defined Under Namespace

Modules: AreaData Classes: Client

Constant Summary collapse

VERSION =
"0.1.2"

Instance Method Summary collapse

Constructor Details

#initialize(zipcode) ⇒ WeatherHacker

Returns a new instance of WeatherHacker.



8
9
10
11
# File 'lib/weather_hacker.rb', line 8

def initialize(zipcode)
  @zipcode = zipcode
  @client  = Client.new
end

Instance Method Details

#on(date) ⇒ Object

return weather data on the received date if the date is not supported, return nil



25
26
27
28
29
30
31
32
# File 'lib/weather_hacker.rb', line 25

def on(date)
  now = Date.today
  {
    now     => today,
    now + 1 => tomorrow,
    now + 2 => day_after_tomorrow,
  }[date]
end