Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for whois.namejuice.com #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions lib/whois/parsers/whois.namejuice.com.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <[email protected]>
#++


require_relative 'base_icann_compliant'


module Whois
class Parsers

class WhoisNamejuiceCom < BaseIcannCompliant
self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^Domain Name not found\n/
}

property_supported :domain do
node("Domain name", &:downcase)
end

property_supported :registrant_contacts do
build_contact("Registrant", Parser::Contact::TYPE_REGISTRANT)
end

property_supported :admin_contacts do
build_contact("Admin", Parser::Contact::TYPE_ADMINISTRATIVE)
end

property_supported :technical_contacts do
build_contact("Tech", Parser::Contact::TYPE_TECHNICAL)
end

private

def build_contact(element, type)
node("#{element} Name") do
Parser::Contact.new(
type: type,
id: node("Registry #{element} ID").presence,
name: value_for_property(element, 'Name'),
organization: value_for_property(element, 'Organization'),
address: value_for_property(element, 'Street'),
city: value_for_property(element, 'City'),
zip: value_for_property(element, 'Postal Code'),
state: value_for_property(element, 'State/Province'),
country_code: value_for_property(element, 'Country'),
phone: value_for_phone_property(element, 'Phone'),
fax: value_for_phone_property(element, 'Fax'),
email: value_for_property(element, 'Email')
)
end
end

end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#domain
%s == nil

#domain_id
%s == nil

#status
%s == :available

#available?
%s == true

#registered?
%s == false

#created_on
%s == nil

#updated_on
%s == nil

#expires_on
%s == nil

#registrar
%s == nil

#registrant_contacts
%s %CLASS{array}
%s == []

#admin_contacts
%s %CLASS{array}
%s == []

#technical_contacts
%s %CLASS{array}
%s == []

#nameservers
%s %CLASS{array}
%s == []
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Domain Name not found
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#domain
%s == "domain.com"

#domain_id
%s == "104784662_DOMAIN_COM-VRSN"

#status
%s == :registered

#available?
%s == false

#registered?
%s == true

#created_on
%s %CLASS{time}
%s %TIME{2004-03-25 16:06:56 UTC}

#updated_on
%s %CLASS{time}
%s %TIME{2018-05-03 09:52:37 UTC}

#expires_on
%s %CLASS{time}
%s %TIME{2020-10-09 04:00:00 UTC}

#registrar
%s %CLASS{registrar}
%s.id == "636"
%s.name == "BRANDON GRAY INTERNET SERVICES, INC. DBA NAMEJUICE.COM"
%s.organization == "BRANDON GRAY INTERNET SERVICES, INC. DBA NAMEJUICE.COM"
%s.url == "http://www.namejuice.com"

#registrant_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_REGISTRANT
%s[0].name == "Domain Registrar"
%s[0].organization == "Brandon Gray Internet Services Inc."
%s[0].address == "7100 Warden Ave, Unit 8"
%s[0].city == "Markham"
%s[0].zip == "L3R 8B5"
%s[0].state == "ON"
%s[0].country_code == "CA"
%s[0].phone == "+1.9054152681"
%s[0].fax == "+1.9054152682"
%s[0].email == "[email protected]"

#admin_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_ADMINISTRATIVE
%s[0].name == "Domain Registrar"
%s[0].organization == "Brandon Gray Internet Services Inc."
%s[0].address == "7100 Warden Ave, Unit 8"
%s[0].city == "Markham"
%s[0].zip == "L3R 8B5"
%s[0].state == "ON"
%s[0].country_code == "CA"
%s[0].phone == "+1.9054152681"
%s[0].fax == "+1.9054152682"
%s[0].email == "[email protected]"

#technical_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_TECHNICAL
%s[0].name == "Domain Registrar"
%s[0].organization == "Brandon Gray Internet Services Inc."
%s[0].address == "7100 Warden Ave, Unit 8"
%s[0].city == "Markham"
%s[0].zip == "L3R 8B5"
%s[0].state == "ON"
%s[0].country_code == "CA"
%s[0].phone == "+1.9054152681"
%s[0].fax == "+1.9054152682"
%s[0].email == "[email protected]"

#nameservers
%s %CLASS{array}
%s %SIZE{4}
%s[0] %CLASS{nameserver}
%s[0].name == "dns1.nameresolvers.com"
%s[1] %CLASS{nameserver}
%s[1].name == "dns2.nameresolvers.com"
%s[2] %CLASS{nameserver}
%s[2].name == "dns3.nameresolvers.com"
%s[3] %CLASS{nameserver}
%s[3].name == "dns4.nameresolvers.com"
84 changes: 84 additions & 0 deletions spec/fixtures/responses/whois.namejuice.com/status_registered.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

Domain name: NAMEJUICE.COM
Registry Domain ID: 104784662_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.namejuice.com
Registrar URL: http://www.namejuice.com
Updated Date: 2018-05-03T09:52:37Z
Creation Date: 2004-03-25T16:06:56Z
Registrar Registration Expiration Date: 2020-10-09T04:00:00Z
Registrar: BRANDON GRAY INTERNET SERVICES, INC. DBA NAMEJUICE.COM
Registrar IANA ID: 636
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: +1.9054152681
Domain Status: clientDeleteProhibited https://www.icann.org/epp#clientDeleteProhibited
Domain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited
Registry Registrant ID:
Registrant Name: Domain Registrar
Registrant Organization: Brandon Gray Internet Services Inc.
Registrant Street: 7100 Warden Ave
Registrant Street: Unit 8
Registrant City: Markham
Registrant State/Province: ON
Registrant Postal Code: L3R 8B5
Registrant Country: CA
Registrant Phone: +1.9054152681
Registrant Phone Ext:
Registrant Fax: +1.9054152682
Registrant Fax Ext:
Registrant Email: [email protected]
Registry Admin ID:
Admin Name: Domain Registrar
Admin Organization: Brandon Gray Internet Services Inc.
Admin Street: 7100 Warden Ave
Admin Street: Unit 8
Admin City: Markham
Admin State/Province: ON
Admin Postal Code: L3R 8B5
Admin Country: CA
Admin Phone: +1.9054152681
Admin Phone Ext:
Admin Fax: +1.9054152682
Admin Fax Ext:
Admin Email: [email protected]
Registry Tech ID:
Tech Name: Domain Registrar
Tech Organization: Brandon Gray Internet Services Inc.
Tech Street: 7100 Warden Ave
Tech Street: Unit 8
Tech City: Markham
Tech State/Province: ON
Tech Postal Code: L3R 8B5
Tech Country: CA
Tech Phone: +1.9054152681
Tech Phone Ext:
Tech Fax: +1.9054152682
Tech Fax Ext:
Tech Email: [email protected]
Name Server: DNS1.NAMERESOLVERS.COM
Name Server: DNS2.NAMERESOLVERS.COM
Name Server: DNS3.NAMERESOLVERS.COM
Name Server: DNS4.NAMERESOLVERS.COM
DNSSEC: Unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
Last update of WHOIS database: 2018-05-03T09:52:37Z

For more information on Whois status codes, please visit https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en.



The data in this whois database is provided to you for information
purposes only, that is, to assist you in obtaining information about or
related to a domain name registration record. We make this information
available "as is," and do not guarantee its accuracy. By submitting a
whois query, you agree that you will use this data only for lawful
purposes and that, under no circumstances will you use this data to: (1)
enable high volume, automated, electronic processes that stress or load
this whois database system providing you this information; or (2) allow,
enable, or otherwise support the transmission of mass unsolicited,
commercial advertising or solicitations via direct mail, electronic
mail, or by telephone. The compilation, repackaging, dissemination or
other use of this data is expressly prohibited without prior written
consent from us.

We reserve the right to modify these terms at any time. By submitting
this query, you agree to abide by these terms!
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# encoding: utf-8

# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.namejuice.com/status_available.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#

require 'spec_helper'
require 'whois/parsers/whois.namejuice.com.rb'

describe Whois::Parsers::WhoisNamejuiceCom, "status_available.expected" do

subject do
file = fixture("responses", "whois.namejuice.com/status_available.txt")
part = Whois::Record::Part.new(body: File.read(file))
described_class.new(part)
end

describe "#domain" do
it do
expect(subject.domain).to eq(nil)
end
end
describe "#domain_id" do
it do
expect(subject.domain_id).to eq(nil)
end
end
describe "#status" do
it do
expect(subject.status).to eq(:available)
end
end
describe "#available?" do
it do
expect(subject.available?).to eq(true)
end
end
describe "#registered?" do
it do
expect(subject.registered?).to eq(false)
end
end
describe "#created_on" do
it do
expect(subject.created_on).to eq(nil)
end
end
describe "#updated_on" do
it do
expect(subject.updated_on).to eq(nil)
end
end
describe "#expires_on" do
it do
expect(subject.expires_on).to eq(nil)
end
end
describe "#registrar" do
it do
expect(subject.registrar).to eq(nil)
end
end
describe "#registrant_contacts" do
it do
expect(subject.registrant_contacts).to be_a(Array)
expect(subject.registrant_contacts).to eq([])
end
end
describe "#admin_contacts" do
it do
expect(subject.admin_contacts).to be_a(Array)
expect(subject.admin_contacts).to eq([])
end
end
describe "#technical_contacts" do
it do
expect(subject.technical_contacts).to be_a(Array)
expect(subject.technical_contacts).to eq([])
end
end
describe "#nameservers" do
it do
expect(subject.nameservers).to be_a(Array)
expect(subject.nameservers).to eq([])
end
end
end
Loading