Class: NoaaWeatherClient::Responses::Station
- Inherits:
-
Object
- Object
- NoaaWeatherClient::Responses::Station
- Includes:
- ReactiveXmlResponse
- Defined in:
- lib/noaa_weather_client/responses/station.rb
Instance Method Summary collapse
-
#initialize(station) ⇒ Station
constructor
A new instance of Station.
- #latitude ⇒ Object
- #longitude ⇒ Object
- #xml_url ⇒ Object
Methods included from ReactiveXmlResponse
#method_missing, #respond_to_missing?, #source
Constructor Details
#initialize(station) ⇒ Station
Returns a new instance of Station.
8 9 10 |
# File 'lib/noaa_weather_client/responses/station.rb', line 8 def initialize(station) @source = station end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NoaaWeatherClient::Responses::ReactiveXmlResponse
Instance Method Details
#latitude ⇒ Object
12 13 14 |
# File 'lib/noaa_weather_client/responses/station.rb', line 12 def latitude source.css('latitude').text.to_f end |
#longitude ⇒ Object
16 17 18 |
# File 'lib/noaa_weather_client/responses/station.rb', line 16 def longitude source.css('longitude').text.to_f end |
#xml_url ⇒ Object
20 21 22 23 24 25 |
# File 'lib/noaa_weather_client/responses/station.rb', line 20 def xml_url @xml_url ||= begin path = URI(source.css('xml_url').text).path "http://w1.weather.gov#{path}" end end |