Module: Google::Maps

Extended by:
Configuration, Logger
Defined in:
lib/google-maps.rb,
lib/google_maps/api.rb,
lib/google_maps/place.rb,
lib/google_maps/route.rb,
lib/google_maps/logger.rb,
lib/google_maps/result.rb,
lib/google_maps/version.rb,
lib/google_maps/location.rb,
lib/google_maps/configuration.rb,
lib/google_maps/distance_matrix.rb

Defined Under Namespace

Modules: Configuration, Logger Classes: API, DistanceMatrix, InvalidConfigurationError, InvalidPremierConfigurationException, InvalidResponseException, Location, Place, PlaceDetails, Result, Route, ZeroResultsException

Constant Summary collapse

VERSION =
'3.0.7'

Constants included from Configuration

Configuration::API_KEY, Configuration::DEFAULT_DIRECTIONS_SERVICE, Configuration::DEFAULT_DISTANCE_MATRIX_SERVICE, Configuration::DEFAULT_END_POINT, Configuration::DEFAULT_FORMAT, Configuration::DEFAULT_GEOCODE_SERVICE, Configuration::DEFAULT_LANGUAGE, Configuration::DEFAULT_PARAMS, Configuration::DEFAULT_PLACES_SERVICE, Configuration::DEFAULT_PLACE_DETAILS_SERVICE, Configuration::DIGITAL_SIGNATURE, Configuration::VALID_OPTIONS_KEYS

Instance Attribute Summary

Attributes included from Logger

#logger

Class Method Summary collapse

Methods included from Configuration

configure, extended, options, reset, validate_api_key, validate_config, validate_digital_signature

Methods included from Logger

extended, log_file=

Class Method Details

.distance(from, to, options = {}) ⇒ Object



19
20
21
# File 'lib/google-maps.rb', line 19

def self.distance(from, to, options = {})
  Route.new(from, to, options_with_defaults(options)).distance.text
end

.distance_matrix(from, to, options = {}) ⇒ Object



35
36
37
# File 'lib/google-maps.rb', line 35

def self.distance_matrix(from, to, options = {})
  DistanceMatrix.new(from, to, options_with_defaults(options))
end

.duration(from, to, options = {}) ⇒ Object



23
24
25
# File 'lib/google-maps.rb', line 23

def self.duration(from, to, options = {})
  Route.new(from, to, options_with_defaults(options)).duration.text
end

.geocode(address, language = default_language) ⇒ Object



39
40
41
42
43
# File 'lib/google-maps.rb', line 39

def self.geocode(address, language = default_language)
  Location.find(address, language)
rescue ZeroResultsException
  []
end

.place(place_id, language = default_language) ⇒ Object



31
32
33
# File 'lib/google-maps.rb', line 31

def self.place(place_id, language = default_language)
  PlaceDetails.find(place_id, language)
end

.places(keyword, language = default_language) ⇒ Object



27
28
29
# File 'lib/google-maps.rb', line 27

def self.places(keyword, language = default_language)
  Place.find(keyword, language)
end

.route(from, to, options = {}) ⇒ Object



15
16
17
# File 'lib/google-maps.rb', line 15

def self.route(from, to, options = {})
  Route.new(from, to, options_with_defaults(options))
end