lib/barometer/formats/weather_id.rb in attack-barometer-0.5.0 vs lib/barometer/formats/weather_id.rb in attack-barometer-0.6.0
- old
+ new
@@ -15,11 +15,11 @@
@@fixes = nil
def self.format; :weather_id; end
def self.regex; /(^[A-Za-z]{4}[0-9]{4}$)/; end
def self.convertable_formats
- [:short_zipcode, :zipcode, :coordinates, :geocode]
+ [:short_zipcode, :zipcode, :coordinates, :icao, :geocode]
end
# the first two letters of the :weather_id is the country_code
#
def self.country_code(query=nil)
@@ -29,13 +29,13 @@
# convert to this format, X -> :weather_id
#
def self.to(original_query)
raise ArgumentError unless is_a_query?(original_query)
return nil unless converts?(original_query)
- converted_query = Barometer::Query.new
# convert original query to :geocode, as that is the only
# format we can convert directly from to weather_id
+ converted_query = Barometer::Query.new
converted_query = Query::Format::Geocode.to(original_query)
converted_query.q = _search(converted_query)
converted_query.format = format
converted_query.country_code = country_code(converted_query.q)
converted_query
\ No newline at end of file