module Geoip2

Constants

VERSION

Attributes

base_path[RW]

@!attribute base_path @return [String] the base path on the host to the api

geoip_client[R]
host[RW]

@!attribute host @return [String] the host of MaxMind that you would like to work with

license_key[RW]

@!attribute license_key @return [String] the license key that is used to authenticate with MaxMind

parallel_requests[RW]

@!attribute parallel_requests @return [Integer String] defines the maximum parallel request for the gem to preform

user_id[RW]

@!attribute user_id @return [String] the user id that is used to authenticate with MaxMind

Public Class Methods

client() click to toggle source

@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
configure() { |self| ... } click to toggle source

Configuration interface of the gem

@yield [self] to accept configuration settings

# File lib/geoip2.rb, line 29
def configure
  yield self
  true
end
respond_to_missing?(method_name, include_private=false) click to toggle source

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

method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# 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
reset_client() click to toggle source

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