Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ip2location_io_rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip2location_io_rails

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

IP2Location.io Ruby on Rails Library

This IP2Location.io Ruby on Rails library enables user to query for an enriched data set, such as country, region, district, city, latitude & longitude, ZIP code, time zone, ASN, ISP, domain, net speed, IDD code, area code, weather station data, MNC, MCC, mobile brand, elevation, usage type, address type, advertisement category and proxy data with an IP address. It supports both IPv4 and IPv6 address lookup.

This module requires API key to function. You may sign up for a free API key at https://www.ip2location.io/pricing.

INSTALLATION

  1. Add this lines to your application's Gemfile:
gem 'ip2location_io_ruby'
gem 'ip2location_io_rails'
  1. Then execute it
$ bundle install
  1. Open the preferred file in the config/environments directory. Add the following code to the chosen configuration file after the Rails.application.configure do line.
config.ip2location_io_key = 'YOUR_API_KEY'

USAGE

  1. Create a TestController using the below command line
bin/rails generate controller Test index --skip-routes
  1. Open the app/controllers/test_controller.rb in any text editor.
  2. Add the below lines into the controller file.
require 'ip2location_io_rails'

class TestController < ApplicationController
  def index
    location_service = Ip2locationIORails.new('8.8.8.8')
    @location = location_service.location.body
  end
end
  1. Open the app/views/test/index.html.erb in any text editor and add the below lines into it.
<p>IP2Location.io data for IP 8.8.8.8: <%= @location %></p>
  1. Add the following line into the config/routes.rb file after the Rails.application.routes.draw do line.
get "/test", to: "test#index"
  1. Restart your development server.
$ bin/rails server
  1. Enter the URL /test and run. You should see the proxy information of 8.8.8.8 IP address.

Support

Email: support@ip2location.com URL: https://www.ip2location.com

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc