Module: Geocoder::Lookup

Extended by:
Lookup
Included in:
Lookup
Defined in:
lib/geocoder/lookup.rb,
lib/geocoder/lookups/okf.rb,
lib/geocoder/lookups/ovi.rb,
lib/geocoder/lookups/base.rb,
lib/geocoder/lookups/bing.rb,
lib/geocoder/lookups/dstk.rb,
lib/geocoder/lookups/esri.rb,
lib/geocoder/lookups/here.rb,
lib/geocoder/lookups/test.rb,
lib/geocoder/lookups/baidu.rb,
lib/geocoder/lookups/yahoo.rb,
lib/geocoder/lookups/geoip2.rb,
lib/geocoder/lookups/google.rb,
lib/geocoder/lookups/mapbox.rb,
lib/geocoder/lookups/telize.rb,
lib/geocoder/lookups/yandex.rb,
lib/geocoder/lookups/maxmind.rb,
lib/geocoder/lookups/baidu_ip.rb,
lib/geocoder/lookups/geocodio.rb,
lib/geocoder/lookups/mapquest.rb,
lib/geocoder/lookups/pointpin.rb,
lib/geocoder/lookups/freegeoip.rb,
lib/geocoder/lookups/nominatim.rb,
lib/geocoder/lookups/geocoder_ca.rb,
lib/geocoder/lookups/geocoder_us.rb,
lib/geocoder/lookups/opencagedata.rb,
lib/geocoder/lookups/geoportail_lu.rb,
lib/geocoder/lookups/maxmind_local.rb,
lib/geocoder/lookups/google_premier.rb,
lib/geocoder/lookups/maxmind_geoip2.rb,
lib/geocoder/lookups/smarty_streets.rb,
lib/geocoder/lookups/postcode_anywhere_uk.rb,
lib/geocoder/lookups/google_places_details.rb

Defined Under Namespace

Classes: Baidu, BaiduIp, Base, Bing, Dstk, Esri, Freegeoip, GeocoderCa, GeocoderUs, Geocodio, Geoip2, GeoportailLu, Google, GooglePlacesDetails, GooglePremier, Here, Mapbox, Mapquest, Maxmind, MaxmindGeoip2, MaxmindLocal, Nominatim, Okf, Opencagedata, Ovi, Pointpin, PostcodeAnywhereUk, SmartyStreets, Telize, Test, Yahoo, Yandex

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ip_servicesObject

All IP address lookup services, default first.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/geocoder/lookup.rb', line 55

def ip_services
  @ip_services ||= [
    :baidu_ip,
    :freegeoip,
    :geoip2,
    :maxmind,
    :maxmind_local,
    :telize,
    :pointpin,
    :maxmind_geoip2
  ]
end

#street_servicesObject

All street address lookup services, default first.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/geocoder/lookup.rb', line 24

def street_services
  @street_services ||= [
    :dstk,
    :esri,
    :google,
    :google_premier,
    :google_places_details,
    :yahoo,
    :bing,
    :geocoder_ca,
    :geocoder_us,
    :yandex,
    :nominatim,
    :mapbox,
    :mapquest,
    :opencagedata,
    :ovi,
    :here,
    :baidu,
    :geocodio,
    :smarty_streets,
    :okf,
    :postcode_anywhere_uk,
    :geoportail_lu,
    :test
  ]
end

Instance Method Details

#all_servicesObject

Array of valid Lookup service names.



10
11
12
# File 'lib/geocoder/lookup.rb', line 10

def all_services
  street_services + ip_services
end

#all_services_except_testObject

Array of valid Lookup service names, excluding :test.



17
18
19
# File 'lib/geocoder/lookup.rb', line 17

def all_services_except_test
  all_services - [:test]
end

#get(name) ⇒ Object

Retrieve a Lookup object from the store. Use this instead of Geocoder::Lookup::X.new to get an already-configured Lookup object.



75
76
77
78
79
# File 'lib/geocoder/lookup.rb', line 75

def get(name)
  @services = {} unless defined?(@services)
  @services[name] = spawn(name) unless @services.include?(name)
  @services[name]
end