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/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/ipbase.rb,
lib/geocoder/lookups/latlon.rb,
lib/geocoder/lookups/mapbox.rb,
lib/geocoder/lookups/pelias.rb,
lib/geocoder/lookups/photon.rb,
lib/geocoder/lookups/telize.rb,
lib/geocoder/lookups/twogis.rb,
lib/geocoder/lookups/yandex.rb,
lib/geocoder/lookups/ipstack.rb,
lib/geocoder/lookups/maxmind.rb,
lib/geocoder/lookups/pdok_nl.rb,
lib/geocoder/lookups/tencent.rb,
lib/geocoder/lookups/baidu_ip.rb,
lib/geocoder/lookups/geoapify.rb,
lib/geocoder/lookups/geocodio.rb,
lib/geocoder/lookups/mapquest.rb,
lib/geocoder/lookups/osmnames.rb,
lib/geocoder/lookups/pc_miler.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/abstract_api.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/ip2location_io.rb,
lib/geocoder/lookups/ipqualityscore.rb,
lib/geocoder/lookups/maxmind_geoip2.rb,
lib/geocoder/lookups/melissa_street.rb,
lib/geocoder/lookups/smarty_streets.rb,
lib/geocoder/lookups/ban_data_gouv_fr.rb,
lib/geocoder/lookups/ip2location_lite.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/amazon_location_service.rb,
lib/geocoder/lookups/nationaal_georegister_nl.rb,
lib/geocoder/lookups/uk_ordnance_survey_names.rb

Defined Under Namespace

Classes: AbstractApi, Amap, AmazonLocationService, Baidu, BaiduIp, BanDataGouvFr, Base, Bing, DbIpCom, Esri, Freegeoip, Geoapify, GeocoderCa, Geocodio, Geoip2, GeoportailLu, Google, GooglePlacesDetails, GooglePlacesSearch, GooglePremier, Here, Ip2location, Ip2locationIo, Ip2locationLite, IpapiCom, Ipbase, IpdataCo, Ipgeolocation, IpinfoIo, Ipqualityscore, Ipregistry, Ipstack, Latlon, LocationIq, Mapbox, Mapquest, Maxmind, MaxmindGeoip2, MaxmindLocal, MelissaStreet, NationaalGeoregisterNl, Nominatim, Opencagedata, Osmnames, PcMiler, PdokNl, Pelias, Photon, Pickpoint, Pointpin, PostcodeAnywhereUk, PostcodesIo, SmartyStreets, Telize, Tencent, Test, Twogis, UkOrdnanceSurveyNames, Yandex

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ip_servicesObject

All IP address lookup services, default first.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/geocoder/lookup.rb', line 77

def ip_services
  @ip_services ||= [
    :baidu_ip,
    :abstract_api,
    :freegeoip,
    :geoip2,
    :maxmind,
    :maxmind_local,
    :telize,
    :pointpin,
    :maxmind_geoip2,
    :ipinfo_io,
    :ipregistry,
    :ipapi_com,
    :ipdata_co,
    :db_ip_com,
    :ipstack,
    :ip2location,
    :ipgeolocation,
    :ipqualityscore,
    :ipbase,
    :ip2location_io,
    :ip2location_lite
  ]
end

#street_servicesObject

All street address lookup services, default first.



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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/geocoder/lookup.rb', line 32

def street_services
  @street_services ||= [
    :location_iq,
    :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,
    :pdok_nl,
    :pickpoint,
    :here,
    :baidu,
    :tencent,
    :geocodio,
    :smarty_streets,
    :postcode_anywhere_uk,
    :postcodes_io,
    :geoportail_lu,
    :ban_data_gouv_fr,
    :test,
    :latlon,
    :amap,
    :osmnames,
    :melissa_street,
    :amazon_location_service,
    :geoapify,
    :photon,
    :twogis,
    :pc_miler
  ]
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

#all_services_with_http_requestsObject

Array of valid Lookup service names, excluding any that do not build their own HTTP requests. For example, Amazon Location Service uses the AWS gem, not HTTP REST requests, to fetch data.



25
26
27
# File 'lib/geocoder/lookup.rb', line 25

def all_services_with_http_requests
  all_services_except_test - [:amazon_location_service, :maxmind_local, :geoip2, :ip2location_lite]
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.



110
111
112
113
114
# File 'lib/geocoder/lookup.rb', line 110

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