Class: Barometer::Query::Converter::FromWoeIdOrIpv4ToGeocode
- Inherits:
-
Object
- Object
- Barometer::Query::Converter::FromWoeIdOrIpv4ToGeocode
- Defined in:
- lib/barometer/query/converters/from_woe_id_or_ipv4_to_geocode.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(query) ⇒ FromWoeIdOrIpv4ToGeocode
constructor
A new instance of FromWoeIdOrIpv4ToGeocode.
Constructor Details
#initialize(query) ⇒ FromWoeIdOrIpv4ToGeocode
Returns a new instance of FromWoeIdOrIpv4ToGeocode.
9 10 11 |
# File 'lib/barometer/query/converters/from_woe_id_or_ipv4_to_geocode.rb', line 9 def initialize(query) @query = query end |
Class Method Details
.from ⇒ Object
5 6 7 |
# File 'lib/barometer/query/converters/from_woe_id_or_ipv4_to_geocode.rb', line 5 def self.from [:woe_id, :ipv4_address] end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/barometer/query/converters/from_woe_id_or_ipv4_to_geocode.rb', line 13 def call return unless can_convert? @query.geo = @query.geo.merge( Service::YahooGeocode.new(@query).call ) @query.add_conversion(:coordinates, @query.geo.coordinates) @query.add_conversion(:geocode, @query.geo.to_s) end |