Module: Geocoder::Lookup

Extended by:
Lookup
Included in:
Lookup
Defined in:
lib/geocoder/lookup.rb,
lib/geocoder/lookups/amap.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/geoip2.rb,
lib/geocoder/lookups/google.rb,
lib/geocoder/lookups/latlon.rb,
lib/geocoder/lookups/mapbox.rb,
lib/geocoder/lookups/pelias.rb,
lib/geocoder/lookups/telize.rb,
lib/geocoder/lookups/yandex.rb,
lib/geocoder/lookups/ipstack.rb,
lib/geocoder/lookups/maxmind.rb,
lib/geocoder/lookups/tencent.rb,
lib/geocoder/lookups/baidu_ip.rb,
lib/geocoder/lookups/geocodio.rb,
lib/geocoder/lookups/mapquest.rb,
lib/geocoder/lookups/osmnames.rb,
lib/geocoder/lookups/pointpin.rb,
lib/geocoder/lookups/db_ip_com.rb,
lib/geocoder/lookups/freegeoip.rb,
lib/geocoder/lookups/ipapi_com.rb,
lib/geocoder/lookups/ipdata_co.rb,
lib/geocoder/lookups/ipinfo_io.rb,
lib/geocoder/lookups/nominatim.rb,
lib/geocoder/lookups/pickpoint.rb,
lib/geocoder/lookups/ipregistry.rb,
lib/geocoder/lookups/geocoder_ca.rb,
lib/geocoder/lookups/ip2location.rb,
lib/geocoder/lookups/location_iq.rb,
lib/geocoder/lookups/opencagedata.rb,
lib/geocoder/lookups/postcodes_io.rb,
lib/geocoder/lookups/geoportail_lu.rb,
lib/geocoder/lookups/ipgeolocation.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/ban_data_gouv_fr.rb,
lib/geocoder/lookups/google_places_search.rb,
lib/geocoder/lookups/postcode_anywhere_uk.rb,
lib/geocoder/lookups/google_places_details.rb,
lib/geocoder/lookups/nationaal_georegister_nl.rb,
lib/geocoder/lookups/uk_ordnance_survey_names.rb

Defined Under Namespace

Classes: Amap, Baidu, BaiduIp, BanDataGouvFr, Base, Bing, DbIpCom, Dstk, Esri, Freegeoip, GeocoderCa, Geocodio, Geoip2, GeoportailLu, Google, GooglePlacesDetails, GooglePlacesSearch, GooglePremier, Here, Ip2location, IpapiCom, IpdataCo, Ipgeolocation, IpinfoIo, Ipregistry, Ipstack, Latlon, LocationIq, Mapbox, Mapquest, Maxmind, MaxmindGeoip2, MaxmindLocal, NationaalGeoregisterNl, Nominatim, Opencagedata, Osmnames, Pelias, Pickpoint, Pointpin, PostcodeAnywhereUk, PostcodesIo, SmartyStreets, Telize, Tencent, Test, UkOrdnanceSurveyNames, Yandex

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ip_servicesObject

All IP address lookup services, default first.


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/geocoder/lookup.rb', line 63

def ip_services
  @ip_services ||= [
    :baidu_ip,
    :freegeoip,
    :geoip2,
    :maxmind,
    :maxmind_local,
    :telize,
    :pointpin,
    :maxmind_geoip2,
    :ipinfo_io,
    :ipregistry,
    :ipapi_com,
    :ipdata_co,
    :db_ip_com,
    :ipstack,
    :ip2location,
    :ipgeolocation
  ]
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
51
52
53
54
55
56
57
58
# File 'lib/geocoder/lookup.rb', line 24

def street_services
  @street_services ||= [
    :location_iq,
    :dstk,
    :esri,
    :google,
    :google_premier,
    :google_places_details,
    :google_places_search,
    :bing,
    :geocoder_ca,
    :yandex,
    :nationaal_georegister_nl,
    :nominatim,
    :mapbox,
    :mapquest,
    :uk_ordnance_survey_names,
    :opencagedata,
    :pelias,
    :pickpoint,
    :here,
    :baidu,
    :tencent,
    :geocodio,
    :smarty_streets,
    :postcode_anywhere_uk,
    :postcodes_io,
    :geoportail_lu,
    :ban_data_gouv_fr,
    :test,
    :latlon,
    :amap,
    :osmnames
  ]
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.


91
92
93
94
95
# File 'lib/geocoder/lookup.rb', line 91

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