Class: Ip2whoisRuby::Api
- Inherits:
-
Object
- Object
- Ip2whoisRuby::Api
- Defined in:
- lib/ip2whois_ruby/api.rb
Class Method Summary collapse
-
.get_normal_text(domain) ⇒ Object
Get Normal text.
-
.get_punycode(domain) ⇒ Object
Get Punycode.
-
.lookup(domain) ⇒ Object
Lookup domain WHOIS information.
Class Method Details
.get_normal_text(domain) ⇒ Object
Get Normal text.
31 32 33 |
# File 'lib/ip2whois_ruby/api.rb', line 31 def self.get_normal_text(domain) return SimpleIDN.to_unicode(domain) end |
.get_punycode(domain) ⇒ Object
Get Punycode.
26 27 28 |
# File 'lib/ip2whois_ruby/api.rb', line 26 def self.get_punycode(domain) return SimpleIDN.to_ascii(domain) end |
.lookup(domain) ⇒ Object
Lookup domain WHOIS information.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ip2whois_ruby/api.rb', line 10 def self.lookup(domain) uri = URI.parse("https://api.ip2whois.com/v2?key=" + Ip2whoisRuby::Configuration.api_key + "&format=json&domain=" + domain) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) if response == nil return false else return response end end |