class Freegeoip::Request

Constants

ENDPOINT
FORMAT

Attributes

remote[R]

Public Class Methods

new(remote) click to toggle source
# File lib/freegeoip/request.rb, line 12
def initialize(remote)
  @remote = remote
end

Public Instance Methods

get() click to toggle source
# File lib/freegeoip/request.rb, line 16
def get
  uri = URI(ENDPOINT + FORMAT + "/" + remote)
  res = Net::HTTP.get(uri)

  JSON.parse(res)
end