ipinfoapi 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/ipinfoapi.rb +54 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4369e12ab655cc3332229f63e8649223f27fc08e17f6cbe81d496523dc2d2670
4
+ data.tar.gz: c91621653e17210ab76233a961428a87ef80862c10c20ef67bbc8e3e884c96fe
5
+ SHA512:
6
+ metadata.gz: f94a3229aae9637761d7fb136766526430bdc32ececca1c1cdeb4af878a0fcfdb2664a64cb9f8690a0d2c3c23fae7a9e7843f4ddeea9f26373b6bc1fc6cac36b
7
+ data.tar.gz: 9db749f2025274280d4610b12a20087c11ea27183f7928612df17adccd2d1bd13469e89aaaaffe8a2b992816c2689506776709a37959a8ce08d65ef5a2dae4ea
data/ipinfoapi.rb ADDED
@@ -0,0 +1,54 @@
1
+ require 'net/http'
2
+ require "json"
3
+ class IPinfo
4
+ def initialize(id)
5
+ @id = id
6
+ url = URI.parse("http://ip-api.com/json/#{@id}")
7
+ req = Net::HTTP::Get.new(url.to_s)
8
+ res = Net::HTTP.start(url.host, url.port) {|http|
9
+ http.request(req)
10
+ }
11
+ @@re1 = JSON.parse(res.body)
12
+ end
13
+ def country
14
+ return @@re1['country']
15
+ end
16
+ def countryCode
17
+ return @@re1['countryCode']
18
+ end
19
+ def region
20
+ return @@re1['region']
21
+ end
22
+ def regionName
23
+ return @@re1['regionName']
24
+ end
25
+ def city
26
+ return @@re1['city']
27
+ end
28
+ def zip
29
+ return @@re1['zip']
30
+ end
31
+ def lat
32
+ return @@re1['lat']
33
+ end
34
+ def lon
35
+ return @@re1['lon']
36
+ end
37
+ def timezone
38
+ return @@re1['timezone']
39
+ end
40
+ def isp
41
+ return @@re1['isp']
42
+ end
43
+ def org
44
+ return @@re1['org']
45
+ end
46
+ def as
47
+ return @@re1['as']
48
+ end
49
+ def query
50
+ return @@re1['query']
51
+ end
52
+
53
+ end
54
+
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipinfoapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - NimaCpp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-02-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: information about ip
14
+ email: swithwebb31@email.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ipinfoapi.rb
20
+ homepage: https://github.com/nimacpp
21
+ licenses:
22
+ - OML
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.1.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: info ip
43
+ test_files: []