Class: Barometer::Query::Converter::FromWeatherIdToGeocode

Inherits:
Object
  • Object
show all
Defined in:
lib/barometer/query/converters/from_weather_id_to_geocode.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ FromWeatherIdToGeocode

Returns a new instance of FromWeatherIdToGeocode.



9
10
11
# File 'lib/barometer/query/converters/from_weather_id_to_geocode.rb', line 9

def initialize(query)
  @query = query
end

Class Method Details

.fromObject



5
6
7
# File 'lib/barometer/query/converters/from_weather_id_to_geocode.rb', line 5

def self.from
  [:weather_id]
end

Instance Method Details

#callObject



13
14
15
16
17
18
# File 'lib/barometer/query/converters/from_weather_id_to_geocode.rb', line 13

def call
  return unless can_convert?

  @query.geo = @query.geo.merge( Service::FromWeatherId.new(@query).call )
  @query.add_conversion(:geocode, @query.geo.to_s)
end