Class: NoaaWeatherClient::Responses::LatLonList

Inherits:
Object
  • Object
show all
Includes:
ReactiveXmlResponse, ValidatableXmlResponse
Defined in:
lib/noaa_weather_client/responses/lat_lon_list.rb

Constant Summary

Constants included from ValidatableXmlResponse

ValidatableXmlResponse::SCHEMA_PATH

Instance Method Summary collapse

Methods included from ValidatableXmlResponse

#validate!

Methods included from ReactiveXmlResponse

#method_missing, #respond_to_missing?, #source

Constructor Details

#initialize(response) ⇒ LatLonList

Returns a new instance of LatLonList.



11
12
13
14
# File 'lib/noaa_weather_client/responses/lat_lon_list.rb', line 11

def initialize(response)
  @source = XmlParserFactory.build_parser.parse(response)
  validate! @source, :dwml
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NoaaWeatherClient::Responses::ReactiveXmlResponse

Instance Method Details

#latitudeObject



16
17
18
# File 'lib/noaa_weather_client/responses/lat_lon_list.rb', line 16

def latitude
  @latitude ||= latLonList.split(",").first.to_f
end

#longitudeObject



20
21
22
# File 'lib/noaa_weather_client/responses/lat_lon_list.rb', line 20

def longitude
  @longitude ||= latLonList.split(",").last.to_f
end