Skip to content
Snippets Groups Projects
Commit 771b1d0b authored by Jason Waldrip's avatar Jason Waldrip Committed by Thu Trang Pham
Browse files

Support for custom telize endpoint (#1007)

* Support for a custom telize endpoint

* fix path
parent df0aaa6c
No related branches found
No related tags found
No related merge requests found
......@@ -9,15 +9,22 @@ module Geocoder::Lookup
end
def required_api_key_parts
["key"]
configuration[:host] ? [] : ["key"]
end
def query_url(query)
"#{protocol}://telize-v1.p.mashape.com/geoip/#{query.sanitized_text}?mashape-key=#{api_key}"
if configuration[:host]
"#{protocol}://#{configuration[:host]}/geoip/#{query.sanitized_text}"
else
"#{protocol}://telize-v1.p.mashape.com/geoip/#{query.sanitized_text}?mashape-key=#{api_key}"
end
end
def supported_protocols
[:https]
[].tap do |array|
array << :https
array << :http if configuration[:host]
end
end
private # ---------------------------------------------------------------
......@@ -43,5 +50,6 @@ module Geocoder::Lookup
def api_key
configuration.api_key
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment