Class: Basicgeo::Consumer::Google
- Inherits:
-
Object
- Object
- Basicgeo::Consumer::Google
- Includes:
- HTTParty
- Defined in:
- lib/basicgeo/consumer/google.rb
Instance Method Summary collapse
- #get_address(latitude, longitude) ⇒ Object
- #get_location(address) ⇒ Object
- #parse_address(string) ⇒ Object
Instance Method Details
#get_address(latitude, longitude) ⇒ Object
18 19 20 |
# File 'lib/basicgeo/consumer/google.rb', line 18 def get_address(latitude, longitude) self.class.get("http://maps.googleapis.com/maps/api/geocode/json?latlng=#{latitude},#{longitude}") end |
#get_location(address) ⇒ Object
14 15 16 |
# File 'lib/basicgeo/consumer/google.rb', line 14 def get_location(address) self.class.get("http://maps.googleapis.com/maps/api/geocode/json?address=#{parse_address(address)}") end |
#parse_address(string) ⇒ Object
10 11 12 |
# File 'lib/basicgeo/consumer/google.rb', line 10 def parse_address(string) I18n.transliterate(string.gsub(" ", "+")) end |