From 325685e072f5c23713f90d10d75971a04f88efab Mon Sep 17 00:00:00 2001 From: Cork Date: Fri, 4 May 2018 13:58:41 +0200 Subject: [PATCH] Add support for whois.nominalia.com --- lib/whois/parsers/whois.nominalia.com.rb | 56 +++++++ .../status_available.expected | 42 ++++++ .../whois.nominalia.com/status_available.txt | 1 + .../status_registered.expected | 89 +++++++++++ .../whois.nominalia.com/status_registered.txt | 59 ++++++++ .../status_available_spec.rb | 93 ++++++++++++ .../status_registered_spec.rb | 140 ++++++++++++++++++ 7 files changed, 480 insertions(+) create mode 100644 lib/whois/parsers/whois.nominalia.com.rb create mode 100644 spec/fixtures/responses/whois.nominalia.com/status_available.expected create mode 100644 spec/fixtures/responses/whois.nominalia.com/status_available.txt create mode 100644 spec/fixtures/responses/whois.nominalia.com/status_registered.expected create mode 100644 spec/fixtures/responses/whois.nominalia.com/status_registered.txt create mode 100644 spec/whois/parsers/responses/whois.nominalia.com/status_available_spec.rb create mode 100644 spec/whois/parsers/responses/whois.nominalia.com/status_registered_spec.rb diff --git a/lib/whois/parsers/whois.nominalia.com.rb b/lib/whois/parsers/whois.nominalia.com.rb new file mode 100644 index 00000000..84ed1735 --- /dev/null +++ b/lib/whois/parsers/whois.nominalia.com.rb @@ -0,0 +1,56 @@ +#-- +# Ruby Whois +# +# An intelligent pure Ruby WHOIS client and parser. +# +# Copyright (c) 2009-2018 Simone Carletti +#++ + + +require_relative 'base_icann_compliant' + + +module Whois + class Parsers + + class WhoisNominaliaCom < BaseIcannCompliant + self.scanner = Scanners::BaseIcannCompliant, { + pattern_available: /^No match for / + } + + 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 diff --git a/spec/fixtures/responses/whois.nominalia.com/status_available.expected b/spec/fixtures/responses/whois.nominalia.com/status_available.expected new file mode 100644 index 00000000..f0e6a67f --- /dev/null +++ b/spec/fixtures/responses/whois.nominalia.com/status_available.expected @@ -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 == [] diff --git a/spec/fixtures/responses/whois.nominalia.com/status_available.txt b/spec/fixtures/responses/whois.nominalia.com/status_available.txt new file mode 100644 index 00000000..83bf01df --- /dev/null +++ b/spec/fixtures/responses/whois.nominalia.com/status_available.txt @@ -0,0 +1 @@ +No match for "u34jedzcq.com". diff --git a/spec/fixtures/responses/whois.nominalia.com/status_registered.expected b/spec/fixtures/responses/whois.nominalia.com/status_registered.expected new file mode 100644 index 00000000..42301aef --- /dev/null +++ b/spec/fixtures/responses/whois.nominalia.com/status_registered.expected @@ -0,0 +1,89 @@ +#domain + %s == "nominalia.com" + +#domain_id + %s == "4546874_DOMAIN_COM-VRSN" + +#status + %s == :registered + +#available? + %s == false + +#registered? + %s == true + +#created_on + %s %CLASS{time} + %s %TIME{2008-02-07 00:00:00 UTC} + +#updated_on + %s %CLASS{time} + %s %TIME{2013-06-27 00:00:00 UTC} + +#expires_on + %s %CLASS{time} + %s %TIME{2018-11-30 00:00:00 UTC} + +#registrar + %s %CLASS{registrar} + %s.id == "76" + %s.name == "NOMINALIA INTERNET S.L." + %s.organization == "NOMINALIA INTERNET S.L." + %s.url == "http://www.nominalia.com" + +#registrant_contacts + %s %CLASS{array} + %s %SIZE{1} + %s[0] %CLASS{contact} + %s[0].type == Whois::Parser::Contact::TYPE_REGISTRANT + %s[0].name == "Nominalia Internet S.L." + %s[0].organization == "Nominalia Internet S.L." + %s[0].address == "Josep Pla, 2. Torres Diagonal Litoral, B3, 3D" + %s[0].city == "Barcelona" + %s[0].zip == "L3R 8B5" + %s[0].state == "ON" + %s[0].country_code == "ES" + %s[0].phone == "+34.935074360" + %s[0].fax == "+34.933102360" + %s[0].email == "gestiontld@nominalia.com" + +#admin_contacts + %s %CLASS{array} + %s %SIZE{1} + %s[0] %CLASS{contact} + %s[0].type == Whois::Parser::Contact::TYPE_ADMINISTRATIVE + %s[0].name == "Claudio Corbetta" + %s[0].organization == "Nominalia Internet S.L." + %s[0].address == "Josep Pla, 2. Torres Diagonal Litoral, B3, 3D" + %s[0].city == "Barcelona" + %s[0].zip == "L3R 8B5" + %s[0].state == "ON" + %s[0].country_code == "ES" + %s[0].phone == "+34.935074360" + %s[0].fax == "+34.933102360" + %s[0].email == "gestiontld@nominalia.com" + +#technical_contacts + %s %CLASS{array} + %s %SIZE{1} + %s[0] %CLASS{contact} + %s[0].type == Whois::Parser::Contact::TYPE_TECHNICAL + %s[0].name == "Billing Department" + %s[0].organization == "Nominalia Internet, S.L." + %s[0].address == "Josep Pla, 2. Torres Diagonal Litoral. Edificio B3, planta 3-D" + %s[0].city == "Barcelona" + %s[0].zip == "L3R 8B5" + %s[0].state == "ON" + %s[0].country_code == "ES" + %s[0].phone == "+34.935074360" + %s[0].fax == "+34.933102360" + %s[0].email == "gestiontld@nominalia.com" + +#nameservers + %s %CLASS{array} + %s %SIZE{2} + %s[0] %CLASS{nameserver} + %s[0].name == "dns1.nameresolvers.com" + %s[1] %CLASS{nameserver} + %s[1].name == "dns2.nameresolvers.com" diff --git a/spec/fixtures/responses/whois.nominalia.com/status_registered.txt b/spec/fixtures/responses/whois.nominalia.com/status_registered.txt new file mode 100644 index 00000000..f0f306c8 --- /dev/null +++ b/spec/fixtures/responses/whois.nominalia.com/status_registered.txt @@ -0,0 +1,59 @@ +Domain Name: NOMINALIA.COM +Registry Domain ID: 4546874_DOMAIN_COM-VRSN +Registrar WHOIS Server: whois.nominalia.com +Registrar URL: http://www.nominalia.com +Updated Date: 2013-06-27T00:00:00Z +Creation Date: 2008-02-07T00:00:00Z +Registrar Registration Expiration Date: 2018-11-30T00:00:00Z +Registrar: NOMINALIA INTERNET S.L. +Registrar IANA ID: 76 +Registrar Abuse Contact Email: abuse@nominalia.com +Registrar Abuse Contact Phone: +34.935074387 +Reseller: +Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited +Registry Registrant ID: +Registrant Name: Nominalia Internet S.L. +Registrant Organization: Nominalia Internet S.L. +Registrant Street: Josep Pla, 2. Torres Diagonal Litoral, B3, 3D +Registrant City: Barcelona +Registrant State/Province: B +Registrant Postal Code: ES-08019 +Registrant Country: ES +Registrant Phone: +34.935074360 +Registrant Phone Ext: +Registrant Fax: +34.933102360 +Registrant Fax Ext: +Registrant Email: gestiontld@nominalia.com +Registry Admin ID: +Admin Name: Claudio Corbetta +Admin Organization: Nominalia Internet S.L. +Admin Street: Josep Pla, 2. Torres Diagonal Litoral, B3, 3D +Admin City: Barcelona +Admin State/Province: B +Admin Postal Code: 08019 +Admin Country: ES +Admin Phone: +34.935074360 +Admin Phone Ext: +Admin Fax: +34.933102360 +Admin Fax Ext: +Admin Email: gestiontld@nominalia.com +Registry Tech ID: +Tech Name: Billing Department +Tech Organization: Nominalia Internet, S.L. +Tech Street: Josep Pla, 2. Torres Diagonal Litoral. Edificio B3, planta 3-D +Tech City: Barcelona +Tech State/Province: Barcelona +Tech Postal Code: 08019 +Tech Country: ES +Tech Phone: +34.935074360 +Tech Phone Ext: +Tech Fax: +34.933102360 +Tech Fax Ext: +Tech Email: payment@nominalia.com +Name Server: DNS1.NOMINALIA.COM +Name Server: DNS2.NOMINALIA.COM +DNSSEC: unsigned +URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/ +>>> Last update of whois database: 2018-05-03T10:01:43Z <<< + +For more information on Whois status codes, please visit https://icann.org/epp diff --git a/spec/whois/parsers/responses/whois.nominalia.com/status_available_spec.rb b/spec/whois/parsers/responses/whois.nominalia.com/status_available_spec.rb new file mode 100644 index 00000000..66fe211d --- /dev/null +++ b/spec/whois/parsers/responses/whois.nominalia.com/status_available_spec.rb @@ -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.nominalia.com/status_available.expected +# +# and regenerate the tests with the following rake task +# +# $ rake spec:generate +# + +require 'spec_helper' +require 'whois/parsers/whois.nominalia.com.rb' + +describe Whois::Parsers::WhoisNominaliaCom, "status_available.expected" do + + subject do + file = fixture("responses", "whois.nominalia.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 diff --git a/spec/whois/parsers/responses/whois.nominalia.com/status_registered_spec.rb b/spec/whois/parsers/responses/whois.nominalia.com/status_registered_spec.rb new file mode 100644 index 00000000..548ac01c --- /dev/null +++ b/spec/whois/parsers/responses/whois.nominalia.com/status_registered_spec.rb @@ -0,0 +1,140 @@ +# 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.nominalia.com/status_registered.expected +# +# and regenerate the tests with the following rake task +# +# $ rake spec:generate +# + +require 'spec_helper' +require 'whois/parsers/whois.nominalia.com.rb' + +describe Whois::Parsers::WhoisNominaliaCom, "status_registered.expected" do + + subject do + file = fixture("responses", "whois.nominalia.com/status_registered.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("nominalia.com") + end + end + describe "#domain_id" do + it do + expect(subject.domain_id).to eq("4546874_DOMAIN_COM-VRSN") + end + end + describe "#status" do + it do + expect(subject.status).to eq(:registered) + end + end + describe "#available?" do + it do + expect(subject.available?).to eq(false) + end + end + describe "#registered?" do + it do + expect(subject.registered?).to eq(true) + end + end + describe "#created_on" do + it do + expect(subject.created_on).to be_a(Time) + expect(subject.created_on).to eq(Time.parse("2008-02-07 00:00:00 UTC")) + end + end + describe "#updated_on" do + it do + expect(subject.updated_on).to be_a(Time) + expect(subject.updated_on).to eq(Time.parse("2013-06-27 00:00:00 UTC")) + end + end + describe "#expires_on" do + it do + expect(subject.expires_on).to be_a(Time) + expect(subject.expires_on).to eq(Time.parse("2018-11-30 00:00:00 UTC")) + end + end + describe "#registrar" do + it do + expect(subject.registrar).to be_a(Whois::Parser::Registrar) + expect(subject.registrar.id).to eq("76") + expect(subject.registrar.name).to eq("NOMINALIA INTERNET S.L.") + expect(subject.registrar.organization).to eq("NOMINALIA INTERNET S.L.") + expect(subject.registrar.url).to eq("http://www.nominalia.com") + end + end + describe "#registrant_contacts" do + it do + expect(subject.registrant_contacts).to be_a(Array) + expect(subject.registrant_contacts.size).to eq(1) + expect(subject.registrant_contacts[0]).to be_a(Whois::Parser::Contact) + expect(subject.registrant_contacts[0].type).to eq(Whois::Parser::Contact::TYPE_REGISTRANT) + expect(subject.registrant_contacts[0].name).to eq("Nominalia Internet S.L.") + expect(subject.registrant_contacts[0].organization).to eq("Nominalia Internet S.L.") + expect(subject.registrant_contacts[0].address).to eq("Josep Pla, 2. Torres Diagonal Litoral, B3, 3D") + expect(subject.registrant_contacts[0].city).to eq("Barcelona") + expect(subject.registrant_contacts[0].zip).to eq("ES-08019") + expect(subject.registrant_contacts[0].state).to eq("B") + expect(subject.registrant_contacts[0].country_code).to eq("ES") + expect(subject.registrant_contacts[0].phone).to eq("+34.935074360") + expect(subject.registrant_contacts[0].fax).to eq("+34.933102360") + expect(subject.registrant_contacts[0].email).to eq("gestiontld@nominalia.com") + end + end + describe "#admin_contacts" do + it do + expect(subject.admin_contacts).to be_a(Array) + expect(subject.admin_contacts.size).to eq(1) + expect(subject.admin_contacts[0]).to be_a(Whois::Parser::Contact) + expect(subject.admin_contacts[0].type).to eq(Whois::Parser::Contact::TYPE_ADMINISTRATIVE) + expect(subject.admin_contacts[0].name).to eq("Claudio Corbetta") + expect(subject.admin_contacts[0].organization).to eq("Nominalia Internet S.L.") + expect(subject.admin_contacts[0].address).to eq("Josep Pla, 2. Torres Diagonal Litoral, B3, 3D") + expect(subject.admin_contacts[0].city).to eq("Barcelona") + expect(subject.admin_contacts[0].zip).to eq("08019") + expect(subject.admin_contacts[0].state).to eq("B") + expect(subject.admin_contacts[0].country_code).to eq("ES") + expect(subject.admin_contacts[0].phone).to eq("+34.935074360") + expect(subject.admin_contacts[0].fax).to eq("+34.933102360") + expect(subject.admin_contacts[0].email).to eq("gestiontld@nominalia.com") + end + end + describe "#technical_contacts" do + it do + expect(subject.technical_contacts).to be_a(Array) + expect(subject.technical_contacts.size).to eq(1) + expect(subject.technical_contacts[0]).to be_a(Whois::Parser::Contact) + expect(subject.technical_contacts[0].type).to eq(Whois::Parser::Contact::TYPE_TECHNICAL) + expect(subject.technical_contacts[0].name).to eq("Billing Department") + expect(subject.technical_contacts[0].organization).to eq("Nominalia Internet, S.L.") + expect(subject.technical_contacts[0].address).to eq("Josep Pla, 2. Torres Diagonal Litoral. Edificio B3, planta 3-D") + expect(subject.technical_contacts[0].city).to eq("Barcelona") + expect(subject.technical_contacts[0].zip).to eq("08019") + expect(subject.technical_contacts[0].state).to eq("Barcelona") + expect(subject.technical_contacts[0].country_code).to eq("ES") + expect(subject.technical_contacts[0].phone).to eq("+34.935074360") + expect(subject.technical_contacts[0].fax).to eq("+34.933102360") + expect(subject.technical_contacts[0].email).to eq("payment@nominalia.com") + end + end + describe "#nameservers" do + it do + expect(subject.nameservers).to be_a(Array) + expect(subject.nameservers.size).to eq(2) + expect(subject.nameservers[0]).to be_a(Whois::Parser::Nameserver) + expect(subject.nameservers[0].name).to eq("dns1.nominalia.com") + expect(subject.nameservers[1]).to be_a(Whois::Parser::Nameserver) + expect(subject.nameservers[1].name).to eq("dns2.nominalia.com") + end + end +end