Class: SoraGeocoding::Results::Geocoding
- Defined in:
- lib/sora_geocoding/results/geocoding.rb
Overview
get the latitude and longitude of the Geocoding 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
18 19 20 21 22 23 24 |
# File 'lib/sora_geocoding/results/geocoding.rb', line 18 def check_data_for_errors! error = @data.elements['/result/error'] return unless error code = error.get_text.to_s SoraGeocoding.log(:error, "Geocoding API error: #{code} Zero Results") end |
#coordinates ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/sora_geocoding/results/geocoding.rb', line 9 def coordinates check_data_for_errors! common = '/result/coordinate' lat = @data.elements["#{common}/lat"].get_text lon = @data.elements["#{common}/lng"].get_text { lat: lat, lon: lon } end |