Module: Ip2Location

Defined in:
lib/ip2location.rb,
lib/ip2location/base.rb,
lib/ip2location/request.rb,
lib/ip2location/version.rb

Defined Under Namespace

Classes: APIConnectionError, Base, InvalidApiKeyError, Location, NoLocationDataError, Request

Constant Summary collapse

BASE_URI =
"http://api.ip2locationapi.com/"
VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



14
15
16
# File 'lib/ip2location.rb', line 14

def api_key
  @api_key
end

.userObject

Returns the value of attribute user.



14
15
16
# File 'lib/ip2location.rb', line 14

def user
  @user
end

Class Method Details

.request(ip) ⇒ Object Also known as: ip2l



20
21
22
# File 'lib/ip2location.rb', line 20

def request(ip)
  Ip2Location::Request.ip2l(ip)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Ip2Location)

    the object that the method was called on



16
17
18
# File 'lib/ip2location.rb', line 16

def setup
  yield self if block_given?
end