Class: WeatherBug::Station

Inherits:
TransformableData show all
Defined in:
lib/weatherbug/station.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TransformableData

register_transformer

Class Method Details

.from_document(document) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/weatherbug/station.rb', line 17

def self.from_document(document)
  station = super
  raise ArgumentError.new('No such station') if station.station_id.empty?
  station
end

Instance Method Details

#forecastObject



27
28
29
# File 'lib/weatherbug/station.rb', line 27

def forecast
  WeatherBug.forecast(:latitude => latitude, :longitude => longitude)
end

#live_observation(unit = :f) ⇒ Object



23
24
25
# File 'lib/weatherbug/station.rb', line 23

def live_observation(unit = :f)
  WeatherBug.live_observation(self, unit)
end