ip2location_io_rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 76a2747a858e0c088c2374a0d5f1216bc6c05311e811364e4f2a47e67932e0e8
4
+ data.tar.gz: 0f6e3eb109f677f4417ad0f4aa9ee56240d12428cd6fc4e645b5fa382c82e07c
5
+ SHA512:
6
+ metadata.gz: 934f9760351f2aa9cf07ae0fa4416aa34c521cef1df6952de6b8ba73613a4baad91da49ca21651b5f8cbb190e0b084577e02f15e9f46f6c33255fd07f53fdb51
7
+ data.tar.gz: c21b234ed0f19064c6bd63bc0406123a31804f30e329f308b5292fdf3556c7cd3bee1e2ce2bc95488b417f777b51c4d97ad34a4f2d8b5a984af9525112a504f1
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ip2location_io_rails.gemspec
4
+ gemspec
5
+ gem 'ip2location_io_ruby', ">= 1.0.1"
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2023 - 2024 IP2Location ( support@ip2location.com )
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # IP2Location.io Ruby on Rails Library
2
+ 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.
3
+
4
+ This module requires API key to function. You may sign up for a free API key at https://www.ip2location.io/pricing.
5
+
6
+ ## INSTALLATION
7
+ 1. Add this lines to your application's Gemfile:
8
+ ```ruby
9
+ gem 'ip2location_io_ruby'
10
+ gem 'ip2location_io_rails'
11
+ ```
12
+ 2. Then execute it
13
+ ```bash
14
+ $ bundle install
15
+ ```
16
+ 3. 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.
17
+ ```ruby
18
+ config.ip2location_io_key = 'YOUR_API_KEY'
19
+ ```
20
+
21
+ ## USAGE
22
+ 1. Create a **TestController** using the below command line
23
+ ```bash
24
+ bin/rails generate controller Test index --skip-routes
25
+ ```
26
+ 2. Open the *app/controllers/test_controller.rb* in any text editor.
27
+ 3. Add the below lines into the controller file.
28
+ ```ruby
29
+ require 'ip2location_io_rails'
30
+
31
+ class TestController < ApplicationController
32
+ def index
33
+ location_service = Ip2locationIORails.new('8.8.8.8')
34
+ @location = location_service.location.body
35
+ end
36
+ end
37
+ ```
38
+ 4. Open the *app/views/test/index.html.erb* in any text editor and add the below lines into it.
39
+ ```
40
+ <p>IP2Location.io data for IP 8.8.8.8: <%= @location %></p>
41
+ ```
42
+ 5. Add the following line into the *config/routes.rb* file after the `Rails.application.routes.draw do` line.
43
+ ```ruby
44
+ get "/test", to: "test#index"
45
+ ```
46
+ 6. Restart your development server.
47
+ ```bash
48
+ $ bin/rails server
49
+ ```
50
+ 7. Enter the URL <your domain>/test and run. You should see the proxy information of **8.8.8.8** IP address.
51
+
52
+ ## Support
53
+ Email: support@ip2location.com
54
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ip2location_io_rails'
3
+ s.version = '1.0.0'
4
+ s.required_ruby_version = '>= 2.5.0'
5
+ s.require_paths = ["lib"]
6
+ s.authors = ["ip2location"]
7
+ s.email = ["support@ip2location.com"]
8
+ s.description = "This IP2Location.io Ruby on Rails library allows user to query for an enriched data set based on IP address. It 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."
9
+ s.summary = "IP2Location.io Ruby on Rails library"
10
+ s.homepage = 'https://www.ip2location.io'
11
+ s.licenses = ["MIT"]
12
+ s.files = [
13
+ "LICENSE.txt",
14
+ "Gemfile",
15
+ "README.md",
16
+ "ip2location_io_rails.gemspec",
17
+ "lib/ip2location_io_rails.rb",
18
+ ]
19
+ s.add_runtime_dependency 'ip2location_io_ruby', '>= 1.0.1'
20
+ end
@@ -0,0 +1,13 @@
1
+ require 'ip2location_io_ruby'
2
+
3
+ class Ip2locationIORails
4
+ def initialize(ip_address)
5
+ # @ip_address = ip_address
6
+ IP2LocationIORuby::Configuration.api_key = Rails.configuration.ip2location_io_key
7
+ @i2lio = IP2LocationIORuby::Api::IPGeolocation.lookup(ip_address)
8
+ end
9
+
10
+ def location
11
+ @i2lio
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ip2location_io_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ip2location
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ip2location_io_ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.1
27
+ description: This IP2Location.io Ruby on Rails library allows user to query for an
28
+ enriched data set based on IP address. It enables user to query for an enriched
29
+ data set, such as country, region, district, city, latitude & longitude, ZIP code,
30
+ time zone, ASN, ISP, domain, net speed, IDD code, area code, weather station data,
31
+ MNC, MCC, mobile brand, elevation, usage type, address type, advertisement category
32
+ and proxy data with an IP address. It supports both IPv4 and IPv6 address lookup.
33
+ This module requires API key to function. You may sign up for a free API key at
34
+ https://www.ip2location.io/pricing.
35
+ email:
36
+ - support@ip2location.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - Gemfile
42
+ - LICENSE.txt
43
+ - README.md
44
+ - ip2location_io_rails.gemspec
45
+ - lib/ip2location_io_rails.rb
46
+ homepage: https://www.ip2location.io
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 2.5.0
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.5.23
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: IP2Location.io Ruby on Rails library
69
+ test_files: []