Module: Pinpoint::Mapable

Included in:
Address
Defined in:
lib/pinpoint/mapable.rb

Instance Method Summary collapse

Instance Method Details

#map_url(options = {}) ⇒ Object

Public: Creates a URL which can be used to locate the Mapable on a map using one of the supported services:

  • Google Maps

  • Yahoo Maps

  • Mapquest

options - A Hash of options which will apply to the map URL

:via - A Symbol representing the service to use to create the
       map URL. Options include:

       * :google_maps
       * :yahoo_maps
       * :mapquest

      (defaults to google_maps)

Returns a String representing the URL which will display the location in

the browser.


30
31
32
33
34
35
36
# File 'lib/pinpoint/mapable.rb', line 30

def map_url(options = {})
  service              = options.fetch(:via, :google_maps)
  service_class        = service_class_for(service)

  service_class.map_url location:      to_s,
                        location_name: name
end