Sha256: 54a41ecc0cc6e396fd0286fd4a9d812e2d4a5f8383434645d0db01760b48e285

Contents?: true

Size: 621 Bytes

Versions: 4

Compression:

Stored size: 621 Bytes

Contents

module Accuweather
  module Location
    class Parser
      def initialize(response)
        @doc = Nokogiri::XML.parse(response)
      end

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
accuweather-0.2.3 lib/accuweather/location/parser.rb
accuweather-0.2.2 lib/accuweather/location/parser.rb
accuweather-0.2.0 lib/accuweather/location/parser.rb
accuweather-0.1.3 lib/accuweather/location/parser.rb