Sha256: 5632f08dabe05e84b71c214d3884e980174b3c2ec9749ec24b24299bb11bdaa4
Contents?: true
Size: 918 Bytes
Versions: 2
Compression:
Stored size: 918 Bytes
Contents
module Barometer # # Web Service: WeatherID # # uses Weather.com search to obtain a weather id # class WebService::WeatherID < WebService # get the weather_id for a given query # def self.fetch(query) return nil unless query raise ArgumentError unless _is_a_query?(query) response = self.get( "http://xoap.weather.com/search/search", :query => { :where => query.q }, :format => :plain, :timeout => Barometer.timeout ) end # get the location_date (geocode) for a given weather_id # def self.reverse(query) return nil unless query raise ArgumentError unless _is_a_query?(query) self.get( "http://weather.yahooapis.com/forecastrss", :query => { :p => query.q }, :format => :xml, :timeout => Barometer.timeout )['rss']['channel']["yweather:location"] end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
attack-barometer-0.5.0 | lib/barometer/web_services/weather_id.rb |
barometer-0.5.0 | lib/barometer/web_services/weather_id.rb |