module Geoip2
Constants
- VERSION
Attributes
@!attribute base_path
@return [String] the base path on the host to the api
@!attribute host @return [String] the host of MaxMind that you would like to work with
@!attribute license_key
@return [String] the license key that is used to authenticate with MaxMind
@!attribute parallel_requests
@return [Integer String] defines the maximum parallel request for the gem to preform
@!attribute user_id
@return [String] the user id that is used to authenticate with MaxMind
Public Class Methods
@return an instance of Geoip2::Client
# File lib/geoip2.rb, line 46 def client @client ||= Geoip2::Client.new({ host: self.host || 'geoip.maxmind.com', base_path: self.base_path || '/geoip/v2.1', parallel_requests: self.parallel_requests || 5, user_id: self.user_id, license_key: self.license_key }) end
Configuration interface of the gem
@yield [self] to accept configuration settings
# File lib/geoip2.rb, line 29 def configure yield self true end
Makes sure that the method missing is checked with the Geoip2::Client
instance
@param method_name [String] the name of the method we want to run @param include_private [Boolean] defines wether to check for private functions as well
# File lib/geoip2.rb, line 39 def respond_to_missing?(method_name, include_private=false) client.respond_to?(method_name, include_private) end
Private Class Methods
# File lib/geoip2.rb, line 68 def method_missing(method_name, *args, &block) return super unless client.respond_to?(method_name) client.send(method_name, *args, &block) end
executes any function on the Geoip2::Client
instance
@param args [*] any argument that we want to pass to the client function @param block [Block] any block that is passed to the client function
# File lib/geoip2.rb, line 64 def reset_client @client = nil end