Class: PocketMath::Geocode::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pocketmath-geocode.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



108
109
# File 'lib/pocketmath-geocode.rb', line 108

def close
end

#get_gps_coordinates(locations, max_results = 1) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/pocketmath-geocode.rb', line 87

def get_gps_coordinates(locations, max_results = 1)
  _locations = nil
  if (!locations.is_a?(Array))
    _locations = [ locations ]
  else
    _locations = locations
  end
  gps_coordinates = []        
  _locations.each do |location|
    if @provider == :google
      gps_coordinates = gps_coordinates + get_gps_coordinates_google(location, max_results)
    elsif @provider == :open
      gps_coordinates = gps_coordinates + get_gps_coordinates_open(location, max_results)
    else
      raise "map provider was not specified"
    end
  end
  gps_coodinates = gps_coordinates.zip
  return gps_coordinates
end