lib/barometer/formats/geocode.rb in barometer-0.7.3 vs lib/barometer/formats/geocode.rb in barometer-0.8.0
- old
+ new
@@ -21,33 +21,33 @@
def self.to(original_query)
raise ArgumentError unless is_a_query?(original_query)
unless converts?(original_query)
return (original_query.format == format ? original_query.dup : nil)
end
-
+
unless converted_query = original_query.get_conversion(format)
converted_query = Barometer::Query.new
-
+
converted_query = case original_query.format
when :weather_id
Query::Format::WeatherID.reverse(original_query)
when :woe_id
Query::Format::WoeID.reverse(original_query)
else
geocode(original_query)
end
-
+
original_query.post_conversion(converted_query) if converted_query
end
converted_query
end
# geocode the query
#
def self.geocode(original_query)
raise ArgumentError unless is_a_query?(original_query)
-
+
converted_query = Barometer::Query.new
converted_query.geo = Barometer::WebService::Geocode.fetch(original_query)
if converted_query.geo
converted_query.country_code = converted_query.geo.country_code
converted_query.q = converted_query.geo.to_s
@@ -55,6 +55,6 @@
end
converted_query
end
end
-end
\ No newline at end of file
+end