Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #166 from sherwind/gl-base-cocca

WhoisNicGl < BaseCocca
  • Loading branch information...
commit 3de50bf80dbfc3b0d2b369c146b539f83e092445 2 parents 20d8a98 + e307448
@weppos authored
View
65 lib/whois/record/parser/whois.nic.gl.rb
@@ -7,76 +7,15 @@
#++
-require 'whois/record/parser/base'
+require 'whois/record/parser/base_cocca'
module Whois
class Record
class Parser
- #
- # = whois.nic.gl parser
- #
# Parser for the whois.nic.gl server.
- #
- # NOTE: This parser is just a stub and provides only a few basic methods
- # to check for domain availability and get domain status.
- # Please consider to contribute implementing missing methods.
- # See WhoisNicIt parser for an explanation of all available methods
- # and examples.
- #
- class WhoisNicGl < Base
-
- property_supported :status do
- if content_for_scanner =~ /Status:\s+(.+?)\n/
- case $1.downcase
- when "active" then :registered
- when "delegated" then :registered
- when "not registered" then :available
- else
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
- end
- else
- Whois.bug!(ParserError, "Unable to parse status.")
- end
- end
-
- property_supported :available? do
- status == :available
- end
-
- property_supported :registered? do
- !available?
- end
-
-
- property_supported :created_on do
- if content_for_scanner =~ /Created:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :updated_on do
- if content_for_scanner =~ /Modified:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
- property_supported :expires_on do
- if content_for_scanner =~ /Expires:\s+(.+?)\n/
- Time.parse($1)
- end
- end
-
-
- property_supported :nameservers do
- if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
- $1.split("\n").map do |name|
- Record::Nameserver.new(name.strip)
- end
- end
- end
-
+ class WhoisNicGl < BaseCocca
end
end
View
7 spec/fixtures/responses/whois.nic.gl/status_available.expected
@@ -1,3 +1,10 @@
+#domain
+ should: %s == "u34jedzcq.gl"
+
+#domain_id
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
#status
should: %s == :available
View
14 spec/fixtures/responses/whois.nic.gl/status_registered.expected
@@ -1,3 +1,10 @@
+#domain
+ should: %s == "google.gl"
+
+#domain_id
+ should: %s raise_error(Whois::PropertyNotSupported)
+
+
#status
should: %s == :registered
@@ -21,6 +28,13 @@
should: %s == Time.parse("2013-01-01")
+#registrar
+ should: %s CLASS(registrar)
+ should: %s.id == nil
+ should: %s.name == "MarkMonitor"
+ should: %s.url == "http://www.markmonitor.com"
+
+
#nameservers
should: %s CLASS(array)
should: %s SIZE(2)
View
10 spec/whois/record/parser/responses/whois.nic.gl/status_available_spec.rb
@@ -21,6 +21,16 @@
@parser = klass.new(part)
end
+ describe "#domain" do
+ it do
+ @parser.domain.should == "u34jedzcq.gl"
+ end
+ end
+ describe "#domain_id" do
+ it do
+ lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
describe "#status" do
it do
@parser.status.should == :available
View
18 spec/whois/record/parser/responses/whois.nic.gl/status_registered_spec.rb
@@ -21,6 +21,16 @@
@parser = klass.new(part)
end
+ describe "#domain" do
+ it do
+ @parser.domain.should == "google.gl"
+ end
+ end
+ describe "#domain_id" do
+ it do
+ lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
+ end
+ end
describe "#status" do
it do
@parser.status.should == :registered
@@ -54,6 +64,14 @@
@parser.expires_on.should == Time.parse("2013-01-01")
end
end
+ describe "#registrar" do
+ it do
+ @parser.registrar.should be_a(Whois::Record::Registrar)
+ @parser.registrar.id.should == nil
+ @parser.registrar.name.should == "MarkMonitor"
+ @parser.registrar.url.should == "http://www.markmonitor.com"
+ end
+ end
describe "#nameservers" do
it do
@parser.nameservers.should be_a(Array)
Please sign in to comment.
Something went wrong with that request. Please try again.