Class: Geocoder::Lookup::IpapiCom
- Inherits:
-
Base
- Object
- Base
- Geocoder::Lookup::IpapiCom
show all
- Defined in:
- lib/geocoder/lookups/ipapi_com.rb
Instance Method Summary
collapse
Methods inherited from Base
#cache, #handle, #initialize, #map_link_url, #required_api_key_parts, #search
Instance Method Details
#name ⇒ Object
7
8
9
|
# File 'lib/geocoder/lookups/ipapi_com.rb', line 7
def name
"ip-api.com"
end
|
#query_url(query) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/geocoder/lookups/ipapi_com.rb', line 11
def query_url(query)
domain = configuration.api_key ? "pro.ip-api.com" : "ip-api.com"
url_ = "#{protocol}://#{domain}/json/#{query.sanitized_text}"
if (params = url_query_string(query)) && !params.empty?
url_ + "?" + params
else
url_
end
end
|
#supported_protocols ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/geocoder/lookups/ipapi_com.rb', line 22
def supported_protocols
if configuration.api_key
[:http, :https]
else
[:http]
end
end
|