A Ruby gem that wraps the Google Places API for use in Rails applications. Supports place details, text search, nearby search, radar search, photos, reviews, and autocomplete.
Add this line to your Gemfile:
gem 'google-api-customization'Then run:
bundle installGoogleApiCustomization.configuration do |config|
config.api_key = "YOUR_GOOGLE_API_KEY"
endplace = GoogleApiCustomization::Place.find(place_id, api_key, sensor)
place.name # => "Eiffel Tower"
place.formatted_address # => "Champ de Mars, Paris, France"
place.lat # => 48.8584
place.lng # => 2.2945
place.rating # => 4.7
place.website # => "https://www.toureiffel.paris"
place.opening_hours # => { ... }places = GoogleApiCustomization::Place.list_by_query(
"coffee shops",
api_key,
sensor,
lat: 48.8584,
lng: 2.2945,
radius: 1000
)place.photos.each do |photo|
url = photo.fetch_url(400) # maxwidth in pixels
endplace.reviews.each do |review|
puts "#{review.author_name}: #{review.text} (#{review.rating}/5)"
endname, place_id, lat, lng, formatted_address, formatted_phone_number, international_phone_number, website, rating, price_level, opening_hours, types, photos, reviews, url, vicinity, address_components, utc_offset