Project

gistance

0.0
No commit activity in last 3 years
No release in over 3 years
Simple Ruby wrapper for the Google Distance Matrix API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.9.1
~> 2.0.5
~> 1.8.1
~> 1.11.0
 Project Readme

Simple Ruby wrapper for the Google Distance Matrix API.

Current version: Gem Version

Build status:        Build Status

Code metrics:      Code Climate Coverage Status

Ruby support:

  • 1.9.2
  • 1.9.3
  • 2.0.0
  • 2.1.1
  • 2.1.2

Installation

Install via Rubygems

gem install gistance

or add to your Gemfile

gem 'gistance'

Configuration

API methods are available as module methods

Gistance.configure do |c|
  c.api_key = 'YOUR_API_KEY'
  c.units = 'imperial' # default to metric
  c.language = 'fr' # default to en
  c.sensor = true # default to false
end

or as client instance methods

Gistance::Client.new(
  api_key: 'YOUR_API_KEY',
  units: 'imperial',
  language: 'fr',
  sensor: true
)

The units, language and sensor parameters can be set globally or can be provided for every request if passed as parameters.

Authentication

Gistance supports authentication via a simple API key or a Google Maps for Business signature.

# Google Maps API for Business authentication
Gistance.configure do |c|
  c.api_key = 'YOUR_API_KEY'
  c.business = {
    client_id: 'gme-fuubar',
    channel: 'test' # optional
  }
  # etc...
end

Usage

distances = Gistance.distance_matrix(
  origins: ["37.769541, -122.486747"],
  destinations: ["37.740497, -122.442887"]
)

distances.origin_addresses
# => ["Golden Gate Park"]

# etc…

Features

Gistance supports all the Google Distance Matrix parameters

Complete Gistance public API's documentation here.

Similar libraries

Versioning

Gistance follows the principles of semantic versioning.

  1. Patch level releases contain only bug fixes.
  2. Minor releases contain backward-compatible new features.
  3. Major new releases contain backwards-incompatible changes to the public API.

Contributing

Pull Requests are welcome !

Please refer to the Contributing guide for more details on how to run the test suite and to contribute.

Copyright

Copyright © 2014 Aylic Petit

Released under the terms of the MIT licence. See the LICENSE file for more details.