diff --git a/lib/whois/record/parser/whois.inww.com.rb b/lib/whois/record/parser/whois.inww.com.rb new file mode 100644 index 000000000..467dd470a --- /dev/null +++ b/lib/whois/record/parser/whois.inww.com.rb @@ -0,0 +1,26 @@ +#-- +# Ruby Whois +# +# An intelligent pure Ruby WHOIS client and parser. +# +# Copyright (c) 2009-2012 Simone Carletti +#++ + +require 'whois/record/parser/whois.melbourneit.com' + +module Whois + class Record + class Parser + # Parser for the whois.inww.com server. + # + # @see Whois::Record::Parser::Example + # The Example parser for the list of all available methods. + # + # @author Justin Campbell + # + class WhoisInwwCom < WhoisMelbourneitCom + end + end + end +end + diff --git a/spec/fixtures/responses/whois.inww.com/status_registered.expected b/spec/fixtures/responses/whois.inww.com/status_registered.expected new file mode 100644 index 000000000..eabac948c --- /dev/null +++ b/spec/fixtures/responses/whois.inww.com/status_registered.expected @@ -0,0 +1,91 @@ +#status + should: %s == :registered + +#available? + should: %s == false + +#registered? + should: %s == true + + +#created_on + should: %s CLASS(time) + should: %s == Time.parse("1998-04-16") + +#updated_on + should: %s CLASS(time) + should: %s == Time.parse("2000-03-30") + +#expires_on + should: %s CLASS(time) + should: %s == Time.parse("2012-11-18") + + +#registrar + should: %s CLASS(registrar) + should: %s.id == nil + should: %s.name == "Melbourne IT" + should: %s.organization == "Melbourne IT Ltd" + should: %s.url == "http://melbourneit.com.au" + +#registrant_contacts + should: %s CLASS(array) + should: %s SIZE(1) + should: %s[0] CLASS(contact) + should: %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT + should: %s[0].id == nil + should: %s[0].name == "Melbourne IT Ltd" + should: %s[0].organization == nil + should: %s[0].address == "Level 2, 120 King Street" + should: %s[0].city == "Melbourne" + should: %s[0].zip == "3000" + should: %s[0].state == "Vic" + should: %s[0].country == "AUSTRALIA" + should: %s[0].phone == nil + should: %s[0].fax == nil + should: %s[0].email == nil + +#admin_contacts + should: %s CLASS(array) + should: %s SIZE(1) + should: %s[0] CLASS(contact) + should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN + should: %s[0].id == nil + should: %s[0].name == "Account Manager" + should: %s[0].organization == nil + should: %s[0].address == "Level 2, 120 King Street" + should: %s[0].city == "Melbourne" + should: %s[0].zip == "3000" + should: %s[0].state == "Vic" + should: %s[0].country == "AUSTRALIA" + should: %s[0].phone == "+61.386242465" + should: %s[0].fax == nil + should: %s[0].email == "cdm@melbourneit.com" + +#technical_contacts + should: %s CLASS(array) + should: %s SIZE(1) + should: %s[0] CLASS(contact) + should: %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL + should: %s[0].id == nil + should: %s[0].name == "Account Manager" + should: %s[0].organization == nil + should: %s[0].address == "Level 2, 120 King Street" + should: %s[0].city == "Melbourne" + should: %s[0].zip == "3000" + should: %s[0].state == "Vic" + should: %s[0].country == "AUSTRALIA" + should: %s[0].phone == "+61.386242465" + should: %s[0].fax == nil + should: %s[0].email == "cdm@melbourneit.com" + + +#nameservers + should: %s CLASS(array) + should: %s SIZE(2) + should: %s[0] CLASS(nameserver) + should: %s[0].name == "ns1.melbourneit.com" + should: %s[0].ipv4 == nil + should: %s[1] CLASS(nameserver) + should: %s[1].name == "ns2.melbourneit.com" + should: %s[1].ipv4 == nil diff --git a/spec/fixtures/responses/whois.inww.com/status_registered.txt b/spec/fixtures/responses/whois.inww.com/status_registered.txt new file mode 100644 index 000000000..a42a81b7d --- /dev/null +++ b/spec/fixtures/responses/whois.inww.com/status_registered.txt @@ -0,0 +1,41 @@ + +Domain Name.......... inww.com + Creation Date........ 1998-04-16 + Registration Date.... 2000-03-30 + Expiry Date.......... 2012-11-18 + Organisation Name.... Melbourne IT Ltd + Organisation Address. Level 2, 120 King Street + Organisation Address. + Organisation Address. + Organisation Address. Melbourne + Organisation Address. 3000 + Organisation Address. Vic + Organisation Address. AUSTRALIA + +Admin Name........... Account Manager + Admin Address........ Level 2, 120 King Street + Admin Address........ + Admin Address........ + Admin Address. Melbourne + Admin Address........ 3000 + Admin Address........ Vic + Admin Address........ AUSTRALIA + Admin Email.......... cdm@melbourneit.com + Admin Phone.......... +61.386242465 + Admin Fax............ + +Tech Name............ Account Manager + Tech Address......... Level 2, 120 King Street + Tech Address......... + Tech Address......... + Tech Address......... Melbourne + Tech Address......... 3000 + Tech Address......... Vic + Tech Address......... AUSTRALIA + Tech Email........... cdm@melbourneit.com + Tech Phone........... +61.386242465 + Tech Fax............. + Name Server.......... ns1.melbourneit.com + Name Server.......... ns2.melbourneit.com + + diff --git a/spec/whois/record/parser/responses/whois.inww.com/status_registered_spec.rb b/spec/whois/record/parser/responses/whois.inww.com/status_registered_spec.rb new file mode 100644 index 000000000..de72d585e --- /dev/null +++ b/spec/whois/record/parser/responses/whois.inww.com/status_registered_spec.rb @@ -0,0 +1,135 @@ +# 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.inww.com/status_registered.expected +# +# and regenerate the tests with the following rake task +# +# $ rake spec:generate +# + +require 'spec_helper' +require 'whois/record/parser/whois.inww.com.rb' + +describe Whois::Record::Parser::WhoisInwwCom, "status_registered.expected" do + + before(:each) do + file = fixture("responses", "whois.inww.com/status_registered.txt") + part = Whois::Record::Part.new(:body => File.read(file)) + @parser = klass.new(part) + end + + describe "#status" do + it do + @parser.status.should == :registered + end + end + describe "#available?" do + it do + @parser.available?.should == false + end + end + describe "#registered?" do + it do + @parser.registered?.should == true + end + end + describe "#created_on" do + it do + @parser.created_on.should be_a(Time) + @parser.created_on.should == Time.parse("1998-04-16") + end + end + describe "#updated_on" do + it do + @parser.updated_on.should be_a(Time) + @parser.updated_on.should == Time.parse("2000-03-30") + end + end + describe "#expires_on" do + it do + @parser.expires_on.should be_a(Time) + @parser.expires_on.should == Time.parse("2012-11-18") + end + end + describe "#registrar" do + it do + @parser.registrar.should be_a(Whois::Record::Registrar) + @parser.registrar.id.should == nil + @parser.registrar.name.should == "Melbourne IT" + @parser.registrar.organization.should == "Melbourne IT Ltd" + @parser.registrar.url.should == "http://melbourneit.com.au" + end + end + describe "#registrant_contacts" do + it do + @parser.registrant_contacts.should be_a(Array) + @parser.registrant_contacts.should have(1).items + @parser.registrant_contacts[0].should be_a(Whois::Record::Contact) + @parser.registrant_contacts[0].type.should == Whois::Record::Contact::TYPE_REGISTRANT + @parser.registrant_contacts[0].id.should == nil + @parser.registrant_contacts[0].name.should == "Melbourne IT Ltd" + @parser.registrant_contacts[0].organization.should == nil + @parser.registrant_contacts[0].address.should == "Level 2, 120 King Street" + @parser.registrant_contacts[0].city.should == "Melbourne" + @parser.registrant_contacts[0].zip.should == "3000" + @parser.registrant_contacts[0].state.should == "Vic" + @parser.registrant_contacts[0].country.should == "AUSTRALIA" + @parser.registrant_contacts[0].phone.should == nil + @parser.registrant_contacts[0].fax.should == nil + @parser.registrant_contacts[0].email.should == nil + end + end + describe "#admin_contacts" do + it do + @parser.admin_contacts.should be_a(Array) + @parser.admin_contacts.should have(1).items + @parser.admin_contacts[0].should be_a(Whois::Record::Contact) + @parser.admin_contacts[0].type.should == Whois::Record::Contact::TYPE_ADMIN + @parser.admin_contacts[0].id.should == nil + @parser.admin_contacts[0].name.should == "Account Manager" + @parser.admin_contacts[0].organization.should == nil + @parser.admin_contacts[0].address.should == "Level 2, 120 King Street" + @parser.admin_contacts[0].city.should == "Melbourne" + @parser.admin_contacts[0].zip.should == "3000" + @parser.admin_contacts[0].state.should == "Vic" + @parser.admin_contacts[0].country.should == "AUSTRALIA" + @parser.admin_contacts[0].phone.should == "+61.386242465" + @parser.admin_contacts[0].fax.should == nil + @parser.admin_contacts[0].email.should == "cdm@melbourneit.com" + end + end + describe "#technical_contacts" do + it do + @parser.technical_contacts.should be_a(Array) + @parser.technical_contacts.should have(1).items + @parser.technical_contacts[0].should be_a(Whois::Record::Contact) + @parser.technical_contacts[0].type.should == Whois::Record::Contact::TYPE_TECHNICAL + @parser.technical_contacts[0].id.should == nil + @parser.technical_contacts[0].name.should == "Account Manager" + @parser.technical_contacts[0].organization.should == nil + @parser.technical_contacts[0].address.should == "Level 2, 120 King Street" + @parser.technical_contacts[0].city.should == "Melbourne" + @parser.technical_contacts[0].zip.should == "3000" + @parser.technical_contacts[0].state.should == "Vic" + @parser.technical_contacts[0].country.should == "AUSTRALIA" + @parser.technical_contacts[0].phone.should == "+61.386242465" + @parser.technical_contacts[0].fax.should == nil + @parser.technical_contacts[0].email.should == "cdm@melbourneit.com" + end + end + describe "#nameservers" do + it do + @parser.nameservers.should be_a(Array) + @parser.nameservers.should have(2).items + @parser.nameservers[0].should be_a(Whois::Record::Nameserver) + @parser.nameservers[0].name.should == "ns1.melbourneit.com" + @parser.nameservers[0].ipv4.should == nil + @parser.nameservers[1].should be_a(Whois::Record::Nameserver) + @parser.nameservers[1].name.should == "ns2.melbourneit.com" + @parser.nameservers[1].ipv4.should == nil + end + end +end