Skip to content

Commit

Permalink
Merge pull request #104 from morellon/master
Browse files Browse the repository at this point in the history
Extending support for whois.registro.br (closes #104)
  • Loading branch information
weppos committed Aug 4, 2011
2 parents 6ce63d9 + 82ece87 commit 5f82ebc
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 27 deletions.
26 changes: 20 additions & 6 deletions lib/whois/record/parser/whois.registro.br.rb
Expand Up @@ -43,15 +43,29 @@ class WhoisRegistroBr < Base
!available? !available?
end end


property_supported :created_on do
if content_for_scanner =~ /created:\s+(.+?)(\s+#.+)?\n/
Time.parse($1)
end
end


property_not_supported :created_on property_supported :updated_on do

if content_for_scanner =~ /changed:\s+(.+?)\n/
property_not_supported :updated_on Time.parse($1)

end
property_not_supported :expires_on end


property_supported :expires_on do
if content_for_scanner =~ /expires:\s+(.+?)\n/
Time.parse($1)
end
end


property_not_supported :nameservers property_supported :nameservers do
content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
Record::Nameserver.new(line.strip)
end
end


end end


Expand Down
Expand Up @@ -9,14 +9,15 @@




#created_on #created_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s == nil


#updated_on #updated_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s == nil


#expires_on #expires_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s == nil




#nameservers #nameservers
should: %s raise_error(Whois::PropertyNotSupported) should: %s be_a(Array)
should: %s == []
Expand Up @@ -9,14 +9,22 @@




#created_on #created_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s be_a(Time)
should: %s == Time.parse("20110630")


#updated_on #updated_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s be_a(Time)
should: %s == Time.parse("20110630")


#expires_on #expires_on
should: %s raise_error(Whois::PropertyNotSupported) should: %s be_a(Time)
should: %s == Time.parse("20120630")




#nameservers #nameservers
should: %s raise_error(Whois::PropertyNotSupported) should: %s be_a(Array)
should: %s have(2).items
should: %s[0] be_a(_nameserver)
should: %s[0].name == "a.sec.dns.br"
should: %s[1] be_a(_nameserver)
should: %s[1].name == "b.sec.dns.br"
34 changes: 29 additions & 5 deletions spec/fixtures/responses/whois.registro.br/status_registered.txt
Expand Up @@ -5,13 +5,36 @@
% being prohibited its distribution, comercialization or % being prohibited its distribution, comercialization or
% reproduction, in particular, to use it for advertising or % reproduction, in particular, to use it for advertising or
% any similar purpose. % any similar purpose.
% 2010-03-16 14:47:50 (BRT -03:00) % 2011-07-23 15:43:32 (BRT -03:00)


% Query rate limit exceeded. Reduced information. domain: morellon.com.br
% Use https://registro.br/cgi-bin/avail/ for domain availability. owner: Thiago Morello Peres
ownerid: 106.835.847-58
country: BR
owner-c: THMPE16
admin-c: THMPE16
tech-c: THMPE16
billing-c: THMPE16
nserver: a.sec.dns.br
nsstat: 20110723 AA
nslastaa: 20110723
nserver: b.sec.dns.br
nsstat: 20110723 AA
nslastaa: 20110723
dsrecord: 45187 RSA/SHA-1 7A106EB76E73ADE52F482D5FF11F86AA93C63369
dsstatus: 20110723 DSOK
dslastok: 20110723
saci: yes
created: 20110630 #8516780
expires: 20120630
changed: 20110630
status: published


domain: registro.br nic-hdl-br: THMPE16
owner: Núcleo de Informação e Coordenação do Ponto BR (662379) person: Thiago Morello Peres
e-mail: morellon@gmail.com
created: 20110630
changed: 20110630


% Security and mail abuse issues should also be addressed to % Security and mail abuse issues should also be addressed to
% cert.br, http://www.cert.br/, respectivelly to cert@cert.br % cert.br, http://www.cert.br/, respectivelly to cert@cert.br
Expand All @@ -21,3 +44,4 @@ owner: Núcleo de Informação e Coordenação do Ponto BR (662379)
% of queries are: domain (.br), ticket, provider, ID, CIDR % of queries are: domain (.br), ticket, provider, ID, CIDR
% block, IP and ASN. % block, IP and ASN.



Expand Up @@ -38,22 +38,23 @@
end end
describe "#created_on" do describe "#created_on" do
it do it do
lambda { @parser.created_on }.should raise_error(Whois::PropertyNotSupported) @parser.created_on.should == nil
end end
end end
describe "#updated_on" do describe "#updated_on" do
it do it do
lambda { @parser.updated_on }.should raise_error(Whois::PropertyNotSupported) @parser.updated_on.should == nil
end end
end end
describe "#expires_on" do describe "#expires_on" do
it do it do
lambda { @parser.expires_on }.should raise_error(Whois::PropertyNotSupported) @parser.expires_on.should == nil
end end
end end
describe "#nameservers" do describe "#nameservers" do
it do it do
lambda { @parser.nameservers }.should raise_error(Whois::PropertyNotSupported) @parser.nameservers.should be_a(Array)
@parser.nameservers.should == []
end end
end end
end end
Expand Up @@ -38,22 +38,30 @@
end end
describe "#created_on" do describe "#created_on" do
it do it do
lambda { @parser.created_on }.should raise_error(Whois::PropertyNotSupported) @parser.created_on.should be_a(Time)
@parser.created_on.should == Time.parse("20110630")
end end
end end
describe "#updated_on" do describe "#updated_on" do
it do it do
lambda { @parser.updated_on }.should raise_error(Whois::PropertyNotSupported) @parser.updated_on.should be_a(Time)
@parser.updated_on.should == Time.parse("20110630")
end end
end end
describe "#expires_on" do describe "#expires_on" do
it do it do
lambda { @parser.expires_on }.should raise_error(Whois::PropertyNotSupported) @parser.expires_on.should be_a(Time)
@parser.expires_on.should == Time.parse("20120630")
end end
end end
describe "#nameservers" do describe "#nameservers" do
it do it do
lambda { @parser.nameservers }.should raise_error(Whois::PropertyNotSupported) @parser.nameservers.should be_a(Array)
@parser.nameservers.should have(2).items
@parser.nameservers[0].should be_a(_nameserver)
@parser.nameservers[0].name.should == "a.sec.dns.br"
@parser.nameservers[1].should be_a(_nameserver)
@parser.nameservers[1].name.should == "b.sec.dns.br"
end end
end end
end end

0 comments on commit 5f82ebc

Please sign in to comment.