ip2whois_ruby 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b5515941002143932ddab3ea511671a86f91d1e6b61c815c181becc77c8d2b6
4
- data.tar.gz: 03b47c2d4ecd0828bef1bc9ea0716a42ec8b08d8a60bb1dfb44d0bc97018860c
3
+ metadata.gz: 572b8d5cbbbfbe124bc9085478bb71df9d7eddae0ebd6be5f53daf0cd97663a2
4
+ data.tar.gz: 449be24e42acbb1ca8f4eeedec41889a782ac5e0cb5ae7fde5f41e64affcc1a5
5
5
  SHA512:
6
- metadata.gz: 916eb9244596f353660a52b1fd8bed5e74196c075de1811453d27d74efa96a12b2810e7598ab6968b6ab00568ccfb007b0d00169cbfa36e5c02d668a4bd7f6e2
7
- data.tar.gz: ade4171fd59cc3ee12bc8555659caabbc3ab247ece51b6196b54d25dbd450235a9cc9de1ad84a5107f12d543831708a6fff345e3c2c63e8fe610cf7bf1f5c015
6
+ metadata.gz: 9325d95580def5a4c90b6a89b817724e4641f51aa6c7b5c1dcedb51a3456a176f5cb9ede0b295859024b2b147fd157ec411cbaf961e66261ca36fd73e99bdfef
7
+ data.tar.gz: 85a692e22078a2676efacee42396312f40573ac1b7ad1efbc5cf2994cba1d94b32f4f7a3658b78ff82b307674c5e9e0cfc9aca9556f9babe56f12b6b2c259090
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in ip2whois_ruby.gemspec
6
- gemspec
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in ip2whois_ruby.gemspec
6
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 IP2WHOIS.com
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 IP2WHOIS.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,48 +1,181 @@
1
- IP2WHOIS Ruby SDK
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
-
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).
7
-
8
- This module requires API key to function. You may sign up for a free API key at https://www.ip2whois.com/register.
9
-
10
-
11
-
12
- Usage Example
13
- ============
14
- ### Lookup Domain Information
15
-
16
- ```
17
- require 'ip2whois_ruby'
18
-
19
- Ip2whoisRuby::Configuration.api_key = 'YOUR_API_KEY'
20
-
21
- result = Ip2whoisRuby::Api.lookup('example.com')
22
- ```
23
-
24
-
25
-
26
- ### Convert Normal Text to Punycode
27
-
28
- ```
29
- require 'ip2whois_ruby'
30
-
31
- result = Ip2whoisRuby::Api.get_punycode('täst.de')
32
- ```
33
-
34
-
35
-
36
- ### Convert Punycode to Normal Text
37
-
38
- ```
39
- require 'ip2whois_ruby'
40
-
41
- result = Ip2whoisRuby::Api.get_normal_text('xn--tst-qla.de')
42
- ```
43
-
44
-
45
-
46
- LICENCE
47
- =====================
48
- See the LICENSE file.
1
+ IP2WHOIS Ruby SDK
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
+
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).
7
+
8
+ This module requires API key to function. You may sign up for a free API key at https://www.ip2whois.com/register.
9
+
10
+
11
+ Usage Example
12
+ ============
13
+ ### Lookup Domain Information
14
+ ```ruby
15
+ require 'ip2whois_ruby'
16
+
17
+ Ip2whoisRuby::Configuration.api_key = 'YOUR_API_KEY'
18
+
19
+ result = Ip2whoisRuby::Api.lookup('example.com')
20
+ ```
21
+
22
+ ### Convert Normal Text to Punycode
23
+ ```ruby
24
+ require 'ip2whois_ruby'
25
+
26
+ result = Ip2whoisRuby::Api.get_punycode('täst.de')
27
+ ```
28
+
29
+ ### Convert Punycode to Normal Text
30
+ ```ruby
31
+ require 'ip2whois_ruby'
32
+
33
+ result = Ip2whoisRuby::Api.get_normal_text('xn--tst-qla.de')
34
+ ```
35
+
36
+ ### Get Domain Name
37
+ ```ruby
38
+ require 'ip2whois_ruby'
39
+
40
+ # Get domain name from URL
41
+ result = Ip2whoisRuby::Api.get_domain_name('https://www.example.com/exe')
42
+ ```
43
+
44
+ ### Get Domain Extension
45
+ ```ruby
46
+ require 'ip2whois_ruby'
47
+
48
+ # Get domain extension (gTLD or ccTLD) from URL or domain name
49
+ result = Ip2whoisRuby::Api.get_domain_extension('example.com')
50
+ ```
51
+
52
+
53
+ Response Parameter
54
+ ============
55
+ ### Lookup function
56
+ | Parameter | Type | Description |
57
+ |---|---|---|
58
+ |domain|string|Domain name.|
59
+ |domain_id|string|Domain name ID.|
60
+ |status|string|Domain name status.|
61
+ |create_date|string|Domain name creation date.|
62
+ |update_date|string|Domain name updated date.|
63
+ |expire_date|string|Domain name expiration date.|
64
+ |domain_age|integer|Domain name age in day(s).|
65
+ |whois_server|string|WHOIS server name.|
66
+ |registrar.iana_id|string|Registrar IANA ID.|
67
+ |registrar.name|string|Registrar name.|
68
+ |registrar.url|string|Registrar URL.|
69
+ |registrant.name|string|Registrant name.|
70
+ |registrant.organization|string|Registrant organization.|
71
+ |registrant.street_address|string|Registrant street address.|
72
+ |registrant.city|string|Registrant city.|
73
+ |registrant.region|string|Registrant region.|
74
+ |registrant.zip_code|string|Registrant ZIP Code.|
75
+ |registrant.country|string|Registrant country.|
76
+ |registrant.phone|string|Registrant phone number.|
77
+ |registrant.fax|string|Registrant fax number.|
78
+ |registrant.email|string|Registrant email address.|
79
+ |admin.name|string|Admin name.|
80
+ |admin.organization|string|Admin organization.|
81
+ |admin.street_address|string|Admin street address.|
82
+ |admin.city|string|Admin city.|
83
+ |admin.region|string|Admin region.|
84
+ |admin.zip_code|string|Admin ZIP Code.|
85
+ |admin.country|string|Admin country.|
86
+ |admin.phone|string|Admin phone number.|
87
+ |admin.fax|string|Admin fax number.|
88
+ |admin.email|string|Admin email address.|
89
+ |tech.name|string|Tech name.|
90
+ |tech.organization|string|Tech organization.|
91
+ |tech.street_address|string|Tech street address.|
92
+ |tech.city|string|Tech city.|
93
+ |tech.region|string|Tech region.|
94
+ |tech.zip_code|string|Tech ZIP Code.|
95
+ |tech.country|string|Tech country.|
96
+ |tech.phone|string|Tech phone number.|
97
+ |tech.fax|string|Tech fax number.|
98
+ |tech.email|string|Tech email address.|
99
+ |billing.name|string|Billing name.|
100
+ |billing.organization|string|Billing organization.|
101
+ |billing.street_address|string|Billing street address.|
102
+ |billing.city|string|Billing city.|
103
+ |billing.region|string|Billing region.|
104
+ |billing.zip_code|string|Billing ZIP Code.|
105
+ |billing.country|string|Billing country.|
106
+ |billing.phone|string|Billing phone number.|
107
+ |billing.fax|string|Billing fax number.|
108
+ |billing.email|string|Billing email address.|
109
+ |name_servers|array|Name servers|
110
+
111
+ ```json
112
+ {
113
+ "domain": "greendot.com",
114
+ "domain_id": "600750_DOMAIN_COM-VRSN",
115
+ "status": "registered",
116
+ "create_date": "1997-11-03T00:00:00Z",
117
+ "update_date": "2019-10-29T01:25:57Z",
118
+ "expire_date": "2021-11-02T05:00:00Z",
119
+ "domain_age": 9027,
120
+ "whois_server": "whois.corporatedomains.com",
121
+ "registrar": {
122
+ "iana_id": "299",
123
+ "name": "CSC CORPORATE DOMAINS, INC.",
124
+ "url": "www.cscprotectsbrands.com"
125
+ },
126
+ "registrant": {
127
+ "name": "Admin Role",
128
+ "organization": "Green Dot Corporation",
129
+ "street_address": "",
130
+ "city": "Pasadena",
131
+ "region": "CA",
132
+ "zip_code": "91107",
133
+ "country": "US",
134
+ "phone": "+1.8664120548",
135
+ "fax": "+1.8664120548",
136
+ "email": "adminrole@greendotcorp.com"
137
+ },
138
+ "admin": {
139
+ "name": "Admin Role",
140
+ "organization": "Green Dot Corporation",
141
+ "street_address": "",
142
+ "city": "Pasadena",
143
+ "region": "CA",
144
+ "zip_code": "91107",
145
+ "country": "US",
146
+ "phone": "+1.8664120548",
147
+ "fax": "+1.8664120548",
148
+ "email": "adminrole@greendotcorp.com"
149
+ },
150
+ "tech": {
151
+ "name": "Admin Role",
152
+ "organization": "Green Dot Corporation",
153
+ "street_address": "",
154
+ "city": "Pasadena",
155
+ "region": "CA",
156
+ "zip_code": "91107",
157
+ "country": "US",
158
+ "phone": "+1.8664120548",
159
+ "fax": "+1.8664120548",
160
+ "email": "adminrole@greendotcorp.com"
161
+ },
162
+ "billing": {
163
+ "name": "",
164
+ "organization": "",
165
+ "street_address": "",
166
+ "city": "",
167
+ "region": "",
168
+ "zip_code": "",
169
+ "country": "",
170
+ "phone": "",
171
+ "fax": "",
172
+ "email": ""
173
+ },
174
+ "nameservers": "ns1.greendotdns.com, ns2.greendotdns.com"
175
+ }
176
+ ```
177
+
178
+
179
+ LICENCE
180
+ =====================
181
+ See the LICENSE file.
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -1,40 +1,40 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path("../lib", __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "ip2whois_ruby/version"
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "ip2whois_ruby"
9
- s.version = Ip2whoisRuby::VERSION
10
- s.authors = ["ip2whois"]
11
- s.email = ["support@ip2whois.com"]
12
- s.summary = "IP2WHOIS Ruby SDK"
13
- s.description = "A Ruby SDK enables user to easily implement the checking of WHOIS information for a particular domain into their solution using the API from www.ip2whois.com"
14
- s.homepage = "https://github.com/ip2whois/ip2whois-ruby"
15
- s.licenses = ["MIT"]
16
- s.require_paths = ["lib"]
17
- s.extra_rdoc_files = [
18
- "LICENSE.txt",
19
- "README.md"
20
- ]
21
- s.files = [
22
- "Gemfile",
23
- "LICENSE.txt",
24
- "README.md",
25
- "Rakefile",
26
- "ip2whois_ruby.gemspec",
27
- "lib/ip2whois_ruby.rb",
28
- "lib/ip2whois_ruby/api.rb",
29
- "lib/ip2whois_ruby/configuration.rb",
30
- "lib/ip2whois_ruby/version.rb",
31
- "spec/spec_helper.rb",
32
- "spec/ip2whois_ruby_spec.rb"
33
- ]
34
-
35
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
36
- s.add_runtime_dependency(%q<simpleidn>, [">= 0.2.1"])
37
- else
38
- s.add_dependency(%q<simpleidn>, [">= 0.2.1"])
39
- end
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "ip2whois_ruby/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "ip2whois_ruby"
9
+ s.version = Ip2whoisRuby::VERSION
10
+ s.authors = ["ip2whois"]
11
+ s.email = ["support@ip2whois.com"]
12
+ s.summary = "IP2WHOIS Ruby SDK"
13
+ s.description = "A Ruby SDK enables user to easily implement the checking of WHOIS information for a particular domain into their solution using the API from www.ip2whois.com"
14
+ s.homepage = "https://github.com/ip2whois/ip2whois-ruby"
15
+ s.licenses = ["MIT"]
16
+ s.require_paths = ["lib"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "ip2whois_ruby.gemspec",
27
+ "lib/ip2whois_ruby.rb",
28
+ "lib/ip2whois_ruby/api.rb",
29
+ "lib/ip2whois_ruby/configuration.rb",
30
+ "lib/ip2whois_ruby/version.rb",
31
+ "spec/spec_helper.rb",
32
+ "spec/ip2whois_ruby_spec.rb"
33
+ ]
34
+
35
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
36
+ s.add_runtime_dependency(%q<simpleidn>, [">= 0.2.1"])
37
+ else
38
+ s.add_dependency(%q<simpleidn>, [">= 0.2.1"])
39
+ end
40
40
  end
@@ -8,7 +8,7 @@ module Ip2whoisRuby
8
8
  class Api
9
9
  # Lookup domain WHOIS information.
10
10
  def self.lookup(domain)
11
- uri = URI.parse("https://api.ip2whois.com/v2?key=" + Ip2whoisRuby::Configuration.api_key + "&format=json&domain=" + domain)
11
+ uri = URI.parse("https://api.ip2whois.com/v2?key=" + Ip2whoisRuby::Configuration.api_key + "&format=json&domain=" + domain + "&source=sdk-ruby&source_version=" + Ip2whoisRuby::VERSION)
12
12
  http = Net::HTTP.new(uri.host, uri.port)
13
13
  http.use_ssl = true
14
14
  request = Net::HTTP::Get.new(uri.request_uri)
@@ -24,12 +24,44 @@ module Ip2whoisRuby
24
24
 
25
25
  # Get Punycode.
26
26
  def self.get_punycode(domain)
27
- return SimpleIDN.to_ascii(domain)
27
+ return SimpleIDN.to_ascii(domain)
28
28
  end
29
29
 
30
30
  # Get Normal text.
31
31
  def self.get_normal_text(domain)
32
- return SimpleIDN.to_unicode(domain)
32
+ return SimpleIDN.to_unicode(domain)
33
+ end
34
+
35
+ # Get domain name from a URL.
36
+ def self.get_domain_name(url)
37
+ tlds = [".aaa",".aarp",".abarth",".abbott",".abbvie",".abc",".able",".abogado",".abudhabi",".academy",".accountant",".accountants",".aco",".actor",".adac",".ads",".adult",".aeg",".aero",".aetna",".afamilycompany",".afl",".agakhan",".agency",".aig",".airbus",".airforce",".airtel",".akdn",".alfaromeo",".alibaba",".alipay",".allfinanz",".allstate",".ally",".alsace",".americanexpress",".americanfamily",".amex",".amfam",".amica",".amsterdam",".analytics",".android",".anquan",".anz",".apartments",".app",".apple",".aquarelle",".arab",".aramco",".archi",".army",".art",".arte",".asda",".asia",".associates",".athleta",".attorney",".auction",".audi",".audible",".audio",".auspost",".author",".auto",".autos",".avianca",".aws",".axa",".azure",".baby",".baidu",".band",".bank",".bar",".barcelona",".barclaycard",".barclays",".barefoot",".bargains",".bauhaus",".bayern",".bbc",".bbt",".bbva",".bcg",".bcn",".beats",".beauty",".beer",".bentley",".berlin",".best",".bestbuy",".bet",".bible",".bid",".bike",".bingo",".bio",".biz",".black",".blackfriday",".blockbuster",".blog",".blue",".bms",".bmw",".bnpparibas",".boats",".boehringer",".bofa",".bom",".bond",".boo",".book",".bosch",".bostik",".bot",".boutique",".bradesco",".bridgestone",".broadway",".broker",".brother",".brussels",".bugatti",".build",".builders",".business",".buy",".buzz",".bzh",".cab",".cafe",".cal",".call",".cam",".camera",".camp",".cancerresearch",".canon",".capetown",".capital",".capitalone",".car",".cards",".care",".career",".careers",".cars",".casa",".cash",".casino",".cat",".catering",".cba",".cbs",".ceb",".center",".ceo",".cern",".cfa",".cfd",".chanel",".channel",".chat",".cheap",".chintai",".christmas",".chrome",".chrysler",".church",".cipriani",".city",".cityeats",".claims",".cleaning",".click",".clinic",".clinique",".clothing",".cloud",".club",".clubmed",".coach",".codes",".coffee",".college",".cologne",".com",".comcast",".commbank",".community",".company",".compare",".computer",".comsec",".condos",".construction",".consulting",".contact",".contractors",".cooking",".cookingchannel",".cool",".coop",".corsica",".country",".coupon",".coupons",".credit",".creditcard",".creditunion",".cricket",".cruises",".csc",".cuisinella",".cymru",".cyou",".dabur",".dad",".dance",".date",".dating",".datsun",".day",".dclk",".dds",".deal",".deals",".degree",".delivery",".dell",".deloitte",".delta",".democrat",".dental",".dentist",".desi",".design",".dev",".dhl",".diamonds",".diet",".digital",".direct",".directory",".discount",".dish",".diy",".dk",".dnp",".docs",".doctor",".dodge",".dog",".domains",".dot",".download",".drive",".dtv",".dubai",".duck",".dunlop",".durban",".dvag",".earth",".eat",".eco",".edeka",".edu",".education",".email",".emerck",".energy",".engineer",".engineering",".enterprises",".epson",".equipment",".ericsson",".erni",".esq",".estate",".esurance",".eurovision",".eus",".events",".everbank",".exchange",".expert",".exposed",".express",".extraspace",".fage",".fail",".fairwinds",".faith",".family",".fan",".fans",".farm",".farmers",".fashion",".fast",".fedex",".feedback",".ferrari",".ferrero",".fiat",".fidelity",".film",".final",".finance",".financial",".fire",".firestone",".firmdale",".fish",".fishing",".fit",".fitness",".flickr",".flights",".flir",".florist",".flowers",".fly",".foo",".foodnetwork",".football",".ford",".forex",".forsale",".forum",".foundation",".fox",".free",".fresenius",".frl",".frogans",".frontdoor",".frontier",".ftr",".fujitsu",".fujixerox",".fun",".fund",".furniture",".futbol",".fyi",".gal",".gallery",".gallo",".gallup",".game",".games",".gap",".garden",".gbiz",".gdn",".gea",".gent",".genting",".george",".ggee",".gift",".gifts",".gives",".giving",".glade",".glass",".gle",".global",".globo",".gmail",".gmbh",".gmo",".gmx",".godaddy",".gold",".goldpoint",".golf",".goo",".goodyear",".goog",".google",".gop",".got",".grainger",".graphics",".gratis",".green",".gripe",".group",".guge",".guide",".guitars",".guru",".hamburg",".hangout",".haus",".hbo",".hdfc",".hdfcbank",".health",".healthcare",".help",".helsinki",".here",".hermes",".hgtv",".hiphop",".hisamitsu",".hitachi",".hiv",".hkt",".hockey",".holdings",".holiday",".homedepot",".homegoods",".homes",".homesense",".honda",".horse",".hospital",".host",".hosting",".hot",".hoteles",".house",".how",".hsbc",".hughes",".hyundai",".ibm",".icbc",".ice",".icu",".ieee",".ifm",".ikano",".imamat",".imdb",".immo",".immobilien",".industries",".infiniti",".info",".ing",".ink",".institute",".insurance",".insure",".int",".international",".intuit",".investments",".irish",".iselect",".ismaili",".ist",".istanbul",".it",".itau",".itv",".jaguar",".java",".jcb",".jcp",".jeep",".jetzt",".jewelry",".jll",".jmp",".jnj",".jobs",".joburg",".jot",".joy",".jpmorgan",".jprs",".juegos",".juniper",".kaufen",".kddi",".kerryhotels",".kerrylogistics",".kerryproperties",".kfh",".kia",".kim",".kinder",".kindle",".kitchen",".kiwi",".koeln",".komatsu",".kosher",".kpmg",".kpn",".kred",".kuokgroup",".kyoto",".lacaixa",".ladbrokes",".lamborghini",".lamer",".lancaster",".lancia",".lancome",".land",".landrover",".lasalle",".lat",".latino",".latrobe",".law",".lawyer",".lds",".lease",".leclerc",".lefrak",".legal",".lego",".lexus",".lgbt",".liaison",".lidl",".life",".lifeinsurance",".lifestyle",".lighting",".like",".lilly",".limited",".limo",".lincoln",".linde",".link",".lipsy",".live",".lixil",".loan",".loans",".locker",".locus",".loft",".logs",".lol",".london",".lotte",".lotto",".love",".lpl",".lplfinancial",".ltd",".ltda",".lundbeck",".luxe",".luxury",".macys",".madrid",".maison",".makeup",".man",".management",".mango",".market",".marketing",".markets",".marriott",".maserati",".mba",".mckinsey",".med",".media",".meet",".meme",".memorial",".men",".menu",".metlife",".miami",".mini",".mit",".mitsubishi",".mlb",".mls",".mma",".mobi",".moda",".moe",".moi",".mom",".monash",".money",".mopar",".mormon",".mortgage",".moscow",".motorcycles",".mov",".movie",".movistar",".mtn",".mtr",".museum",".mutual",".nab",".nadex",".nagoya",".name",".nationwide",".natura",".navy",".nba",".nec",".net",".netbank",".netflix",".network",".neustar",".new",".news",".next",".nextdirect",".nexus",".nfl",".ngo",".nhk",".nico",".nike",".nikon",".ninja",".nissan",".nissay",".nokia",".northwesternmutual",".norton",".now",".nowruz",".nowtv",".nra",".nrw",".ntt",".nyc",".obi",".off",".okinawa",".olayan",".olayangroup",".oldnavy",".ollo",".omega",".one",".ong",".onl",".online",".onyourside",".ooo",".oracle",".orange",".org",".organic",".origins",".osaka",".otsuka",".ott",".ovh",".page",".panasonic",".paris",".pars",".partners",".parts",".party",".passagens",".pay",".pccw",".pet",".pfizer",".philips",".photo",".photography",".photos",".physio",".pics",".pictures",".pid",".pin",".ping",".pink",".pioneer",".pizza",".pl",".place",".play",".playstation",".plumbing",".plus",".pnc",".pohl",".poker",".politie",".porn",".post",".pramerica",".praxi",".press",".prime",".pro",".prod",".productions",".prof",".progressive",".promo",".properties",".property",".protection",".pru",".prudential",".pub",".pwc",".qpon",".quebec",".quest",".qvc",".racing",".radio",".raid",".read",".realestate",".realtor",".realty",".recipes",".red",".redstone",".redumbrella",".rehab",".reise",".reisen",".reit",".rent",".rentals",".repair",".report",".republican",".rest",".restaurant",".review",".reviews",".rexroth",".rich",".richardli",".ricoh",".rightathome",".rio",".rip",".rocher",".rocks",".rodeo",".room",".rsvp",".ruhr",".run",".rwe",".ryukyu",".saarland",".safe",".sakura",".sale",".salon",".samsclub",".samsung",".sandvik",".sandvikcoromant",".sanofi",".sap",".sarl",".sas",".save",".sbi",".sbs",".sca",".scb",".schaeffler",".schmidt",".scholarships",".school",".schule",".schwarz",".science",".scjohnson",".scor",".scot",".seat",".secure",".security",".seek",".select",".services",".ses",".seven",".sew",".sex",".sexy",".sfr",".sh",".shangrila",".sharp",".shell",".shia",".shiksha",".shoes",".shop",".shopping",".shouji",".show",".showtime",".shriram",".silk",".sina",".singles",".site",".ski",".skin",".sky",".skype",".sling",".smart",".smile",".sncf",".soccer",".social",".softbank",".software",".solar",".solutions",".song",".sony",".soy",".space",".spot",".spreadbetting",".srl",".srt",".stada",".staples",".star",".starhub",".statebank",".statefarm",".stc",".stcgroup",".stockholm",".storage",".store",".stream",".studio",".study",".style",".sucks",".supplies",".supply",".support",".surf",".surgery",".suzuki",".swatch",".swiftcover",".swiss",".sydney",".symantec",".systems",".tab",".taipei",".talk",".taobao",".target",".tatamotors",".tatar",".tattoo",".tax",".taxi",".tci",".tdk",".team",".tech",".technology",".tel",".telefonica",".temasek",".tennis",".teva",".thd",".theater",".theatre",".tiaa",".tickets",".tienda",".tiffany",".tips",".tires",".tirol",".tjmaxx",".tjx",".tkmaxx",".tmall",".today",".tokyo",".tools",".top",".toray",".toshiba",".total",".tours",".town",".toyota",".toys",".trade",".trading",".training",".travel",".travelchannel",".travelers",".travelersinsurance",".trust",".trv",".tube",".tui",".tunes",".tushu",".tvs",".ubank",".ubs",".uconnect",".university",".uno",".uol",".ups",".us",".vacations",".vana",".vanguard",".vegas",".ventures",".verisign",".versicherung",".vet",".viajes",".video",".vig",".viking",".villas",".vin",".vip",".virgin",".visa",".vision",".vistaprint",".viva",".vivo",".vlaanderen",".vodka",".volkswagen",".volvo",".vote",".voting",".voto",".voyage",".vuelos",".wales",".walmart",".walter",".wang",".wanggou",".warman",".watch",".watches",".weather",".weatherchannel",".webcam",".weber",".website",".wed",".wedding",".weibo",".whoswho",".wien",".wiki",".williamhill",".win",".wine",".winners",".wme",".wolterskluwer",".woodside",".work",".works",".world",".wow",".wtc",".wtf",".xerox",".xfinity",".xihuan",".xin",".xxx",".xyz",".yachts",".yamaxun",".yodobashi",".yoga",".yokohama",".you",".youtube",".yun",".zappos",".zara",".zero",".zip",".zone",".zuerich",".xn--1qqw23a",".xn--30rr7y",".xn--3bst00m",".xn--3ds443g",".xn--3pxu8k",".xn--55qw42g",".xn--55qx5d",".xn--5tzm5g",".xn--6frz82g",".xn--9et52u",".xn--9krt00a",".xn--czrs0t",".xn--czru2d",".xn--efvy88h",".xn--estv75g",".xn--fct429k",".xn--fiq64b",".xn--fjq720a",".xn--flw351e",".xn--g2xx48c",".xn--hxt814e",".xn--io0a7i",".xn--jvr189m",".xn--kput3i",".xn--mxtq1m",".xn--nqv7f",".xn--nyqy26a",".xn--pbt977c",".xn--pssy2u",".xn--rhqv96g",".xn--rovu88b",".xn--unup4y",".xn--vhquv",".xn--vuq861b",".xn--w4rs40l",".xn--xhq521b",".xn--zfr164b",".xn--6qq986b3xl",".xn--b4w605ferd",".xn--fiq228c5hs",".xn--jlq61u9w7b",".xn--kcrx77d1x4a",".xn--3oq18vl8pn36a",".xn--5su34j936bgsg",".xn--fzys8d69uvgm",".xn--nqv7fs00ema",".xn--w4r85el8fhu5dnra",".xn--11b4c3d",".xn--c2br7g",".xn--42c2d9a",".xn--i1b6b1a6a2e",".xn--4gbrim",".xn--fhbei",".xn--mgba3a3ejt",".xn--mgba7c0bbn0a",".xn--mgbaakc7dvf",".xn--mgbab2bd",".xn--mgbt3dhd",".xn--ngbc5azd",".xn--ngbe9e0a",".xn--ngbrx",".xn--node",".xn--y9a3aq",".xn--80adxhks",".xn--80asehdb",".xn--80aswg",".xn--d1acj3b",".xn--d1alf",".xn--j1aef",".xn--9dbq2a",".xn--c1avg",".xn--p1acf",".xn--vermgensberater-ctb",".xn--vermgensberatung-pwb",".xn--bck1b9a5dre4c",".xn--cck2b3b",".xn--eckvdtc9d",".xn--gckr3f0f",".xn--q9jyb4c",".xn--qcka1pmc",".xn--tckwe",".xn--mk1bu44c",".xn--cg4bki",".a.se",".ab.ca",".ac",".ac.cn",".ac.cr",".ac.id",".ac.il",".ac.in",".ac.jp",".ac.mu",".ac.mw",".ac.rs",".ac.rw",".ac.tz",".ac.ug",".ac.uk",".ac.za",".ac.zm",".act.edu.au",".act.gov.au",".ad",".ad.jp",".adm.br",".adv.br",".ae",".af",".ag",".agr.br",".ai",".aichi.jp",".akita.jp",".al",".am",".am.br",".ao",".aomori.jp",".aq",".ar",".arq.br",".art.br",".as",".asso.fr",".at",".ath.cx",".au",".aw",".ax",".az",".ba",".bb",".bc.ca",".bd",".be",".bf",".bg",".bg.ac.rs",".bg.it",".bh",".bi",".bio.br",".biz.id",".biz.pl",".biz.pr",".biz.tr",".biz.ua",".bj",".bl",".blog.br",".bm",".bn",".bo",".bo.it",".bq",".br",".br.it",".brantford.on.ca",".bs",".bt",".bv",".bw",".by",".bydgoszcz.pl",".bz",".ca",".cc",".cd",".cf",".ch",".chiba.jp",".ci",".ck",".cl",".cm",".cn",".cnt.br",".co",".co.bw",".co.ci",".co.cm",".co.cr",".co.gy",".co.hu",".co.id",".co.il",".co.im",".co.in",".co.jp",".co.ke",".co.kr",".co.ma",".co.mu",".co.mw",".co.mz",".co.nl",".co.rs",".co.rw",".co.th",".co.tz",".co.ua",".co.ug",".co.uk",".co.za",".co.zm",".co.zw",".com.af",".com.ag",".com.ai",".com.ar",".com.au",".com.bo",".com.br",".com.cm",".com.cn",".com.co",".com.do",".com.dz",".com.ee",".com.fr",".com.ge",".com.gi",".com.gy",".com.hk",".com.hn",".com.hr",".com.ht",".com.im",".com.kg",".com.ky",".com.kz",".com.lc",".com.ly",".com.mg",".com.mk",".com.mx",".com.my",".com.ng",".com.pl",".com.pr",".com.ps",".com.pt",".com.ro",".com.sa",".com.sb",".com.sg",".com.so",".com.sy",".com.tn",".com.tr",".com.tw",".com.ua",".com.vc",".coop.br",".cr",".cu",".cv",".cw",".cx",".cy",".cz",".czest.pl",".de",".desa.id",".dj",".dk",".dm",".dn.ua",".do",".dp.ua",".dz",".ec",".ed.cr",".ed.jp",".edu.af",".edu.au",".edu.bi",".edu.bo",".edu.br",".edu.co",".edu.dm",".edu.do",".edu.dz",".edu.ge",".edu.hk",".edu.hn",".edu.ht",".edu.in",".edu.ky",".edu.kz",".edu.lr",".edu.ly",".edu.mg",".edu.mx",".edu.my",".edu.ng",".edu.pl",".edu.pr",".edu.ps",".edu.pt",".edu.sa",".edu.sb",".edu.sg",".edu.ua",".edu.uy",".ee",".eg",".ehime.jp",".eng.br",".ens.tn",".er",".es",".esp.br",".et",".eti.br",".far.br",".fhsk.se",".fi",".fi.cr",".fi.it",".fj",".fj.cn",".fk",".fm",".fm.br",".fo",".fr",".from.hr",".fukui.jp",".fukuoka.jp",".fukushima.jp",".g12.br",".ga",".gb",".gd",".gd.cn",".gda.pl",".ge",".gen.in",".gen.tr",".gf",".gg",".gh",".gi",".gifu.jp",".gl",".gm",".gn",".go.cr",".go.id",".go.jp",".go.th",".go.tz",".go.ug",".gob.hn",".gob.mx",".gouv.ci",".gouv.fr",".gouv.ht",".gov.af",".gov.ag",".gov.ar",".gov.au",".gov.br",".gov.by",".gov.co",".gov.cx",".gov.dm",".gov.dz",".gov.ge",".gov.gi",".gov.hk",".gov.ie",".gov.il",".gov.in",".gov.it",".gov.ky",".gov.kz",".gov.lc",".gov.ma",".gov.mg",".gov.mw",".gov.my",".gov.ng",".gov.pl",".gov.pr",".gov.ps",".gov.pt",".gov.rw",".gov.sa",".gov.sb",".gov.sc",".gov.sg",".gov.sy",".gov.tn",".gov.ua",".gov.uk",".gov.zm",".gp",".gq",".gr",".gr.jp",".gs",".gt",".gu",".gub.uy",".gunma.jp",".gw",".gy",".hiroshima.jp",".hk",".hm",".hn",".hokkaido.jp",".hr",".ht",".hu",".hyogo.jp",".ibaraki.jp",".id",".id.au",".id.lv",".idv.hk",".idv.tw",".ie",".il",".im",".imb.br",".in",".in.th",".ind.br",".ind.in",".inf.br",".info.ke",".info.pl",".info.ro",".info.tn",".info.tr",".io",".iq",".ir",".is",".isla.pr",".it",".iwate.jp",".je",".jm",".jo",".jor.br",".jp",".jus.br",".kagoshima.jp",".kalisz.pl",".kanagawa.jp",".katowice.pl",".ke",".kg",".kh",".ki",".kiev.ua",".km",".kn",".kommune.no",".koriyama.fukushima.jp",".kp",".kr",".krakow.pl",".kuleuven.be",".kumamoto.jp",".kw",".ky",".kyoto.jp",".kz",".la",".lb",".lc",".leg.br",".lel.br",".lg.jp",".li",".lk",".lm.lt",".lodz.pl",".longueuil.qc.ca",".lr",".ls",".lt",".ltd.gi",".ltd.uk",".lu",".lv",".ly",".ma",".malopolska.pl",".mb.ca",".mc",".md",".me",".me.uk",".med.br",".med.sa",".media.pl",".mf",".mg",".mh",".mie.jp",".mil.ar",".mil.br",".mil.by",".mil.co",".mil.hn",".mil.pl",".mil.uy",".miyagi.jp",".miyazaki.jp",".mk",".mn",".mo",".mp",".mq",".mr",".ms",".msk.ru",".mt",".mu",".mus.br",".mv",".mw",".mx",".my",".my.id",".mz",".na",".nagano.jp",".nagasaki.jp",".nara.jp",".nat.tn",".nb.ca",".nc",".ne",".ne.jp",".ne.kr",".net.ae",".net.al",".net.ar",".net.au",".net.bo",".net.br",".net.cn",".net.co",".net.do",".net.ge",".net.gy",".net.hk",".net.il",".net.in",".net.kg",".net.lr",".net.ly",".net.ma",".net.mu",".net.mx",".net.nf",".net.ng",".net.pl",".net.pr",".net.rw",".net.sa",".net.sb",".net.sg",".net.so",".net.sy",".net.tn",".net.tr",".net.tw",".net.ua",".net.uk",".net.uy",".net.za",".nf",".nf.ca",".ng",".ni",".nic.in",".niigata.jp",".nl",".nl.ca",".no",".nom.br",".nom.co",".not.br",".np",".nr",".ns.ca",".nsw.edu.au",".nsw.gov.au",".nt.ca",".nt.edu.au",".nu",".nysa.pl",".nz",".off.ai",".oita.jp",".okayama.jp",".okinawa.jp",".olsztyn.pl",".om",".on.ca",".or.cr",".or.id",".or.jp",".or.ke",".or.kr",".or.tz",".or.ug",".org.af",".org.ar",".org.au",".org.br",".org.bw",".org.bz",".org.cn",".org.co",".org.do",".org.dz",".org.ge",".org.gg",".org.hk",".org.hn",".org.ht",".org.il",".org.im",".org.in",".org.kg",".org.ky",".org.kz",".org.lb",".org.ly",".org.ma",".org.mk",".org.mw",".org.mx",".org.my",".org.mz",".org.ng",".org.pl",".org.ps",".org.ro",".org.rs",".org.sa",".org.sb",".org.sg",".org.so",".org.tn",".org.ua",".org.ug",".org.uk",".org.uy",".org.za",".org.zm",".osaka.jp",".oslo.no",".pa",".pe",".pe.ca",".pe.kr",".pf",".pg",".ph",".pi.it",".pila.pl",".pk",".pl",".plc.uk",".pm",".pn",".poznan.pl",".pp.ru",".pp.se",".pp.ua",".ppg.br",".pr",".pr.it",".prd.fr",".pri.ee",".pro.br",".ps",".pt",".pub.sa",".pvt.ge",".pw",".py",".qa",".qc.ca",".qld.edu.au",".qld.gov.au",".radom.pl",".re",".re.it",".res.in",".rm.it",".ro",".roma.it",".rs",".ru",".rw",".rzeszow.pl",".sa",".sa.cr",".sa.edu.au",".sa.gov.au",".saitama.jp",".saskatoon.sk.ca",".sb",".sc",".sc.cn",".sch.uk",".sd",".se",".seoul.kr",".sg",".sh",".sh.cn",".shiga.jp",".shimane.jp",".shizuoka.jp",".si",".sj",".sk",".sk.ca",".sl",".sld.do",".sm",".sm.ua",".sn",".so",".sr",".srv.br",".ss",".st",".store.ro",".su",".suginami.tokyo.jp",".sv",".sx",".sx.cn",".sy",".sz",".szczecin.pl",".tas.edu.au",".tc",".td",".telenet.be",".tf",".tg",".th",".tj",".tk",".tl",".tm",".tm.fr",".tmp.br",".tn",".tn.it",".to",".to.it",".tokushima.jp",".tokyo.jp",".torun.pl",".tottori.jp",".toyama.jp",".tr",".trd.br",".tt",".tur.br",".tv",".tv.br",".tw",".tz",".ua",".ug",".uk",".us",".uy",".uz",".vc",".ve",".vet.br",".vg",".vgs.no",".vi",".vic.edu.au",".vic.gov.au",".vn",".volyn.ua",".vu",".wa.edu.au",".wa.gov.au",".wakayama.jp",".warszawa.pl",".waw.pl",".web.do",".web.id",".web.tr",".web.za",".wf",".wroc.pl",".ws",".yamagata.jp",".yamaguchi.jp",".yamanashi.jp",".ye",".yk.ca",".yokohama.jp",".yt",".za",".zgora.pl",".zm",".zw",".xn--80ao21a",".xn--j1amh",".xn--90ais",".xn--h2brj9c",".xn--fiqs8s",".xn--j6w193g"]
38
+
39
+ if url[0..3] != "http"
40
+ url = 'https://' + url
41
+ end
42
+
43
+ if url =~ URI::regexp
44
+ host = URI.parse(url).host
45
+ cnt = host.count('.')
46
+ while cnt > 0
47
+ dotln = host.index('.')
48
+ domn = host[dotln,host.length]
49
+ if tlds.include?(domn)
50
+ return host
51
+ end
52
+ cnt -= 1
53
+ host = domn[1,domn.length]
54
+ end
55
+ return 'DOMAIN NOT FOUND'
56
+ else
57
+ return 'DOMAIN NOT FOUND'
58
+ end
59
+ end
60
+
61
+ # Get domain extension from a URL/domain.
62
+ def self.get_domain_extension(str)
63
+ domain = get_domain_name(str)
64
+ return domain[(domain.index("."))..(domain.length)]
33
65
  end
34
66
 
35
67
  end
@@ -1,9 +1,9 @@
1
- module Ip2whoisRuby
2
- class Configuration
3
- @api_key = ''
4
-
5
- class << self
6
- attr_accessor :api_key
7
- end
8
- end
9
- end
1
+ module Ip2whoisRuby
2
+ class Configuration
3
+ @api_key = ''
4
+
5
+ class << self
6
+ attr_accessor :api_key
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Ip2whoisRuby
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
data/lib/ip2whois_ruby.rb CHANGED
@@ -1,6 +1,6 @@
1
- require "ip2whois_ruby/api"
2
- require "ip2whois_ruby/configuration"
3
- require "ip2whois_ruby/version"
4
-
5
- module Ip2whoisRuby
6
- end
1
+ require "ip2whois_ruby/api"
2
+ require "ip2whois_ruby/configuration"
3
+ require "ip2whois_ruby/version"
4
+
5
+ module Ip2whoisRuby
6
+ end
@@ -22,4 +22,14 @@ describe "Ip2whoisRuby" do
22
22
  expect(result).to eq 'täst.de'
23
23
  end
24
24
 
25
+ it "work correctly with get domain name" do
26
+ result = Ip2whoisRuby::Api.get_domain_name('https://www.example.com/exe')
27
+ expect(result).to eq 'example.com'
28
+ end
29
+
30
+ it "work correctly with get domain extension" do
31
+ result = Ip2whoisRuby::Api.get_domain_extension('https://www.example.com/exe')
32
+ expect(result).to eq '.com'
33
+ end
34
+
25
35
  end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,15 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'ip2whois_ruby'
5
- require 'json'
6
-
7
- # Requires supporting files with custom matchers and macros, etc,
8
- # in ./support/ and its subdirectories.
9
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
-
11
- RSpec.configure do |config|
12
-
13
- end
14
-
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'ip2whois_ruby'
5
+ require 'json'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc,
8
+ # in ./support/ and its subdirectories.
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+
13
+ end
14
+
15
15
  $test_api_key = 'YOUR_API_KEY'
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: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ip2whois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-28 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simpleidn
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.2.33
67
+ rubygems_version: 3.3.7
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: IP2WHOIS Ruby SDK