jam-cloud/app/controllers/api_maxmind_requests_contro...

32 lines
913 B
Ruby
Raw Normal View History

2013-03-15 04:23:37 +00:00
class ApiMaxmindRequestsController < ApiController
2012-12-15 20:17:41 +00:00
respond_to :json
def regions
regions = MaxMindManager.regions(params[:country])
if regions && regions.length > 0
render :json => { :regions => regions }, :status => 200
else
render :json => { :message => "Unrecognized Country" }, :status => 422
2012-12-15 20:17:41 +00:00
end
end
def cities
cities = MaxMindManager.cities(params[:country], params[:region])
if cities && cities.length > 0
render :json => { :cities => cities }, :status => 200
else
render :json => { :message => "Unrecognzied country or region" }, :status => 422
2012-12-15 20:17:41 +00:00
end
end
def isps
isps = MaxMindManager.isps(params[:country])
if isps && isps.length > 0
render :json => { :isps => isps }, :status => 200
else
render :json => { :message => "Unrecognzied Country" }, :status => 422
end
end
2012-12-15 20:17:41 +00:00
end