Module: Mxmnd

Defined in:
lib/mxmnd.rb

Defined Under Namespace

Classes: BadRequest, ClientError, Forbidden, NotFound, PaymentRequired, ServerError, Unauthorized

Constant Summary collapse

VERSION =
'0.1.0'
BASE_URL =
'https://geoip.maxmind.com'.freeze
BASE_PATH =
'/geoip/v2.1'.freeze
USER_ID_ENV_KEY =
'MAX_MIND_USER_ID'.freeze
LICENSE_KEY_ENV_KEY =
'MAX_MIND_LICENSE_KEY'.freeze

Class Method Summary collapse

Class Method Details

.city(ip, faraday_options = {}) ⇒ Object

Raises:



12
13
14
15
16
# File 'lib/mxmnd.rb', line 12

def city(ip, faraday_options = {})
  raise BadRequest.new('IP_ADDRESS_REQUIRED', 'You have not passed IP address.') unless ip
  path = "/city/#{ip}"
  get(connection(faraday_options), path)
end