Skip to content
This repository

WhoisNicGl < BaseCocca #166

Merged
merged 1 commit into from almost 2 years ago

2 participants

Sherwin Daganato Simone Carletti
Simone Carletti
Owner
weppos commented

Great patch, merged. Thank you!

Simone Carletti weppos merged commit 3de50bf into from
Simone Carletti weppos closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 28, 2012
Sherwin Daganato WhoisNicGl < BaseCocca e307448
This page is out of date. Refresh to see the latest.
65  lib/whois/record/parser/whois.nic.gl.rb
@@ -7,76 +7,15 @@
7 7
 #++
8 8
 
9 9
 
10  
-require 'whois/record/parser/base'
  10
+require 'whois/record/parser/base_cocca'
11 11
 
12 12
 
13 13
 module Whois
14 14
   class Record
15 15
     class Parser
16 16
 
17  
-      #
18  
-      # = whois.nic.gl parser
19  
-      #
20 17
       # Parser for the whois.nic.gl server.
21  
-      #
22  
-      # NOTE: This parser is just a stub and provides only a few basic methods
23  
-      # to check for domain availability and get domain status.
24  
-      # Please consider to contribute implementing missing methods.
25  
-      # See WhoisNicIt parser for an explanation of all available methods
26  
-      # and examples.
27  
-      #
28  
-      class WhoisNicGl < Base
29  
-
30  
-        property_supported :status do
31  
-          if content_for_scanner =~ /Status:\s+(.+?)\n/
32  
-            case $1.downcase
33  
-            when "active" then :registered
34  
-            when "delegated" then :registered
35  
-            when "not registered" then :available
36  
-            else
37  
-              Whois.bug!(ParserError, "Unknown status `#{$1}'.")
38  
-            end
39  
-          else
40  
-            Whois.bug!(ParserError, "Unable to parse status.")
41  
-          end
42  
-        end
43  
-
44  
-        property_supported :available? do
45  
-          status == :available
46  
-        end
47  
-
48  
-        property_supported :registered? do
49  
-          !available?
50  
-        end
51  
-
52  
-
53  
-        property_supported :created_on do
54  
-          if content_for_scanner =~ /Created:\s+(.+?)\n/
55  
-            Time.parse($1)
56  
-          end
57  
-        end
58  
-
59  
-        property_supported :updated_on do
60  
-          if content_for_scanner =~ /Modified:\s+(.+?)\n/
61  
-            Time.parse($1)
62  
-          end
63  
-        end
64  
-
65  
-        property_supported :expires_on do
66  
-          if content_for_scanner =~ /Expires:\s+(.+?)\n/
67  
-            Time.parse($1)
68  
-          end
69  
-        end
70  
-
71  
-
72  
-        property_supported :nameservers do
73  
-          if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
74  
-            $1.split("\n").map do |name|
75  
-              Record::Nameserver.new(name.strip)
76  
-            end
77  
-          end
78  
-        end
79  
-
  18
+      class WhoisNicGl < BaseCocca
80 19
       end
81 20
 
82 21
     end
7  spec/fixtures/responses/whois.nic.gl/status_available.expected
... ...
@@ -1,3 +1,10 @@
  1
+#domain
  2
+  should: %s == "u34jedzcq.gl"
  3
+
  4
+#domain_id
  5
+  should: %s raise_error(Whois::PropertyNotSupported)
  6
+
  7
+
1 8
 #status
2 9
   should: %s == :available
3 10
 
14  spec/fixtures/responses/whois.nic.gl/status_registered.expected
... ...
@@ -1,3 +1,10 @@
  1
+#domain
  2
+  should: %s == "google.gl"
  3
+
  4
+#domain_id
  5
+  should: %s raise_error(Whois::PropertyNotSupported)
  6
+
  7
+
1 8
 #status
2 9
   should: %s == :registered
3 10
 
@@ -21,6 +28,13 @@
21 28
   should: %s == Time.parse("2013-01-01")
22 29
 
23 30
 
  31
+#registrar
  32
+  should: %s CLASS(registrar)
  33
+  should: %s.id           == nil
  34
+  should: %s.name         == "MarkMonitor"
  35
+  should: %s.url          == "http://www.markmonitor.com"
  36
+
  37
+
24 38
 #nameservers
25 39
   should: %s CLASS(array)
26 40
   should: %s SIZE(2)
10  spec/whois/record/parser/responses/whois.nic.gl/status_available_spec.rb
@@ -21,6 +21,16 @@
21 21
     @parser = klass.new(part)
22 22
   end
23 23
 
  24
+  describe "#domain" do
  25
+    it do
  26
+      @parser.domain.should == "u34jedzcq.gl"
  27
+    end
  28
+  end
  29
+  describe "#domain_id" do
  30
+    it do
  31
+      lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
  32
+    end
  33
+  end
24 34
   describe "#status" do
25 35
     it do
26 36
       @parser.status.should == :available
18  spec/whois/record/parser/responses/whois.nic.gl/status_registered_spec.rb
@@ -21,6 +21,16 @@
21 21
     @parser = klass.new(part)
22 22
   end
23 23
 
  24
+  describe "#domain" do
  25
+    it do
  26
+      @parser.domain.should == "google.gl"
  27
+    end
  28
+  end
  29
+  describe "#domain_id" do
  30
+    it do
  31
+      lambda { @parser.domain_id }.should raise_error(Whois::PropertyNotSupported)
  32
+    end
  33
+  end
24 34
   describe "#status" do
25 35
     it do
26 36
       @parser.status.should == :registered
@@ -54,6 +64,14 @@
54 64
       @parser.expires_on.should == Time.parse("2013-01-01")
55 65
     end
56 66
   end
  67
+  describe "#registrar" do
  68
+    it do
  69
+      @parser.registrar.should be_a(Whois::Record::Registrar)
  70
+      @parser.registrar.id.should           == nil
  71
+      @parser.registrar.name.should         == "MarkMonitor"
  72
+      @parser.registrar.url.should          == "http://www.markmonitor.com"
  73
+    end
  74
+  end
57 75
   describe "#nameservers" do
58 76
     it do
59 77
       @parser.nameservers.should be_a(Array)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.