whois 2.7.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/CHANGELOG.md +143 -0
  2. data/{LICENSE → LICENSE.txt} +1 -1
  3. data/README.md +28 -41
  4. data/bin/ruby-whois +14 -7
  5. data/data/ipv4.json +723 -0
  6. data/data/ipv6.json +100 -0
  7. data/data/tld.json +1302 -0
  8. data/lib/whois.rb +3 -3
  9. data/lib/whois/client.rb +17 -7
  10. data/lib/whois/core_ext.rb +0 -2
  11. data/lib/whois/errors.rb +13 -20
  12. data/lib/whois/record.rb +28 -22
  13. data/lib/whois/record/contact.rb +1 -1
  14. data/lib/whois/record/nameserver.rb +1 -1
  15. data/lib/whois/record/parser.rb +70 -46
  16. data/lib/whois/record/parser/base.rb +58 -59
  17. data/lib/whois/record/parser/base_afilias.rb +2 -7
  18. data/lib/whois/record/parser/base_cocca.rb +8 -5
  19. data/lib/whois/record/parser/base_cocca2.rb +107 -0
  20. data/lib/whois/record/parser/base_shared1.rb +2 -7
  21. data/lib/whois/record/parser/base_shared2.rb +2 -7
  22. data/lib/whois/record/parser/base_whoisd.rb +16 -9
  23. data/lib/whois/record/parser/blank.rb +1 -1
  24. data/lib/whois/record/parser/example.rb +1 -10
  25. data/lib/whois/record/parser/jobswhois.verisign-grs.com.rb +19 -19
  26. data/lib/whois/record/parser/kero.yachay.pe.rb +28 -18
  27. data/lib/whois/record/parser/whois.adamsnames.tc.rb +1 -1
  28. data/lib/whois/record/parser/whois.aeda.net.ae.rb +1 -1
  29. data/lib/whois/record/parser/whois.aero.rb +2 -2
  30. data/lib/whois/record/parser/whois.afilias-grs.info.rb +1 -1
  31. data/lib/whois/record/parser/whois.afilias.info.rb +1 -1
  32. data/lib/whois/record/parser/whois.ai.rb +1 -1
  33. data/lib/whois/record/parser/whois.arnes.si.rb +1 -1
  34. data/lib/whois/record/parser/whois.ati.tn.rb +3 -8
  35. data/lib/whois/record/parser/whois.audns.net.au.rb +4 -9
  36. data/lib/whois/record/parser/whois.ax.rb +66 -0
  37. data/lib/whois/record/parser/whois.biz.rb +1 -1
  38. data/lib/whois/record/parser/whois.cat.rb +1 -1
  39. data/lib/whois/record/parser/whois.cctld.by.rb +5 -8
  40. data/lib/whois/record/parser/whois.cctld.uz.rb +1 -1
  41. data/lib/whois/record/parser/whois.centralnic.com.rb +4 -9
  42. data/lib/whois/record/parser/whois.cira.ca.rb +3 -8
  43. data/lib/whois/record/parser/whois.cmc.iq.rb +7 -4
  44. data/lib/whois/record/parser/whois.cnnic.cn.rb +13 -21
  45. data/lib/whois/record/parser/whois.co.ca.rb +1 -1
  46. data/lib/whois/record/parser/whois.co.pl.rb +1 -6
  47. data/lib/whois/record/parser/whois.co.ug.rb +2 -2
  48. data/lib/whois/record/parser/whois.crsnic.net.rb +14 -15
  49. data/lib/whois/record/parser/whois.denic.de.rb +2 -2
  50. data/lib/whois/record/parser/whois.dk-hostmaster.dk.rb +2 -2
  51. data/lib/whois/record/parser/whois.dns.be.rb +2 -2
  52. data/lib/whois/record/parser/whois.dns.hr.rb +3 -8
  53. data/lib/whois/record/parser/whois.dns.lu.rb +1 -1
  54. data/lib/whois/record/parser/whois.dns.pl.rb +70 -9
  55. data/lib/whois/record/parser/whois.dns.pt.rb +16 -15
  56. data/lib/whois/record/parser/whois.domain-registry.nl.rb +2 -2
  57. data/lib/whois/record/parser/whois.domain.kg.rb +1 -1
  58. data/lib/whois/record/parser/whois.domainregistry.ie.rb +9 -12
  59. data/lib/whois/record/parser/whois.domainregistry.my.rb +1 -1
  60. data/lib/whois/record/parser/whois.domreg.lt.rb +1 -1
  61. data/lib/whois/record/parser/whois.dot.tk.rb +1 -1
  62. data/lib/whois/record/parser/whois.dotmobiregistry.net.rb +1 -1
  63. data/lib/whois/record/parser/whois.dreamhost.com.rb +1 -1
  64. data/lib/whois/record/parser/whois.educause.edu.rb +1 -6
  65. data/lib/whois/record/parser/whois.eenet.ee.rb +1 -1
  66. data/lib/whois/record/parser/whois.enom.com.rb +1 -1
  67. data/lib/whois/record/parser/whois.eu.org.rb +1 -1
  68. data/lib/whois/record/parser/whois.eu.rb +13 -1
  69. data/lib/whois/record/parser/whois.fi.rb +2 -2
  70. data/lib/whois/record/parser/whois.gg.rb +1 -1
  71. data/lib/whois/record/parser/whois.godaddy.com.rb +4 -4
  72. data/lib/whois/record/parser/whois.gov.za.rb +1 -1
  73. data/lib/whois/record/parser/whois.hkirc.hk.rb +1 -1
  74. data/lib/whois/record/parser/whois.iam.net.ma.rb +1 -1
  75. data/lib/whois/record/parser/whois.iana.org.rb +2 -2
  76. data/lib/whois/record/parser/whois.in.ua.rb +1 -1
  77. data/lib/whois/record/parser/whois.isnic.is.rb +1 -1
  78. data/lib/whois/record/parser/whois.isoc.org.il.rb +1 -1
  79. data/lib/whois/record/parser/whois.ja.net.rb +1 -1
  80. data/lib/whois/record/parser/whois.je.rb +1 -1
  81. data/lib/whois/record/parser/whois.jprs.jp.rb +9 -6
  82. data/lib/whois/record/parser/whois.kenic.or.ke.rb +1 -1
  83. data/lib/whois/record/parser/whois.kr.rb +1 -1
  84. data/lib/whois/record/parser/whois.markmonitor.com.rb +1 -1
  85. data/lib/whois/record/parser/whois.meregistry.net.rb +1 -1
  86. data/lib/whois/record/parser/whois.monic.mo.rb +1 -6
  87. data/lib/whois/record/parser/whois.museum.rb +1 -1
  88. data/lib/whois/record/parser/whois.na-nic.com.na.rb +3 -23
  89. data/lib/whois/record/parser/whois.nc.rb +8 -11
  90. data/lib/whois/record/parser/whois.netcom.cm.rb +1 -1
  91. data/lib/whois/record/parser/whois.networksolutions.com.rb +1 -1
  92. data/lib/whois/record/parser/whois.nic-se.se.rb +1 -1
  93. data/lib/whois/record/parser/whois.nic.ac.rb +1 -6
  94. data/lib/whois/record/parser/whois.nic.af.rb +7 -3
  95. data/lib/whois/record/parser/whois.nic.ag.rb +1 -1
  96. data/lib/whois/record/parser/whois.nic.am.rb +1 -1
  97. data/lib/whois/record/parser/whois.nic.as.rb +1 -1
  98. data/lib/whois/record/parser/whois.nic.asia.rb +1 -1
  99. data/lib/whois/record/parser/whois.nic.at.rb +7 -9
  100. data/lib/whois/record/parser/whois.nic.bo.rb +1 -1
  101. data/lib/whois/record/parser/whois.nic.cc.rb +11 -11
  102. data/lib/whois/record/parser/whois.nic.cd.rb +1 -1
  103. data/lib/whois/record/parser/whois.nic.ch.rb +1 -1
  104. data/lib/whois/record/parser/whois.nic.ci.rb +1 -1
  105. data/lib/whois/record/parser/whois.nic.ck.rb +1 -1
  106. data/lib/whois/record/parser/whois.nic.cl.rb +1 -1
  107. data/lib/whois/record/parser/whois.nic.co.rb +1 -1
  108. data/lib/whois/record/parser/whois.nic.coop.rb +1 -1
  109. data/lib/whois/record/parser/whois.nic.cx.rb +7 -3
  110. data/lib/whois/record/parser/whois.nic.cz.rb +8 -3
  111. data/lib/whois/record/parser/whois.nic.dm.rb +3 -8
  112. data/lib/whois/record/parser/whois.nic.dz.rb +1 -1
  113. data/lib/whois/record/parser/whois.nic.ec.rb +1 -1
  114. data/lib/whois/record/parser/whois.nic.fo.rb +2 -2
  115. data/lib/whois/record/parser/whois.nic.fr.rb +1 -1
  116. data/lib/whois/record/parser/whois.nic.gl.rb +5 -1
  117. data/lib/whois/record/parser/whois.nic.gov.rb +11 -12
  118. data/lib/whois/record/parser/whois.nic.gs.rb +7 -23
  119. data/lib/whois/record/parser/whois.nic.hn.rb +28 -0
  120. data/lib/whois/record/parser/whois.nic.ht.rb +7 -3
  121. data/lib/whois/record/parser/whois.nic.hu.rb +2 -2
  122. data/lib/whois/record/parser/whois.nic.im.rb +1 -1
  123. data/lib/whois/record/parser/whois.nic.io.rb +1 -6
  124. data/lib/whois/record/parser/whois.nic.ir.rb +1 -1
  125. data/lib/whois/record/parser/whois.nic.it.rb +2 -7
  126. data/lib/whois/record/parser/whois.nic.ki.rb +7 -3
  127. data/lib/whois/record/parser/whois.nic.kz.rb +9 -12
  128. data/lib/whois/record/parser/whois.nic.la.rb +3 -2
  129. data/lib/whois/record/parser/whois.nic.li.rb +1 -1
  130. data/lib/whois/record/parser/whois.nic.lk.rb +3 -9
  131. data/lib/whois/record/parser/whois.nic.lv.rb +1 -1
  132. data/lib/whois/record/parser/whois.nic.ly.rb +1 -1
  133. data/lib/whois/record/parser/whois.nic.md.rb +1 -6
  134. data/lib/whois/record/parser/whois.nic.mg.rb +1 -1
  135. data/lib/whois/record/parser/whois.nic.ms.rb +7 -3
  136. data/lib/whois/record/parser/whois.nic.mu.rb +7 -3
  137. data/lib/whois/record/parser/whois.nic.mx.rb +1 -1
  138. data/lib/whois/record/parser/whois.nic.name.rb +2 -2
  139. data/lib/whois/record/parser/whois.nic.net.nf.rb +7 -42
  140. data/lib/whois/record/parser/whois.nic.net.ng.rb +3 -3
  141. data/lib/whois/record/parser/whois.nic.net.sa.rb +1 -1
  142. data/lib/whois/record/parser/whois.nic.net.sb.rb +7 -3
  143. data/lib/whois/record/parser/whois.nic.nu.rb +1 -1
  144. data/lib/whois/record/parser/whois.nic.org.uy.rb +1 -1
  145. data/lib/whois/record/parser/whois.nic.pr.rb +32 -14
  146. data/lib/whois/record/parser/whois.nic.priv.at.rb +1 -1
  147. data/lib/whois/record/parser/whois.nic.pw.rb +27 -0
  148. data/lib/whois/record/parser/whois.nic.sh.rb +1 -6
  149. data/lib/whois/record/parser/whois.nic.sl.rb +1 -1
  150. data/lib/whois/record/parser/whois.nic.sm.rb +1 -1
  151. data/lib/whois/record/parser/whois.nic.sn.rb +1 -6
  152. data/lib/whois/record/parser/whois.nic.so.rb +1 -1
  153. data/lib/whois/record/parser/whois.nic.st.rb +1 -1
  154. data/lib/whois/record/parser/whois.nic.tel.rb +5 -54
  155. data/lib/whois/record/parser/whois.nic.tl.rb +7 -3
  156. data/lib/whois/record/parser/whois.nic.tm.rb +1 -6
  157. data/lib/whois/record/parser/whois.nic.tr.rb +1 -1
  158. data/lib/whois/record/parser/whois.nic.travel.rb +5 -50
  159. data/lib/whois/record/parser/whois.nic.tv.rb +11 -12
  160. data/lib/whois/record/parser/whois.nic.uk.rb +18 -20
  161. data/lib/whois/record/parser/whois.nic.us.rb +5 -50
  162. data/lib/whois/record/parser/whois.nic.ve.rb +1 -1
  163. data/lib/whois/record/parser/whois.nic.xxx.rb +1 -1
  164. data/lib/whois/record/parser/whois.norid.no.rb +1 -1
  165. data/lib/whois/record/parser/whois.org.za.rb +1 -6
  166. data/lib/whois/record/parser/whois.pandi.or.id.rb +1 -1
  167. data/lib/whois/record/parser/whois.pir.org.rb +1 -1
  168. data/lib/whois/record/parser/whois.pnina.ps.rb +1 -1
  169. data/lib/whois/record/parser/whois.register.bg.rb +1 -1
  170. data/lib/whois/record/parser/whois.register.com.rb +2 -2
  171. data/lib/whois/record/parser/whois.registro.br.rb +1 -1
  172. data/lib/whois/record/parser/whois.registry.gy.rb +7 -3
  173. data/lib/whois/record/parser/whois.registry.hm.rb +1 -1
  174. data/lib/whois/record/parser/whois.registry.in.rb +1 -1
  175. data/lib/whois/record/parser/whois.registry.net.za.rb +123 -0
  176. data/lib/whois/record/parser/whois.registry.om.rb +2 -2
  177. data/lib/whois/record/parser/whois.registry.qa.rb +1 -1
  178. data/lib/whois/record/parser/whois.registrypro.pro.rb +2 -2
  179. data/lib/whois/record/parser/whois.ripe.net.rb +1 -1
  180. data/lib/whois/record/parser/whois.rnids.rs.rb +3 -8
  181. data/lib/whois/record/parser/whois.rotld.ro.rb +1 -1
  182. data/lib/whois/record/parser/whois.samoanic.ws.rb +1 -1
  183. data/lib/whois/record/parser/whois.sgnic.sg.rb +1 -1
  184. data/lib/whois/record/parser/whois.sk-nic.sk.rb +1 -1
  185. data/lib/whois/record/parser/whois.smallregistry.net.rb +2 -2
  186. data/lib/whois/record/parser/whois.srs.net.nz.rb +1 -1
  187. data/lib/whois/record/parser/whois.sx.rb +50 -32
  188. data/lib/whois/record/parser/whois.tcinet.ru.rb +2 -2
  189. data/lib/whois/record/parser/whois.thnic.co.th.rb +5 -5
  190. data/lib/whois/record/parser/whois.tld.ee.rb +2 -2
  191. data/lib/whois/record/parser/whois.tonic.to.rb +1 -6
  192. data/lib/whois/record/parser/whois.twnic.net.tw.rb +1 -1
  193. data/lib/whois/record/parser/whois.tznic.or.tz.rb +2 -2
  194. data/lib/whois/record/parser/whois.ua.rb +1 -6
  195. data/lib/whois/record/parser/whois.usp.ac.fj.rb +1 -1
  196. data/lib/whois/record/parser/whois.za.net.rb +1 -1
  197. data/lib/whois/record/parser/whois.za.org.rb +1 -1
  198. data/lib/whois/record/parser/whois1.nic.bi.rb +5 -1
  199. data/lib/whois/record/part.rb +1 -1
  200. data/lib/whois/record/registrar.rb +1 -1
  201. data/lib/whois/record/scanners/base.rb +1 -1
  202. data/lib/whois/record/scanners/base_afilias.rb +1 -1
  203. data/lib/whois/record/scanners/base_shared1.rb +1 -1
  204. data/lib/whois/record/scanners/base_shared2.rb +1 -2
  205. data/lib/whois/record/scanners/base_whoisd.rb +4 -4
  206. data/lib/whois/record/scanners/iana.rb +1 -1
  207. data/lib/whois/record/scanners/{ast.rb → nodable.rb} +4 -4
  208. data/lib/whois/record/scanners/verisign.rb +1 -1
  209. data/lib/whois/record/scanners/whois.ati.tn.rb +1 -1
  210. data/lib/whois/record/scanners/whois.audns.net.au.rb +1 -1
  211. data/lib/whois/record/scanners/whois.cctld.by.rb +3 -1
  212. data/lib/whois/record/scanners/whois.centralnic.com.rb +1 -1
  213. data/lib/whois/record/scanners/whois.cira.ca.rb +1 -1
  214. data/lib/whois/record/scanners/whois.cnnic.cn.rb +6 -3
  215. data/lib/whois/record/scanners/whois.denic.de.rb +1 -1
  216. data/lib/whois/record/scanners/whois.dns.hr.rb +1 -1
  217. data/lib/whois/record/scanners/whois.domainregistry.ie.rb +3 -1
  218. data/lib/whois/record/scanners/whois.nc.rb +1 -1
  219. data/lib/whois/record/scanners/whois.nic.dm.rb +1 -1
  220. data/lib/whois/record/scanners/whois.nic.hu.rb +1 -1
  221. data/lib/whois/record/scanners/whois.nic.it.rb +1 -1
  222. data/lib/whois/record/scanners/whois.registry.net.za.rb +103 -0
  223. data/lib/whois/record/scanners/whois.rnids.rs.rb +1 -1
  224. data/lib/whois/record/scanners/whois.smallregistry.net.rb +1 -1
  225. data/lib/whois/record/scanners/whois.sx.rb +14 -46
  226. data/lib/whois/record/super_struct.rb +1 -1
  227. data/lib/whois/server.rb +18 -4
  228. data/lib/whois/server/adapters/afilias.rb +8 -13
  229. data/lib/whois/server/adapters/arpa.rb +1 -1
  230. data/lib/whois/server/adapters/base.rb +24 -44
  231. data/lib/whois/server/adapters/formatted.rb +1 -1
  232. data/lib/whois/server/adapters/none.rb +1 -1
  233. data/lib/whois/server/adapters/not_implemented.rb +1 -1
  234. data/lib/whois/server/adapters/standard.rb +1 -1
  235. data/lib/whois/server/adapters/verisign.rb +11 -19
  236. data/lib/whois/server/adapters/web.rb +2 -5
  237. data/lib/whois/server/socket_handler.rb +66 -0
  238. data/lib/whois/version.rb +3 -3
  239. data/whois.gemspec +11 -11
  240. metadata +24 -29
  241. data/lib/whois/core_ext/date_time/conversions.rb +0 -14
  242. data/lib/whois/definitions/ipv4.rb +0 -240
  243. data/lib/whois/definitions/ipv6.rb +0 -32
  244. data/lib/whois/definitions/tlds.rb +0 -367
  245. data/lib/whois/record/parser/saudinic.net.sa.rb +0 -23
  246. data/lib/whois/record/parser/whois.ausregistry.net.au.rb +0 -23
  247. data/lib/whois/record/parser/whois.centralnic.net.rb +0 -25
  248. data/lib/whois/record/parser/whois.cnnic.net.cn.rb +0 -23
  249. data/lib/whois/record/parser/whois.coza.net.za.rb +0 -76
  250. data/lib/whois/record/parser/whois.ficora.fi.rb +0 -24
  251. data/lib/whois/record/parser/whois.hkdnr.net.hk.rb +0 -23
  252. data/lib/whois/record/parser/whois.net.ua.rb +0 -24
  253. data/lib/whois/record/parser/whois.nic.or.kr.rb +0 -24
  254. data/lib/whois/record/parser/whois.publicinterestregistry.net.rb +0 -23
  255. data/lib/whois/record/parser/whois.ripn.net.rb +0 -23
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -17,7 +17,7 @@ module Whois
17
17
 
18
18
  # Parser for the whois.nic.tv server.
19
19
  class WhoisNicTv < Base
20
- include Scanners::Ast
20
+ include Scanners::Nodable
21
21
 
22
22
  property_supported :disclaimer do
23
23
  node("Disclaimer")
@@ -31,16 +31,6 @@ module Whois
31
31
  property_not_supported :domain_id
32
32
 
33
33
 
34
-
35
- property_supported :referral_whois do
36
- node("Whois Server")
37
- end
38
-
39
- property_supported :referral_url do
40
- node("Referral URL")
41
- end
42
-
43
-
44
34
  property_supported :status do
45
35
  node("Status")
46
36
  end
@@ -81,6 +71,15 @@ module Whois
81
71
  end
82
72
 
83
73
 
74
+ def referral_whois
75
+ node("Whois Server")
76
+ end
77
+
78
+ def referral_url
79
+ node("Referral URL")
80
+ end
81
+
82
+
84
83
  # Initializes a new {Scanners::Verisign} instance
85
84
  # passing the {#content_for_scanner}
86
85
  # and calls +parse+ on it.
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -14,16 +14,11 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.uk parser
19
- #
20
17
  # Parser for the whois.nic.uk 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.
27
22
  #
28
23
  # @see http://www.nominet.org.uk/other/whois/detailedinstruct/
29
24
  #
@@ -88,23 +83,26 @@ module Whois
88
83
 
89
84
  # @see http://www.nic.uk/other/whois/instruct/
90
85
  property_supported :registrar do
91
- if content_for_scanner =~ /Registrar:\n(.+) \[Tag = (.+)\]\n\s*URL: (.+)\n/
92
- name, id, url = $1.strip, $2.strip, $3.strip
93
- org, name = name.split(" t/a ")
86
+ if content_for_scanner =~ /Registrar:\n((.+\n)+)\n/
87
+ content = $1.strip
88
+ id = name = org = url = nil
89
+
90
+ if content =~ /Tag =/
91
+ name, id = (content =~ /(.+) \[Tag = (.+)\]/) && [$1.strip, $2.strip]
92
+ org, name = name.split(" t/a ")
93
+ url = (content =~ /URL: (.+)/) && $1.strip
94
+ elsif content =~ /This domain is registered directly with Nominet/
95
+ name = "Nominet"
96
+ org = "Nominet UK"
97
+ url = "http://www.nic.uk/"
98
+ end
94
99
 
95
100
  Record::Registrar.new(
96
101
  :id => id,
97
- :name => (name || org),
102
+ :name => name || org,
98
103
  :organization => org,
99
104
  :url => url
100
105
  )
101
- elsif content_for_scanner =~ /This domain is registered directly with Nominet/
102
- Record::Registrar.new(
103
- :id => nil,
104
- :name => "Nominet",
105
- :organization => "Nominet UK",
106
- :url => "http://www.nic.uk/"
107
- )
108
106
  end
109
107
  end
110
108
 
@@ -3,68 +3,23 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/base_shared2'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.nic.us parser
19
- #
20
17
  # Parser for the whois.nic.us 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 WhoisNicUs < Base
29
-
30
- property_supported :status do
31
- content_for_scanner.scan(/Domain Status:\s+(.+?)\n/).flatten
32
- end
33
-
34
- property_supported :available? do
35
- !!(content_for_scanner =~ /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 =~ /Domain Registration Date:\s+(.+?)\n/
45
- Time.parse($1)
46
- end
47
- end
48
-
49
- property_supported :updated_on do
50
- if content_for_scanner =~ /Domain Last Updated Date:\s+(.+?)\n/
51
- Time.parse($1)
52
- end
53
- end
54
-
55
- property_supported :expires_on do
56
- if content_for_scanner =~ /Domain Expiration Date:\s+(.+?)\n/
57
- Time.parse($1)
58
- end
59
- end
60
-
61
-
62
- property_supported :nameservers do
63
- content_for_scanner.scan(/Name Server:\s+(.+)\n/).flatten.map do |name|
64
- Record::Nameserver.new(:name => name.downcase)
65
- end
66
- end
67
-
22
+ class WhoisNicUs < BaseShared2
68
23
  end
69
24
 
70
25
  end
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -29,11 +29,6 @@ module Whois
29
29
  property_not_supported :domain_id
30
30
 
31
31
 
32
- property_not_supported :referral_whois
33
-
34
- property_not_supported :referral_url
35
-
36
-
37
32
  property_supported :status do
38
33
  if available?
39
34
  :available
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -69,7 +69,7 @@ module Whois
69
69
 
70
70
 
71
71
  property_supported :nameservers do
72
- if content_for_scanner =~ /(?:DNS|Name) Servers:\n((.+\n)+)\n/
72
+ if content_for_scanner =~ /(?:DNS|Name) Servers:\n((?:\s+.+\n)+)(?:\s+)\n/
73
73
  $1.split("\n").map do |line|
74
74
  Record::Nameserver.new(:name => line.strip)
75
75
  end
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,11 +3,11 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
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
@@ -15,7 +15,11 @@ module Whois
15
15
  class Parser
16
16
 
17
17
  # Parser for the whois.registry.gy server.
18
- class WhoisRegistryGy < BaseCocca
18
+ #
19
+ # @see Whois::Record::Parser::Example
20
+ # The Example parser for the list of all available methods.
21
+ #
22
+ class WhoisRegistryGy < BaseCocca2
19
23
  end
20
24
 
21
25
  end
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # An intelligent pure Ruby WHOIS client and parser.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
 
@@ -0,0 +1,123 @@
1
+ require 'whois/record/parser/base'
2
+ require 'whois/record/scanners/whois.registry.net.za'
3
+
4
+
5
+ module Whois
6
+ class Record
7
+ class Parser
8
+ # Parser for the whois.registry.za.net server.
9
+ #
10
+ # @note This parser is just a stub and provides only a few basic methods
11
+ # to check for domain availability and get domain status.
12
+ # Please consider to contribute implementing missing methods.
13
+ #
14
+ # @see Whois::Record::Parser::Example
15
+ # The Example parser for the list of all available methods.
16
+ #
17
+ class WhoisRegistryNetZa < Base
18
+ include Scanners::Nodable
19
+
20
+ property_supported :disclaimer do
21
+ node("field:disclaimer")
22
+ end
23
+
24
+
25
+ property_supported :domain do
26
+ node("field:domain_name")
27
+ end
28
+
29
+ property_not_supported :domain_id
30
+
31
+
32
+ property_supported :status do
33
+ node("field:status")
34
+ end
35
+
36
+ property_supported :available? do
37
+ node("status:available") ? true : false
38
+ end
39
+
40
+ property_supported :registered? do
41
+ !available?
42
+ end
43
+
44
+
45
+ property_supported :created_on do
46
+ node("field:dates") do
47
+ node("field:dates") =~ /Registration Date:\s*(\d{4}-\d{2}-\d{2})/
48
+ parse_date($1)
49
+ end
50
+ end
51
+
52
+ property_not_supported :updated_on
53
+
54
+ property_supported :expires_on do
55
+ node("field:dates") do
56
+ node("field:dates") =~ /Renewal Date:\s*(\d{4}-\d{2}-\d{2})/
57
+ parse_date($1)
58
+ end
59
+ end
60
+
61
+
62
+ property_supported :registrar do
63
+ node("field:registrar") do
64
+ node("field:registrar") =~ /(.+) \[ ID = (.+) \]/
65
+ Whois::Record::Registrar.new(:name => $1.strip, :id => $2.strip)
66
+ end
67
+ end
68
+
69
+ property_supported :registrant_contacts do
70
+ node("field:registrant_details") do
71
+ build_registrant_contacts
72
+ end
73
+ end
74
+
75
+ property_not_supported :admin_contacts
76
+
77
+ property_not_supported :technical_contacts
78
+
79
+
80
+ property_supported :nameservers do
81
+ node("field:nameservers") do
82
+ nameservers = node("field:nameservers").gsub(/\n\s+/, ",").split(",")
83
+ Array.wrap(nameservers).map do |nameserver|
84
+ Record::Nameserver.new(:name => nameserver)
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+ def parse
91
+ Scanners::WhoisRegistryNetZa.new(content_for_scanner).parse
92
+ end
93
+
94
+
95
+ private
96
+
97
+ def build_registrant_contacts
98
+ Whois::Record::Contact.new(
99
+ {:type => Whois::Record::Contact::TYPE_REGISTRANT}.merge(registrant_details).merge(registrant_address_details)
100
+ )
101
+ end
102
+
103
+ def registrant_details
104
+ registrant_lines = node("field:registrant_details").split("\n")
105
+ details = { :name => registrant_lines.shift }
106
+ [:email, :phone, :fax].each do |contact_method|
107
+ details[contact_method] = registrant_lines.shift.split(":").last.strip
108
+ end
109
+ details
110
+ end
111
+
112
+ def registrant_address_details
113
+ { :address => node("field:registrant_address").gsub(/\n\s+/, " ") }
114
+ end
115
+
116
+ def parse_date(date_string)
117
+ Time.parse(date_string) if date_string
118
+ end
119
+
120
+ end
121
+ end
122
+ end
123
+ end