Sha256: 18dfda414d8ddd67f8d11537aa275967fabb154c25e651a80a7cc3d591011d06
Contents?: true
Size: 876 Bytes
Versions: 11
Compression:
Stored size: 876 Bytes
Contents
# encoding: utf-8 require 'geocoder/lookups/base' require 'geocoder/results/abstract_api' module Geocoder::Lookup class AbstractApi < Base def name "Abstract API" end def required_api_key_parts ['api_key'] end def supported_protocols [:https] end private # --------------------------------------------------------------- def base_query_url(query) "#{protocol}://ipgeolocation.abstractapi.com/v1/?" end def query_url_params(query) params = {api_key: configuration.api_key} ip_address = query.sanitized_text if ip_address.is_a?(String) && ip_address.length > 0 params[:ip_address] = ip_address end params.merge(super) end def results(query, reverse = false) if doc = fetch_data(query) [doc] else [] end end end end
Version data entries
11 entries across 11 versions & 1 rubygems