IPQuery 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/ipquery.rb +37 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5309c5cea242c7fb8aa5d43b92b0bd6d63c474dd4c1814ae1b82ec7ea0a9ad5b
4
+ data.tar.gz: d36e4d0dab590577064aec5850efc84962f1b50a71f4d79c43ba638dc090def1
5
+ SHA512:
6
+ metadata.gz: 1d9524bd3a1c03f0dc6fd69343d76492fb866355d176ffa1bf3313433558b4af8100135dba750079bf71f4fb79c5b7bd6672a0dbf1fb49c115794939ac2180e4
7
+ data.tar.gz: e51d6b7b04b4885f224679315c25ce186da68c6e2d06609b52f79abbf6326b96c530f3f86e204bb32957e2b11dfc5107a0c918c719b6ce5731411651f1eb4547
data/ipquery.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+
5
+ BASE_URL = 'https://api.ipquery.io/'
6
+
7
+ class IPQueryResult
8
+ def initialize(response)
9
+ @ip=response['ip']
10
+ @isp=response['isp']
11
+ @location=response['location']
12
+ @is_mobile=response['risk']['is_mobile']
13
+ @is_vpm=response['risk']['is_vpn']
14
+ @is_tor=response['risk']['is_tor']
15
+ @is_proxy=response['risk']['is_proxy']
16
+ @is_datacenter=response['risk']['is_datacenter']
17
+ @risk_score=response['risk']['risk_score']
18
+ end
19
+ end
20
+
21
+ class IPQuery
22
+ def initialize
23
+
24
+ end
25
+
26
+ def query(ip)
27
+ uri = URI("#{BASE_URL}#{ip}")
28
+
29
+ Net::HTTP.get(uri)
30
+ response = Net::HTTP.get_response(uri)
31
+
32
+ IPQueryResult.new(JSON.parse(response.body)) if response.is_a?(Net::HTTPSuccess)
33
+ rescue StandardError => e
34
+ puts "Error: #{e.message}"
35
+ nil
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: IPQuery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - GoldenVadim
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-12-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The Ruby library for IPQuery
14
+ email: contact@ipquery.io
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ipquery.rb
20
+ homepage: https://rubygems.org/gems/ipquery-ruby
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.5.16
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: IPQuery
43
+ test_files: []