Module: Geoip2
- Defined in:
- lib/geoip2.rb,
lib/geoip2/client.rb,
lib/geoip2/version.rb,
lib/geoip2/api/city.rb,
lib/geoip2/api/omni.rb,
lib/geoip2/api/country.rb,
lib/geoip2/api/insights.rb,
lib/geoip2/api/city_isp_org.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.0.3'
Class Attribute Summary collapse
-
.base_path ⇒ String
The base path on the host to the api.
-
.host ⇒ String
The host of MaxMind that you would like to work with.
-
.license_key ⇒ String
The license key that is used to authenticate with MaxMind.
-
.parallel_requests ⇒ Integer String
Defines the maximum parallel request for the gem to preform.
-
.user_id ⇒ String
The user id that is used to authenticate with MaxMind.
Class Method Summary collapse
-
.client ⇒ Object
An instance of Geoip2::Client.
-
.configure {|self| ... } ⇒ Object
Configuration interface of the gem.
-
.respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Makes sure that the method missing is checked with the Geoip2::Client instance.
Class Attribute Details
.base_path ⇒ String
Returns the base path on the host to the api.
12 13 14 |
# File 'lib/geoip2.rb', line 12 def base_path @base_path end |
.host ⇒ String
Returns the host of MaxMind that you would like to work with.
8 9 10 |
# File 'lib/geoip2.rb', line 8 def host @host end |
.license_key ⇒ String
Returns the license key that is used to authenticate with MaxMind.
24 25 26 |
# File 'lib/geoip2.rb', line 24 def license_key @license_key end |
.parallel_requests ⇒ Integer String
Returns defines the maximum parallel request for the gem to preform.
16 17 18 |
# File 'lib/geoip2.rb', line 16 def parallel_requests @parallel_requests end |
.user_id ⇒ String
Returns the user id that is used to authenticate with MaxMind.
20 21 22 |
# File 'lib/geoip2.rb', line 20 def user_id @user_id end |
Class Method Details
.client ⇒ Object
Returns an instance of Geoip2::Client.
46 47 48 49 50 51 52 53 54 |
# 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| ... } ⇒ Object
Configuration interface of the gem
29 30 31 32 |
# File 'lib/geoip2.rb', line 29 def configure yield self true end |
.respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Makes sure that the method missing is checked with the Geoip2::Client instance
39 40 41 |
# File 'lib/geoip2.rb', line 39 def respond_to_missing?(method_name, include_private=false) client.respond_to?(method_name, include_private) end |