ip2whois_ruby 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +6 -27
- data/lib/ip2whois_ruby/api.rb +6 -10
- data/lib/ip2whois_ruby/version.rb +1 -1
- data/spec/ip2whois_ruby_spec.rb +3 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c80f26849cd185377533e737af6d5be3e65a327631355343aa3e5b10f919c57
|
4
|
+
data.tar.gz: f43caa1ac1cc5463ac6971c0ce1db35751cac34e0db11cf17f4b6af7f0feb777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c810c8714fb83a724a06cabac9e5a53bd1954bd2339e6c64e0e2a98e8bcc98855f478b630364802e484768d5d9596e93c66a2b4b2b3fbf314a8add099875d1dd
|
7
|
+
data.tar.gz: 68fd9622af974b95d4a8ce32da4e8fd8f2c061650a1342f8a8a7e15779ee83dba09a2659800bb9d950c210967d6226e69c7ff2d70c58c37a0254a92688d2876b
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
IP2WHOIS Ruby SDK
|
2
2
|
========================
|
3
|
+
[![Latest Stable Version](https://img.shields.io/gem/v/ip2whois_ruby.svg)](https://rubygems.org/gems/ip2whois_ruby)
|
4
|
+
[![Total Downloads](https://img.shields.io/gem/dt/ip2whois_ruby.svg)](https://rubygems.org/gems/ip2whois_ruby)
|
5
|
+
|
3
6
|
This Ruby module enables user to easily implement the checking of WHOIS information for a particular domain into their solution using the API from https://www.ip2whois.com. It is a WHOIS lookup api that helps users to obtain domain information, WHOIS record, by using a domain name. The WHOIS API returns a comprehensive WHOIS data such as creation date, updated date, expiration date, domain age, the contact information of the registrant, mailing address, phone number, email address, nameservers the domain is using and much more. IP2WHOIS supports the query for [1113 TLDs and 634 ccTLDs](https://www.ip2whois.com/tld-cctld-supported).
|
4
7
|
|
5
8
|
This module requires API key to function. You may sign up for a free API key at https://www.ip2whois.com/register.
|
@@ -10,56 +13,32 @@ Usage Example
|
|
10
13
|
============
|
11
14
|
### Lookup Domain Information
|
12
15
|
|
13
|
-
#### Object Properties
|
14
|
-
|
15
|
-
| Property Name | Property Type | Description |
|
16
|
-
| ------------- | ------------- | ------------------------------------------------------------ |
|
17
|
-
| domain | string | Domain name. |
|
18
|
-
|
19
16
|
```
|
20
17
|
require 'ip2whois_ruby'
|
21
18
|
|
22
19
|
Ip2whoisRuby::Configuration.api_key = 'YOUR_API_KEY'
|
23
20
|
|
24
|
-
result = Ip2whoisRuby::Api.lookup(
|
25
|
-
domain: 'example.com'
|
26
|
-
)
|
21
|
+
result = Ip2whoisRuby::Api.lookup('example.com')
|
27
22
|
```
|
28
23
|
|
29
24
|
|
30
25
|
|
31
26
|
### Convert Normal Text to Punycode
|
32
27
|
|
33
|
-
#### Object Properties
|
34
|
-
|
35
|
-
| Property Name | Property Type | Description |
|
36
|
-
| ------------- | :-----------: | ------------------------------------------------------------ |
|
37
|
-
| domain | string | Domain name. |
|
38
|
-
|
39
28
|
```
|
40
29
|
require 'ip2whois_ruby'
|
41
30
|
|
42
|
-
result = Ip2whoisRuby::Api.get_punycode(
|
43
|
-
domain: 'xn--tst-qla.de'
|
44
|
-
)
|
31
|
+
result = Ip2whoisRuby::Api.get_punycode('xn--tst-qla.de')
|
45
32
|
```
|
46
33
|
|
47
34
|
|
48
35
|
|
49
36
|
### Convert Punycode to Normal Text
|
50
37
|
|
51
|
-
#### Object Properties
|
52
|
-
|
53
|
-
| Property Name | Property Type | Description |
|
54
|
-
| ------------- | :-----------: | ------------------------------------------------------------ |
|
55
|
-
| domain | string | Domain name. |
|
56
|
-
|
57
38
|
```
|
58
39
|
require 'ip2whois_ruby'
|
59
40
|
|
60
|
-
result = Ip2whoisRuby::Api.get_normal_text(
|
61
|
-
domain: 'täst.de'
|
62
|
-
)
|
41
|
+
result = Ip2whoisRuby::Api.get_normal_text('täst.de')
|
63
42
|
```
|
64
43
|
|
65
44
|
|
data/lib/ip2whois_ruby/api.rb
CHANGED
@@ -7,12 +7,8 @@ require_relative "version"
|
|
7
7
|
module Ip2whoisRuby
|
8
8
|
class Api
|
9
9
|
# Lookup domain WHOIS information.
|
10
|
-
def self.lookup(
|
11
|
-
|
12
|
-
params[:format] = 'json'
|
13
|
-
end
|
14
|
-
|
15
|
-
uri = URI.parse("https://api.ip2whois.com/v2?key=" + Ip2whoisRuby::Configuration.api_key + "&format=" + params[:format] + "&domain=" + params[:domain])
|
10
|
+
def self.lookup(domain)
|
11
|
+
uri = URI.parse("https://api.ip2whois.com/v2?key=" + Ip2whoisRuby::Configuration.api_key + "&format=json&domain=" + domain)
|
16
12
|
http = Net::HTTP.new(uri.host, uri.port)
|
17
13
|
http.use_ssl = true
|
18
14
|
request = Net::HTTP::Get.new(uri.request_uri)
|
@@ -27,13 +23,13 @@ module Ip2whoisRuby
|
|
27
23
|
end
|
28
24
|
|
29
25
|
# Get Punycode.
|
30
|
-
def self.get_punycode(
|
31
|
-
return SimpleIDN.to_unicode(
|
26
|
+
def self.get_punycode(domain)
|
27
|
+
return SimpleIDN.to_unicode(domain)
|
32
28
|
end
|
33
29
|
|
34
30
|
# Get Normal text.
|
35
|
-
def self.get_normal_text(
|
36
|
-
return SimpleIDN.to_ascii(
|
31
|
+
def self.get_normal_text(domain)
|
32
|
+
return SimpleIDN.to_ascii(domain)
|
37
33
|
end
|
38
34
|
|
39
35
|
end
|
data/spec/ip2whois_ruby_spec.rb
CHANGED
@@ -3,9 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Ip2whoisRuby" do
|
4
4
|
it "work correctly with domain lookup" do
|
5
5
|
Ip2whoisRuby::Configuration.api_key = $test_api_key
|
6
|
-
result = Ip2whoisRuby::Api.lookup(
|
7
|
-
domain: 'example.c'
|
8
|
-
)
|
6
|
+
result = Ip2whoisRuby::Api.lookup('example.c')
|
9
7
|
data = JSON.parse(result.body)
|
10
8
|
if $test_api_key == 'YOUR_API_KEY'
|
11
9
|
expect(data['error']['error_message']).to eq 'API key not found.'
|
@@ -15,16 +13,12 @@ describe "Ip2whoisRuby" do
|
|
15
13
|
end
|
16
14
|
|
17
15
|
it "work correctly with get punycode" do
|
18
|
-
result = Ip2whoisRuby::Api.get_punycode(
|
19
|
-
domain: 'xn--tst-qla.de'
|
20
|
-
)
|
16
|
+
result = Ip2whoisRuby::Api.get_punycode('xn--tst-qla.de')
|
21
17
|
expect(result).to eq 'täst.de'
|
22
18
|
end
|
23
19
|
|
24
20
|
it "work correctly with get normal text" do
|
25
|
-
result = Ip2whoisRuby::Api.get_normal_text(
|
26
|
-
domain: 'täst.de'
|
27
|
-
)
|
21
|
+
result = Ip2whoisRuby::Api.get_normal_text('täst.de')
|
28
22
|
expect(result).to eq 'xn--tst-qla.de'
|
29
23
|
end
|
30
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ip2whois_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ip2whois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|