This library brings the Google Maps API Web Services to your Ruby/RoR application. It supports both JSON and XML response formats.


Keywords
google-maps, http-client, ruby
License
MIT
Install
gem install googlemaps-services -v 1.5.0

Documentation

Ruby Client for Google Maps Services

Build Status Coverage Status

Description

This library brings the Google Maps API Web Services to your Ruby/RoR application.

The Ruby Client for Google Maps Services is a Ruby Client library for the following Google Maps APIs:

It supports both JSON and XML response formats.

Requirements

  • Ruby 2.1 or later.
  • A Google Maps API key.
  • Client ID and Client Secret (for Google Maps APIs Premium Plan customers).

Installation

Add this line to your application's Gemfile:

gem 'googlemaps-services'

And then execute:

$ bundle

Or install it yourself as:

$ gem install googlemaps-services

Documentation

View the reference documentation.

Usage

This example uses the Directions API with an API key:

  require 'googlemaps/services/client'
  require 'googlemaps/services/directions'

  include GoogleMaps::Services

  client = GoogleClient.new(key: 'Add API key here', response_format: :json)
  directions = Directions.new(client)

  # Get directions via public transit in JSON format.
  # To return the result in XML format, change the Client response_format parameter to :xml.
  result = directions.query(origin: '75 9th Ave, New York, NY',
                            destination: 'MetLife Stadium Dr East Rutherford, NJ 07073',
                            mode: 'transit',
                            departure_time: Time.now)
  # Print the result
  puts result

For more usage examples, check out the reference documentation.

Contributing

Bug reports, Pull requests and Stars are always welcome. For bugs and feature requests, please create an issue.

Donate

  • Donate
  • Bitcoin: 1EdwqtXhojU4LGhTwBLT1JpTb1d71oA89o

License

The gem is available as open source under the terms of the MIT License.