class Accuweather::Location::Parser

Public Class Methods

new(response) click to toggle source
# File lib/accuweather/location/parser.rb, line 4
def initialize(response)
  @doc = Nokogiri::XML.parse(response)
end

Public Instance Methods

cities() click to toggle source
# File lib/accuweather/location/parser.rb, line 8
def cities
  @doc.css('location').map do |location|
    Accuweather::Location::City.new(id: location.attr('location'),
                                    city: location.attr('city'),
                                    state: location.attr('state'),
                                    latitude: location.attr('latitude'),
                                    longitude: location.attr('longitude'))
  end
end