Class: SoraGeocoding::Results::YahooGeocoder
- Defined in:
- lib/sora_geocoding/results/yahoo_geocoder.rb
Overview
get the latitude and longitude of the Yahoo! Geocoder API
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #latitude, #longitude
Constructor Details
This class inherits a constructor from SoraGeocoding::Results::Base
Instance Method Details
#check_data_for_errors! ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/sora_geocoding/results/yahoo_geocoder.rb', line 15 def check_data_for_errors! if @data.elements['/Error'] = @data.elements['/Error/Message'].get_text.to_s code = @data.elements['/Error/Code'].get_text.to_s SoraGeocoding.log(:error, "Yahoo Geocoder API error: #{code} #{}") elsif @data.elements['/YDF'].attributes['totalResultsReturned'].to_i < 1 SoraGeocoding.log(:error, 'Yahoo Geocoder API error: 001 Zero Results') end end |
#coordinates ⇒ Object
9 10 11 12 13 |
# File 'lib/sora_geocoding/results/yahoo_geocoder.rb', line 9 def coordinates check_data_for_errors! lonlat = @data.elements['/YDF/Feature/Geometry/Coordinates'].get_text.to_s.split(',') { lat: lonlat[1], lon: lonlat[0] } end |