Class: GoogleWeather

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/gwx.rb

Defined Under Namespace

Classes: Current, Forecast, Information

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ GoogleWeather

Returns a new instance of GoogleWeather.



6
7
8
9
10
11
# File 'lib/gwx.rb', line 6

def initialize(location)
  result = validate_location(location)
  unless result.class == String
    @wx = result
  end
end

Instance Method Details

#currentObject



13
14
15
# File 'lib/gwx.rb', line 13

def current
  @current ||= Current.new(@wx)
end

#forecastObject



21
22
23
24
25
26
27
# File 'lib/gwx.rb', line 21

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

#informationObject



17
18
19
# File 'lib/gwx.rb', line 17

def information
  @information ||= Information.new(@wx)
end