class Aemet::City

Attributes

aemet_id[R]

Public Class Methods

new(aemet_id) click to toggle source
# File lib/aemet/city.rb, line 5
def initialize(aemet_id)
  @aemet_id = aemet_id
end

Public Instance Methods

weather() click to toggle source
# File lib/aemet/city.rb, line 9
def weather
  @weather ||= get_weather
end

Private Instance Methods

get_weather() click to toggle source
# File lib/aemet/city.rb, line 19
def get_weather
  @weather = Hashie::Mash.new(weather_response).root
end
weather_response() click to toggle source
# File lib/aemet/city.rb, line 15
def weather_response
  @weather_response ||= HTTParty.get(xml_url)
end
xml_url() click to toggle source
# File lib/aemet/city.rb, line 23
def xml_url
  "#{BASE_URL}/xml/municipios/localidad_#{aemet_id}.xml"
end