Skip to content

Commit

Permalink
finished forecast methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aspires committed May 17, 2012
1 parent ef478ec commit 1f0001b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion lib/gwx.rb
Expand Up @@ -19,7 +19,11 @@ def information
end

def forecast
@information = Forecast.new(@wx)
@forecast ||= Array.new
4.times do |day|
@forecast << Forecast.new(@wx, day)
end
@forecast
end

private
Expand Down
10 changes: 5 additions & 5 deletions lib/gwx/forecast_conditions.rb
@@ -1,12 +1,12 @@
class GoogleWeather::Forecast
attr_accessor :forecast_conditions, :day_of_the_week, :icon, :low, :high, :condition
attr_accessor :forecast_conditions, :day_of_week, :icon, :low, :high, :condition

def initialize(wx)
@forecast_conditions = wx["forecast_conditions"]["data"]
def initialize(wx, day)
@forecast_conditions = wx["forecast_conditions"][day]
end

def day_of_the_week
@day_of_the_week = @forecast_conditions["day_of_the_week"]["data"]
def day_of_week
@day_of_week = @forecast_conditions["day_of_week"]["data"]
end

def icon
Expand Down

0 comments on commit 1f0001b

Please sign in to comment.