class WeatherSage::Weather::Station
Thin wrapper around weather station.
Attributes
id[RW]
Public Class Methods
from_json(ctx, row)
click to toggle source
Create a new Station
from the given Context ctx
and the JSON data row
.
# File lib/weather-sage/weather/station.rb, line 11 def self.from_json(ctx, row) new( ctx, row['properties']['stationIdentifier'], row['properties']['name'], row['geometry']['coordinates'][0], row['geometry']['coordinates'][1], row['properties']['elevation']['value'], row['properties']['timeZone'] ) end
new(ctx, id, name, x, y, elevation, time_zone)
click to toggle source
Create a new station instance.
# File lib/weather-sage/weather/station.rb, line 26 def initialize(ctx, id, name, x, y, elevation, time_zone) @ctx = ctx @id = id @name = name @x = x @y = y @elevation = elevation @time_zone = time_zone end
Public Instance Methods
latest_observations()
click to toggle source
Return a hash of the latest observations from this station.
# File lib/weather-sage/weather/station.rb, line 39 def latest_observations path = 'stations/%s/observations/latest' % [@id] get(path)['properties'] end