lib/geocoder/lookups/ip2location.rb in geocoder-1.5.2 vs lib/geocoder/lookups/ip2location.rb in geocoder-1.6.0
- old
+ new
@@ -17,15 +17,15 @@
def base_query_url(query)
"#{protocol}://api.ip2location.com/?"
end
def query_url_params(query)
- {
- key: configuration.api_key ? configuration.api_key : "demo",
- format: "json",
- ip: query.sanitized_text
- }.merge(super)
+ params = super
+ if configuration.has_key?(:package)
+ params.merge!(package: configuration[:package])
+ end
+ params
end
def results(query)
# don't look up a loopback or private address, just return the stored result
return [reserved_result(query.text)] if query.internal_ip_address?
@@ -59,17 +59,9 @@
"mnc" => "INVALID IP ADDRESS",
"mobile_brand" => "INVALID IP ADDRESS",
"elevation" => "INVALID IP ADDRESS",
"usage_type" => "INVALID IP ADDRESS"
}
- end
-
- def query_url_params(query)
- params = super
- if configuration.has_key?(:package)
- params.merge!(package: configuration[:package])
- end
- params
end
end
end