whois 3.1.3 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/CHANGELOG.md +26 -2
  2. data/data/tld.json +8 -2
  3. data/lib/whois/record/parser/base.rb +1 -1
  4. data/lib/whois/record/parser/base_afilias.rb +3 -11
  5. data/lib/whois/record/parser/base_cocca2.rb +4 -3
  6. data/lib/whois/record/parser/base_icb.rb +95 -0
  7. data/lib/whois/record/parser/base_shared1.rb +4 -11
  8. data/lib/whois/record/parser/base_shared2.rb +4 -11
  9. data/lib/whois/record/parser/base_shared3.rb +5 -12
  10. data/lib/whois/record/parser/base_whoisd.rb +4 -13
  11. data/lib/whois/record/parser/jobswhois.verisign-grs.com.rb +8 -11
  12. data/lib/whois/record/parser/whois.ati.tn.rb +6 -15
  13. data/lib/whois/record/parser/whois.audns.net.au.rb +4 -12
  14. data/lib/whois/record/parser/whois.cctld.by.rb +4 -11
  15. data/lib/whois/record/parser/whois.centralnic.com.rb +4 -12
  16. data/lib/whois/record/parser/whois.cira.ca.rb +15 -20
  17. data/lib/whois/record/parser/whois.cnnic.cn.rb +3 -11
  18. data/lib/whois/record/parser/whois.crsnic.net.rb +5 -12
  19. data/lib/whois/record/parser/whois.denic.de.rb +4 -11
  20. data/lib/whois/record/parser/whois.dns.hr.rb +4 -12
  21. data/lib/whois/record/parser/whois.dns.pl.rb +12 -1
  22. data/lib/whois/record/parser/whois.domainregistry.ie.rb +4 -11
  23. data/lib/whois/record/parser/whois.fi.rb +54 -20
  24. data/lib/whois/record/parser/whois.iana.org.rb +4 -11
  25. data/lib/whois/record/parser/whois.jprs.jp.rb +7 -0
  26. data/lib/whois/record/parser/whois.nc.rb +5 -13
  27. data/lib/whois/record/parser/whois.nic.ac.rb +5 -53
  28. data/lib/whois/record/parser/whois.nic.cc.rb +4 -11
  29. data/lib/whois/record/parser/whois.nic.hu.rb +4 -11
  30. data/lib/whois/record/parser/whois.nic.io.rb +5 -53
  31. data/lib/whois/record/parser/whois.nic.it.rb +3 -10
  32. data/lib/whois/record/parser/whois.nic.sh.rb +5 -53
  33. data/lib/whois/record/parser/whois.nic.tv.rb +4 -11
  34. data/lib/whois/record/parser/whois.norid.no.rb +7 -9
  35. data/lib/whois/record/parser/whois.registry.net.za.rb +6 -7
  36. data/lib/whois/record/parser/whois.rnids.rs.rb +4 -12
  37. data/lib/whois/record/parser/whois.smallregistry.net.rb +4 -11
  38. data/lib/whois/record/parser/whois.srs.net.nz.rb +64 -22
  39. data/lib/whois/record/parser/whois.sx.rb +5 -13
  40. data/lib/whois/record/parser/whois1.nic.bi.rb +2 -2
  41. data/lib/whois/record/scanners/{nodable.rb → scannable.rb} +15 -7
  42. data/lib/whois/record/scanners/whois.centralnic.com.rb +0 -2
  43. data/lib/whois/record/scanners/whois.fi.rb +44 -0
  44. data/lib/whois/record/scanners/whois.srs.net.nz.rb +35 -0
  45. data/lib/whois/server/adapters/arin.rb +2 -3
  46. data/lib/whois/version.rb +2 -2
  47. data/whois.gemspec +5 -5
  48. metadata +19 -6
  49. checksums.yaml +0 -15
@@ -23,7 +23,10 @@ module Whois
23
23
  # @author Aliaksei Kliuchnikau <aliaksei.kliuchnikau@gmail.com>
24
24
  # @since 2.5.0
25
25
  class WhoisCctldBy < Base
26
- include Scanners::Nodable
26
+ include Scanners::Scannable
27
+
28
+ self.scanner = Scanners::WhoisCctldBy
29
+
27
30
 
28
31
  property_not_supported :disclaimer
29
32
 
@@ -88,16 +91,6 @@ module Whois
88
91
  end
89
92
  end
90
93
 
91
-
92
- # Initializes a new {Scanners::WhoisCctldBy} instance
93
- # passing the {#content_for_scanner}
94
- # and calls +parse+ on it.
95
- #
96
- # @return [Hash]
97
- def parse
98
- Scanners::WhoisCctldBy.new(content_for_scanner).parse
99
- end
100
-
101
94
  end
102
95
  end
103
96
  end
@@ -17,7 +17,9 @@ module Whois
17
17
 
18
18
  # Parser for the whois.centralnic.net server.
19
19
  class WhoisCentralnicCom < Base
20
- include Scanners::Nodable
20
+ include Scanners::Scannable
21
+
22
+ self.scanner = Scanners::WhoisCentralnicCom
21
23
 
22
24
 
23
25
  property_supported :disclaimer do
@@ -91,17 +93,7 @@ module Whois
91
93
  end
92
94
 
93
95
 
94
- # Initializes a new {Scanners::WhoisCentralnicCom} instance
95
- # passing the {#content_for_scanner}
96
- # and calls +parse+ on it.
97
- #
98
- # @return [Hash]
99
- def parse
100
- Scanners::WhoisCentralnicCom.new(content_for_scanner).parse
101
- end
102
-
103
-
104
- private
96
+ private
105
97
 
106
98
  def build_contact(element, type)
107
99
  node("#{element} ID") do
@@ -20,9 +20,11 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.5.0
24
23
  class WhoisCiraCa < Base
25
- include Scanners::Nodable
24
+ include Scanners::Scannable
25
+
26
+ self.scanner = Scanners::WhoisCiraCa
27
+
26
28
 
27
29
  property_supported :disclaimer do
28
30
  node("field:disclaimer")
@@ -129,19 +131,22 @@ module Whois
129
131
  end
130
132
 
131
133
 
132
- # Attempts to detect and returns the
133
- # schema version.
134
+ # Attempts to detect and returns the version.
134
135
  #
135
136
  # TODO: This is very empiric.
136
137
  # Use the available status in combination with the creation date label.
137
- def schema
138
- @schema ||= if content_for_scanner =~ /^% \(c\) (.+?) Canadian Internet Registration Authority/
139
- case $1
140
- when "2007" then "1"
141
- when "2010" then "2"
138
+ #
139
+ # NEWPROPERTY
140
+ def version
141
+ cached_properties_fetch :version do
142
+ version = if content_for_scanner =~ /^% \(c\) (.+?) Canadian Internet Registration Authority/
143
+ case $1
144
+ when "2007" then "1"
145
+ when "2010" then "2"
146
+ end
142
147
  end
148
+ version || Whois.bug!(ParserError, "Unable to detect version.")
143
149
  end
144
- @schema || Whois.bug!(ParserError, "Unable to detect schema version.")
145
150
  end
146
151
 
147
152
  # NEWPROPERTY
@@ -159,16 +164,6 @@ module Whois
159
164
  end
160
165
 
161
166
 
162
- # Initializes a new {Scanners::WhoisCiraCa} instance
163
- # passing the {#content_for_scanner}
164
- # and calls +parse+ on it.
165
- #
166
- # @return [Hash]
167
- def parse
168
- Scanners::WhoisCiraCa.new(content_for_scanner).parse
169
- end
170
-
171
-
172
167
  private
173
168
 
174
169
  def build_contact(element, type)
@@ -17,7 +17,9 @@ module Whois
17
17
 
18
18
  # Parser for the whois.cnnic.cn server.
19
19
  class WhoisCnnicCn < Base
20
- include Scanners::Nodable
20
+ include Scanners::Scannable
21
+
22
+ self.scanner = Scanners::WhoisCnnicCn
21
23
 
22
24
 
23
25
  property_not_supported :disclaimer
@@ -88,16 +90,6 @@ module Whois
88
90
  end
89
91
 
90
92
 
91
- # Initializes a new {Scanners::WhoisCnnicCn} instance
92
- # passing the {#content_for_scanner}
93
- # and calls +parse+ on it.
94
- #
95
- # @return [Hash]
96
- def parse
97
- Scanners::WhoisCnnicCn.new(content_for_scanner).parse
98
- end
99
-
100
-
101
93
  private
102
94
 
103
95
  def build_contact(element, type)
@@ -17,7 +17,10 @@ module Whois
17
17
 
18
18
  # Parser for the whois.crsnic.net server.
19
19
  class WhoisCrsnicNet < Base
20
- include Scanners::Nodable
20
+ include Scanners::Scannable
21
+
22
+ self.scanner = Scanners::Verisign
23
+
21
24
 
22
25
  property_supported :disclaimer do
23
26
  node("Disclaimer")
@@ -94,17 +97,7 @@ module Whois
94
97
  end
95
98
 
96
99
 
97
- # Initializes a new {Scanners::Verisign} instance
98
- # passing the {#content_for_scanner}
99
- # and calls +parse+ on it.
100
- #
101
- # @return [Hash]
102
- def parse
103
- Scanners::Verisign.new(content_for_scanner).parse
104
- end
105
-
106
-
107
- private
100
+ private
108
101
 
109
102
  # In case of "SPAM Response", the response contains more than one item
110
103
  # for the same value and the value becomes an Array.
@@ -21,7 +21,10 @@ module Whois
21
21
  # @author Aaron Mueller <mail@aaron-mueller.de>
22
22
  #
23
23
  class WhoisDenicDe < Base
24
- include Scanners::Nodable
24
+ include Scanners::Scannable
25
+
26
+ self.scanner = Scanners::WhoisDenicDe
27
+
25
28
 
26
29
  property_supported :disclaimer do
27
30
  node("Disclaimer")
@@ -147,16 +150,6 @@ module Whois
147
150
  end
148
151
 
149
152
 
150
- # Initializes a new {Scanners::WhoisDenicDe} instance
151
- # passing the {#content_for_scanner}
152
- # and calls +parse+ on it.
153
- #
154
- # @return [Hash]
155
- def parse
156
- Scanners::WhoisDenicDe.new(content_for_scanner).parse
157
- end
158
-
159
-
160
153
  private
161
154
 
162
155
  def build_contact(element, type)
@@ -20,9 +20,11 @@ module Whois
20
20
  # @see Whois::Record::Parser::Example
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
- # @since 2.4.0
24
23
  class WhoisDnsHr < Base
25
- include Scanners::Nodable
24
+ include Scanners::Scannable
25
+
26
+ self.scanner = Scanners::WhoisDnsHr
27
+
26
28
 
27
29
  property_not_supported :disclaimer
28
30
 
@@ -90,16 +92,6 @@ module Whois
90
92
 
91
93
  property_not_supported :nameservers
92
94
 
93
-
94
- # Initializes a new {Scanners::WhoisDnsHr} instance
95
- # passing the {#content_for_scanner}
96
- # and calls +parse+ on it.
97
- #
98
- # @return [Hash]
99
- def parse
100
- Scanners::WhoisDnsHr.new(content_for_scanner).parse
101
- end
102
-
103
95
  end
104
96
 
105
97
  end
@@ -96,8 +96,19 @@ module Whois
96
96
  end
97
97
  end
98
98
 
99
+ # Checks whether the response has been throttled.
100
+ #
101
+ # @return [Boolean]
102
+ #
103
+ # @example
104
+ # Looup quota exceeded.
105
+ #
106
+ def response_throttled?
107
+ !!(content_for_scanner =~ /^request limit exceeded for/)
108
+ end
109
+
99
110
 
100
- private
111
+ private
101
112
 
102
113
  def build_contact(element, type)
103
114
  match = content_for_scanner.slice(/#{element}:\n((.+\n)+)\n/, 1)
@@ -21,7 +21,10 @@ module Whois
21
21
  # The Example parser for the list of all available methods.
22
22
  #
23
23
  class WhoisDomainregistryIe < Base
24
- include Scanners::Nodable
24
+ include Scanners::Scannable
25
+
26
+ self.scanner = Scanners::WhoisDomainregistryIe
27
+
25
28
 
26
29
  property_supported :disclaimer do
27
30
  node("field:disclaimer")
@@ -100,16 +103,6 @@ module Whois
100
103
  end
101
104
 
102
105
 
103
- # Initializes a new {Scanners::WhoisDomainregistryIe} instance
104
- # passing the {#content_for_scanner}
105
- # and calls +parse+ on it.
106
- #
107
- # @return [Hash]
108
- def parse
109
- Scanners::WhoisDomainregistryIe.new(content_for_scanner).parse
110
- end
111
-
112
-
113
106
  private
114
107
 
115
108
  def build_contact(element, type)
@@ -8,6 +8,7 @@
8
8
 
9
9
 
10
10
  require 'whois/record/parser/base'
11
+ require 'whois/record/scanners/whois.fi.rb'
11
12
 
12
13
 
13
14
  module Whois
@@ -16,23 +17,34 @@ module Whois
16
17
 
17
18
  # Parser for the whois.fi server.
18
19
  #
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
20
  # @see Whois::Record::Parser::Example
24
21
  # The Example parser for the list of all available methods.
25
22
  #
26
- # @since 2.4.0
27
23
  class WhoisFi < Base
24
+ include Scanners::Scannable
25
+
26
+ self.scanner = Scanners::WhoisFi
27
+
28
+
29
+ property_supported :disclaimer do
30
+ node("field:disclaimer")
31
+ end
32
+
33
+
34
+ property_supported :domain do
35
+ node("domain")
36
+ end
37
+
38
+ property_not_supported :domain_id
39
+
28
40
 
29
41
  property_supported :status do
30
- if content_for_scanner =~ /status:\s+(.+?)\n/
31
- case $1.downcase
32
- when "granted"
33
- :registered
34
- else
35
- Whois.bug!(ParserError, "Unknown status `#{$1}'.")
42
+ if registered?
43
+ case node("status", &:downcase)
44
+ when "granted"
45
+ :registered
46
+ else
47
+ Whois.bug!(ParserError, "Unknown status `#{$1}'.")
36
48
  end
37
49
  else
38
50
  :available
@@ -40,7 +52,7 @@ module Whois
40
52
  end
41
53
 
42
54
  property_supported :available? do
43
- (status == :available)
55
+ !!node("status:available")
44
56
  end
45
57
 
46
58
  property_supported :registered? do
@@ -49,23 +61,45 @@ module Whois
49
61
 
50
62
 
51
63
  property_supported :created_on do
52
- if content_for_scanner =~ /created:\s+(.+)\n/
53
- Time.parse($1)
54
- end
64
+ node("created") { |value| Time.parse(value) }
55
65
  end
56
66
 
57
- property_not_supported :updated_on
67
+ property_supported :updated_on do
68
+ node("modified") { |value| Time.parse(value) }
69
+ end
58
70
 
59
71
  property_supported :expires_on do
60
- if content_for_scanner =~ /expires:\s+(.+)\n/
61
- Time.parse($1)
72
+ node("expires") { |value| Time.parse(value) }
73
+ end
74
+
75
+
76
+ property_not_supported :registrar
77
+
78
+ property_supported :registrant_contacts do
79
+ node("descr") do |array|
80
+ address = node("address")
81
+
82
+ Record::Contact.new(
83
+ type: Record::Contact::TYPE_REGISTRANT,
84
+ id: array[1],
85
+ name: address[0],
86
+ organization: array[0],
87
+ address: address[1],
88
+ zip: address[2],
89
+ city: address[3],
90
+ phone: node("phone")
91
+ )
62
92
  end
63
93
  end
64
94
 
95
+ property_not_supported :admin_contacts
96
+
97
+ property_not_supported :technical_contacts
98
+
65
99
 
66
100
  property_supported :nameservers do
67
- content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
68
- Record::Nameserver.new(:name => line.split(" ").first)
101
+ Array.wrap(node("nserver")).map do |line|
102
+ Record::Nameserver.new(name: line.split(" ").first)
69
103
  end
70
104
  end
71
105
 
@@ -17,7 +17,10 @@ module Whois
17
17
 
18
18
  # Parser for the whois.iana.org server.
19
19
  class WhoisIanaOrg < Base
20
- include Scanners::Nodable
20
+ include Scanners::Scannable
21
+
22
+ self.scanner = Scanners::Iana
23
+
21
24
 
22
25
  property_supported :status do
23
26
  if available?
@@ -72,16 +75,6 @@ module Whois
72
75
  end
73
76
 
74
77
 
75
- # Initializes a new {Scanners::Iana} instance
76
- # passing the {#content_for_scanner}
77
- # and calls +parse+ on it.
78
- #
79
- # @return [Hash]
80
- def parse
81
- Scanners::Iana.new(content_for_scanner).parse
82
- end
83
-
84
-
85
78
  private
86
79
 
87
80
  def build_contact(element, type)
@@ -45,6 +45,8 @@ module Whois
45
45
  :registered
46
46
  when "deleted"
47
47
  :suspended
48
+ when "reserved"
49
+ :reserved
48
50
  else
49
51
  Whois.bug!(ParserError, "Unknown status `#{$1}'.")
50
52
  end
@@ -61,6 +63,11 @@ module Whois
61
63
  !available?
62
64
  end
63
65
 
66
+ # NEWPROPERTY
67
+ def reserved?
68
+ status == :reserved
69
+ end
70
+
64
71
 
65
72
  # TODO: timezone ('Asia/Tokyo')
66
73
  property_supported :created_on do