whois 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/CHANGELOG.md +20 -0
  2. data/lib/whois/core_ext.rb +3 -1
  3. data/lib/whois/core_ext/array/extract_options.rb +2 -2
  4. data/lib/whois/core_ext/array/wrap.rb +13 -16
  5. data/lib/whois/core_ext/object/blank.rb +105 -0
  6. data/lib/whois/record/contact.rb +14 -3
  7. data/lib/whois/record/parser/base_afilias.rb +3 -4
  8. data/lib/whois/record/parser/base_cocca.rb +14 -13
  9. data/lib/whois/record/parser/base_cocca2.rb +25 -32
  10. data/lib/whois/record/parser/base_shared2.rb +1 -1
  11. data/lib/whois/record/parser/base_shared3.rb +1 -1
  12. data/lib/whois/record/parser/base_whoisd.rb +5 -6
  13. data/lib/whois/record/parser/whois.aeda.net.ae.rb +6 -8
  14. data/lib/whois/record/parser/whois.ai.rb +6 -8
  15. data/lib/whois/record/parser/whois.ati.tn.rb +1 -1
  16. data/lib/whois/record/parser/whois.cctld.by.rb +0 -1
  17. data/lib/whois/record/parser/whois.centralnic.com.rb +2 -1
  18. data/lib/whois/record/parser/whois.cira.ca.rb +1 -1
  19. data/lib/whois/record/parser/whois.cnnic.cn.rb +1 -1
  20. data/lib/whois/record/parser/whois.comlaude.com.rb +1 -1
  21. data/lib/whois/record/parser/whois.denic.de.rb +1 -1
  22. data/lib/whois/record/parser/whois.domainregistry.ie.rb +1 -1
  23. data/lib/whois/record/parser/whois.dreamhost.com.rb +1 -1
  24. data/lib/whois/record/parser/whois.educause.edu.rb +1 -1
  25. data/lib/whois/record/parser/whois.enom.com.rb +1 -1
  26. data/lib/whois/record/parser/whois.gg.rb +4 -58
  27. data/lib/whois/record/parser/whois.godaddy.com.rb +1 -1
  28. data/lib/whois/record/parser/whois.iana.org.rb +1 -1
  29. data/lib/whois/record/parser/whois.ja.net.rb +6 -8
  30. data/lib/whois/record/parser/whois.je.rb +4 -58
  31. data/lib/whois/record/parser/whois.markmonitor.com.rb +1 -1
  32. data/lib/whois/record/parser/whois.networksolutions.com.rb +1 -1
  33. data/lib/whois/record/parser/whois.nic.am.rb +10 -11
  34. data/lib/whois/record/parser/whois.nic.as.rb +4 -44
  35. data/lib/whois/record/parser/whois.nic.asia.rb +1 -1
  36. data/lib/whois/record/parser/whois.nic.bo.rb +6 -8
  37. data/lib/whois/record/parser/whois.nic.cd.rb +4 -47
  38. data/lib/whois/record/parser/whois.nic.cz.rb +4 -4
  39. data/lib/whois/record/parser/whois.nic.fr.rb +1 -1
  40. data/lib/whois/record/parser/whois.nic.hn.rb +2 -3
  41. data/lib/whois/record/parser/whois.nic.hu.rb +1 -1
  42. data/lib/whois/record/parser/whois.nic.it.rb +1 -1
  43. data/lib/whois/record/parser/whois.nic.mg.rb +4 -64
  44. data/lib/whois/record/parser/whois.nic.sn.rb +1 -1
  45. data/lib/whois/record/parser/whois.nic.tr.rb +75 -8
  46. data/lib/whois/record/parser/whois.pnina.ps.rb +10 -58
  47. data/lib/whois/record/parser/whois.register.bg.rb +6 -8
  48. data/lib/whois/record/parser/whois.register.com.rb +1 -1
  49. data/lib/whois/record/parser/whois.rnids.rs.rb +1 -1
  50. data/lib/whois/record/parser/whois.smallregistry.net.rb +1 -1
  51. data/lib/whois/record/parser/whois.srs.net.nz.rb +1 -1
  52. data/lib/whois/record/parser/whois.sx.rb +1 -1
  53. data/lib/whois/record/parser/whois.tcinet.ru.rb +1 -1
  54. data/lib/whois/record/parser/whois.ua.rb +2 -2
  55. data/lib/whois/record/parser/whois.usp.ac.fj.rb +6 -8
  56. data/lib/whois/record/scanners/base_cocca2.rb +52 -0
  57. data/lib/whois/record/scanners/whois.ati.tn.rb +0 -2
  58. data/lib/whois/record/scanners/whois.audns.net.au.rb +0 -2
  59. data/lib/whois/record/scanners/whois.cctld.by.rb +5 -6
  60. data/lib/whois/record/scanners/whois.cira.ca.rb +0 -2
  61. data/lib/whois/record/scanners/whois.dns.hr.rb +0 -2
  62. data/lib/whois/record/scanners/whois.nc.rb +0 -2
  63. data/lib/whois/record/scanners/whois.registry.net.za.rb +20 -20
  64. data/lib/whois/record/scanners/whois.rnids.rs.rb +0 -2
  65. data/lib/whois/version.rb +1 -1
  66. data/whois.gemspec +3 -3
  67. metadata +4 -2
@@ -42,7 +42,7 @@ module Whois
42
42
 
43
43
 
44
44
  property_supported :admin_contacts do
45
- build_contact("Administrative", Whois::Record::Contact::TYPE_ADMIN)
45
+ build_contact("Administrative", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
46
46
  end
47
47
 
48
48
  property_supported :technical_contacts do
@@ -14,16 +14,14 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.registrypro.pro parser
19
- #
20
17
  # Parser for the whois.nic.bo server.
21
18
  #
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.
19
+ # @note This parser is just a stub and provides only a few basic methods
20
+ # to check for domain availability and get domain status.
21
+ # Please consider to contribute implementing missing methods.
22
+ #
23
+ # @see Whois::Record::Parser::Example
24
+ # The Example parser for the list of all available methods.
27
25
  #
28
26
  class WhoisNicBo < Base
29
27
 
@@ -7,62 +7,19 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_cocca2'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.cd parser
19
- #
20
17
  # Parser for the whois.nic.cd server.
21
18
  #
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.
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
27
21
  #
28
- class WhoisNicCd < Base
29
-
30
- property_supported :status do
31
- content_for_scanner.scan(/^\s+Domain Status:\s+(.+?)\n/).flatten
32
- end
33
-
34
- property_supported :available? do
35
- !!(content_for_scanner.strip == "Domain Not Found")
36
- end
37
-
38
- property_supported :registered? do
39
- !available?
40
- end
41
-
42
-
43
- property_supported :created_on do
44
- if content_for_scanner =~ /^\s+Creation Date:\s+(.*)\n/
45
- Time.parse($1)
46
- end
47
- end
48
-
49
- property_not_supported :updated_on
50
-
51
- property_supported :expires_on do
52
- if content_for_scanner =~ /^\s+Expiration Date:\s+(.*)\n/
53
- Time.parse($1)
54
- end
55
- end
56
-
57
-
58
- property_supported :nameservers do
59
- if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
60
- $1.split("\n").map do |name|
61
- Record::Nameserver.new(:name => name.strip.downcase)
62
- end
63
- end
64
- end
65
-
22
+ class WhoisNicCd < BaseCocca2
66
23
  end
67
24
 
68
25
  end
@@ -21,10 +21,10 @@ module Whois
21
21
  #
22
22
  class WhoisNicCz < BaseWhoisd
23
23
  self.status_mapping = {
24
- 'paid and in zone' => :registered,
25
- 'update prohibited' => :registered,
26
- 'expired' => :expired,
27
- 'to be deleted' => :expired,
24
+ "paid and in zone" => :registered,
25
+ "update prohibited" => :registered,
26
+ "expired" => :expired,
27
+ "to be deleted" => :expired,
28
28
  }
29
29
  end
30
30
 
@@ -79,7 +79,7 @@ module Whois
79
79
  end
80
80
 
81
81
  property_supported :admin_contacts do
82
- parse_contact("admin-c", Whois::Record::Contact::TYPE_ADMIN)
82
+ parse_contact("admin-c", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
83
83
  end
84
84
 
85
85
  property_supported :technical_contacts do
@@ -7,7 +7,7 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base_cocca'
10
+ require 'whois/record/parser/base_cocca2'
11
11
 
12
12
 
13
13
  module Whois
@@ -19,8 +19,7 @@ module Whois
19
19
  # @see Whois::Record::Parser::Example
20
20
  # The Example parser for the list of all available methods.
21
21
  #
22
- # @since RELEASE
23
- class WhoisNicHn < BaseCocca
22
+ class WhoisNicHn < BaseCocca2
24
23
  end
25
24
 
26
25
  end
@@ -99,7 +99,7 @@ module Whois
99
99
  end
100
100
 
101
101
  property_supported :admin_contacts do
102
- build_contact("admin-c", Whois::Record::Contact::TYPE_ADMIN)
102
+ build_contact("admin-c", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
103
103
  end
104
104
 
105
105
  property_supported :technical_contacts do
@@ -107,7 +107,7 @@ module Whois
107
107
  end
108
108
 
109
109
  property_supported :admin_contacts do
110
- build_contact("Admin Contact", Whois::Record::Contact::TYPE_ADMIN)
110
+ build_contact("Admin Contact", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
111
111
  end
112
112
 
113
113
  property_supported :technical_contacts do
@@ -7,79 +7,19 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_cocca2'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.mg parser
19
- #
20
17
  # Parser for the whois.nic.mg server.
21
18
  #
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.
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
27
21
  #
28
- class WhoisNicMg < Base
29
-
30
- property_supported :status do
31
- if content_for_scanner =~ /Status:\s+(.+?)\n/
32
- case $1.downcase
33
- when "active"
34
- :registered
35
- when "delegated"
36
- :registered
37
- when "not registered"
38
- :available
39
- else
40
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
41
- end
42
- else
43
- Whois.bug!(ParserError, "Unable to parse status.")
44
- end
45
- end
46
-
47
- property_supported :available? do
48
- status == :available
49
- end
50
-
51
- property_supported :registered? do
52
- !available?
53
- end
54
-
55
-
56
- property_supported :created_on do
57
- if content_for_scanner =~ /Created:\s+(.+?)\n/
58
- Time.parse($1)
59
- end
60
- end
61
-
62
- property_supported :updated_on do
63
- if content_for_scanner =~ /Modified:\s+(.+?)\n/
64
- Time.parse($1)
65
- end
66
- end
67
-
68
- property_supported :expires_on do
69
- if content_for_scanner =~ /Expires:\s+(.+?)\n/
70
- Time.parse($1)
71
- end
72
- end
73
-
74
-
75
- property_supported :nameservers do
76
- if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
77
- $1.split("\n").map do |name|
78
- Record::Nameserver.new(:name => name.strip)
79
- end
80
- end
81
- end
82
-
22
+ class WhoisNicMg < BaseCocca2
83
23
  end
84
24
 
85
25
  end
@@ -80,7 +80,7 @@ module Whois
80
80
 
81
81
  property_supported :admin_contacts do
82
82
  if content_for_scanner =~ /Administrative Contact's handle:\s+(.+)\n/
83
- build_contact($1, Whois::Record::Contact::TYPE_ADMIN)
83
+ build_contact($1, Whois::Record::Contact::TYPE_ADMINISTRATIVE)
84
84
  end
85
85
  end
86
86
 
@@ -14,19 +14,21 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.tr parser
19
- #
20
17
  # Parser for the whois.nic.tr server.
21
18
  #
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.
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
27
21
  #
28
22
  class WhoisNicTr < Base
29
23
 
24
+ property_not_supported :disclaimer
25
+
26
+
27
+ property_not_supported :domain
28
+
29
+ property_not_supported :domain_id
30
+
31
+
30
32
  property_supported :status do
31
33
  if available?
32
34
  :available
@@ -61,6 +63,44 @@ module Whois
61
63
  end
62
64
 
63
65
 
66
+ property_not_supported :registrar
67
+
68
+
69
+ property_supported :registrant_contacts do
70
+ textblock = content_for_scanner.slice(/^\*\* Registrant:\n((?:\s+.+\n)+)/, 1)
71
+ return unless textblock
72
+
73
+ lines = textblock.lines.map(&:strip)
74
+
75
+ name = lines[0]
76
+ address = lines[1..2].delete_if(&:blank?).join("\n")
77
+ city, country = if (lines[3] == "Out of Turkey,")
78
+ [nil, lines[4]]
79
+ else
80
+ [lines[3].chomp(","), lines[4]]
81
+ end
82
+
83
+ Record::Contact.new(
84
+ type: Record::Contact::TYPE_REGISTRANT,
85
+ name: name,
86
+ address: address,
87
+ city: city,
88
+ country: country,
89
+ email: lines[5],
90
+ phone: lines[6],
91
+ fax: lines[7]
92
+ )
93
+ end
94
+
95
+ property_supported :admin_contacts do
96
+ build_contact("Administrative Contact", Whois::Record::Contact::TYPE_ADMINISTRATIVE)
97
+ end
98
+
99
+ property_supported :technical_contacts do
100
+ build_contact("Technical Contact", Whois::Record::Contact::TYPE_TECHNICAL)
101
+ end
102
+
103
+
64
104
  property_supported :nameservers do
65
105
  if content_for_scanner =~ /Domain Servers:\n((.+\n)+)\n/
66
106
  $1.split("\n").map do |line|
@@ -70,6 +110,33 @@ module Whois
70
110
  end
71
111
  end
72
112
 
113
+ private
114
+
115
+ def build_contact(element, type)
116
+ textblock = content_for_scanner.slice(/^\*\* #{element}:\n((?:.+\n)+)\n/, 1)
117
+ return unless textblock
118
+
119
+ lines = []
120
+ textblock.lines.each do |line|
121
+ if line =~ /^\s+.+/
122
+ lines.last.last << "\n" << line.strip
123
+ else
124
+ lines << line.match(/([^\t]+)\t+:\s+(.+)/).to_a[1..2]
125
+ end
126
+ end
127
+ lines = Hash[lines]
128
+
129
+ Record::Contact.new(
130
+ type: type,
131
+ id: lines["NIC Handle"],
132
+ name: lines["Person"],
133
+ organization: lines["Organization Name"],
134
+ address: lines["Address"],
135
+ phone: lines["Phone"],
136
+ fax: lines["Fax"]
137
+ )
138
+ end
139
+
73
140
  end
74
141
 
75
142
  end
@@ -7,73 +7,25 @@
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.pnina.ps parser
19
- #
20
17
  # Parser for the whois.pnina.ps server.
21
18
  #
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.
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
27
21
  #
28
- class WhoisPninaPs < Base
29
-
30
- property_supported :status do
31
- if content_for_scanner =~ /Status:\s+(.+?)\n/
32
- case (s = $1.downcase)
33
- when /^active/
34
- :registered
35
- when "not registered"
36
- :available
37
- else
38
- Whois.bug!(ParserError, "Unknown status `#{s}'.")
39
- end
40
- else
41
- Whois.bug!(ParserError, "Unable to parse status.")
42
- end
43
- end
44
-
45
- property_supported :available? do
46
- status == :available
47
- end
48
-
49
- property_supported :registered? do
50
- !available?
51
- end
52
-
53
-
54
- property_supported :created_on do
55
- if content_for_scanner =~ /Created:\s+(.+?)\n/
56
- Time.parse($1)
57
- end
58
- end
59
-
60
- property_not_supported :updated_on
61
-
62
- property_supported :expires_on do
63
- if content_for_scanner =~ /Expires:\s+(.+?)\n/
64
- Time.parse($1)
65
- end
66
- end
67
-
68
-
69
- property_supported :nameservers do
70
- if content_for_scanner =~ /Name Servers:\n((.+\n)+)\n/
71
- $1.split("\n").delete_if { |value| value =~ /nodns\.ns$/i }.map do |name|
72
- Record::Nameserver.new(:name => name.strip)
73
- end
74
- end
75
- end
76
-
22
+ class WhoisPninaPs < BaseCocca
23
+ self.status_mapping = {
24
+ "active" => :registered,
25
+ "delegated" => :registered,
26
+ "not registered" => :available,
27
+ "active - pending transfer" => :registered,
28
+ }
77
29
  end
78
30
 
79
31
  end