class NoaaWeatherClient::Responses::Stations

Attributes

body[R]
options[R]

Public Class Methods

new(response, options = {}) click to toggle source
# File lib/noaa_weather_client/responses/stations.rb, line 13
def initialize(response, options = {})
  @body = XmlParserFactory.build_parser.parse response
  @options = options
end

Public Instance Methods

each() { |s| ... } click to toggle source
# File lib/noaa_weather_client/responses/stations.rb, line 18
def each
  stations.each { |s| yield s }
end
to_xml() click to toggle source
# File lib/noaa_weather_client/responses/stations.rb, line 22
def to_xml
  body.to_xml
end

Private Instance Methods

station_class() click to toggle source
# File lib/noaa_weather_client/responses/stations.rb, line 36
def station_class
  options.fetch(:station_class, Station)
end
stations() click to toggle source
# File lib/noaa_weather_client/responses/stations.rb, line 30
def stations
  @stations ||= body.css('station').map do |station|
    station_class.new station
  end
end