whois 2.0.7 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/CHANGELOG.rdoc +84 -10
  2. data/Rakefile +0 -7
  3. data/lib/core_ext.rb +9 -45
  4. data/lib/core_ext/array/extract_options.rb +29 -0
  5. data/lib/core_ext/array/wrap.rb +48 -0
  6. data/lib/core_ext/class/attribute.rb +115 -0
  7. data/lib/core_ext/date_time/conversions.rb +15 -0
  8. data/lib/core_ext/kernel/singleton_class.rb +13 -0
  9. data/lib/core_ext/module/remove_method.rb +16 -0
  10. data/lib/whois.rb +0 -4
  11. data/lib/whois/definitions/tlds.rb +10 -5
  12. data/lib/whois/record.rb +0 -3
  13. data/lib/whois/record/parser.rb +3 -3
  14. data/lib/whois/record/parser/NOTES.txt +15 -8
  15. data/lib/whois/record/parser/base.rb +12 -35
  16. data/lib/whois/record/parser/base_afilias.rb +156 -0
  17. data/lib/whois/record/parser/example.rb +8 -4
  18. data/lib/whois/record/parser/jobswhois.verisign-grs.com.rb +2 -2
  19. data/lib/whois/record/parser/scanners/afilias.rb +13 -4
  20. data/lib/whois/record/parser/{features → scanners}/ast.rb +1 -1
  21. data/lib/whois/record/parser/scanners/base.rb +9 -0
  22. data/lib/whois/record/parser/scanners/cnnic.rb +2 -2
  23. data/lib/whois/record/parser/scanners/{whoisbiz.rb → whois.biz.rb} +2 -8
  24. data/lib/whois/record/parser/scanners/whois.denic.de.rb +117 -0
  25. data/lib/whois/record/parser/scanners/whois.nic.hu.rb +187 -0
  26. data/lib/whois/record/parser/scanners/{whoisit.rb → whois.nic.it.rb} +2 -2
  27. data/lib/whois/record/parser/scanners/whois.registry.qa.rb +54 -0
  28. data/lib/whois/record/parser/scanners/whois.tld.ee.rb +41 -0
  29. data/lib/whois/record/parser/whois.aero.rb +8 -46
  30. data/lib/whois/record/parser/whois.afilias-grs.info.rb +2 -51
  31. data/lib/whois/record/parser/whois.afilias.info.rb +2 -126
  32. data/lib/whois/record/parser/whois.biz.rb +6 -6
  33. data/lib/whois/record/parser/whois.cnnic.cn.rb +5 -5
  34. data/lib/whois/record/parser/whois.crsnic.net.rb +2 -2
  35. data/lib/whois/record/parser/whois.denic.de.rb +8 -105
  36. data/lib/whois/record/parser/whois.dotmobiregistry.net.rb +2 -51
  37. data/lib/whois/record/parser/whois.godaddy.com.rb +138 -0
  38. data/lib/whois/record/parser/whois.iana.org.rb +2 -2
  39. data/lib/whois/record/parser/whois.markmonitor.com.rb +13 -12
  40. data/lib/whois/record/parser/whois.meregistry.net.rb +45 -30
  41. data/lib/whois/record/parser/whois.nic.af.rb +6 -2
  42. data/lib/whois/record/parser/whois.nic.ag.rb +2 -51
  43. data/lib/whois/record/parser/whois.nic.asia.rb +47 -38
  44. data/lib/whois/record/parser/whois.nic.cc.rb +2 -2
  45. data/lib/whois/record/parser/whois.nic.hu.rb +7 -174
  46. data/lib/whois/record/parser/whois.nic.it.rb +6 -6
  47. data/lib/whois/record/parser/whois.nic.name.rb +1 -5
  48. data/lib/whois/record/parser/whois.nic.travel.rb +4 -12
  49. data/lib/whois/record/parser/whois.nic.tv.rb +2 -2
  50. data/lib/whois/record/parser/whois.nic.us.rb +4 -4
  51. data/lib/whois/record/parser/whois.nic.xxx.rb +5 -112
  52. data/lib/whois/record/parser/whois.publicinterestregistry.net.rb +8 -168
  53. data/lib/whois/record/parser/whois.registry.in.rb +2 -60
  54. data/lib/whois/record/parser/whois.registry.qa.rb +117 -0
  55. data/lib/whois/record/parser/whois.ripn.net.rb +4 -84
  56. data/lib/whois/record/parser/whois.sgnic.sg.rb +13 -5
  57. data/lib/whois/record/parser/whois.tcinet.ru.rb +102 -0
  58. data/lib/whois/record/parser/whois.tld.ee.rb +5 -26
  59. data/lib/whois/record/parser/whois.tonic.to.rb +0 -8
  60. data/lib/whois/server/adapters/base.rb +23 -10
  61. data/lib/whois/version.rb +2 -2
  62. data/spec/fixtures/responses/FIND.txt +1 -0
  63. data/spec/fixtures/responses/whois.aero/status_available.expected +35 -1
  64. data/spec/fixtures/responses/whois.aero/status_registered.expected +77 -1
  65. data/spec/fixtures/responses/whois.afilias-grs.info/bz/status_available.expected +34 -0
  66. data/spec/fixtures/responses/whois.afilias-grs.info/bz/status_registered.expected +39 -2
  67. data/spec/fixtures/responses/whois.afilias-grs.info/bz/status_registered.txt +2 -82
  68. data/spec/fixtures/responses/whois.afilias-grs.info/gi/status_available.expected +34 -0
  69. data/spec/fixtures/responses/whois.afilias-grs.info/gi/status_registered.expected +76 -0
  70. data/spec/fixtures/responses/whois.afilias-grs.info/hn/status_available.expected +34 -0
  71. data/spec/fixtures/responses/whois.afilias-grs.info/hn/status_registered.expected +76 -0
  72. data/spec/fixtures/responses/whois.afilias-grs.info/lc/status_available.expected +34 -0
  73. data/spec/fixtures/responses/whois.afilias-grs.info/lc/status_registered.expected +76 -0
  74. data/spec/fixtures/responses/whois.afilias-grs.info/mn/status_available.expected +34 -0
  75. data/spec/fixtures/responses/whois.afilias-grs.info/mn/status_registered.expected +76 -0
  76. data/spec/fixtures/responses/whois.afilias-grs.info/sc/status_available.expected +57 -0
  77. data/spec/fixtures/responses/whois.afilias-grs.info/sc/status_registered.expected +76 -0
  78. data/spec/fixtures/responses/whois.afilias-grs.info/vc/status_available.expected +34 -0
  79. data/spec/fixtures/responses/whois.afilias-grs.info/vc/status_registered.expected +76 -0
  80. data/spec/fixtures/responses/whois.dotmobiregistry.net/status_available.expected +35 -0
  81. data/spec/fixtures/responses/whois.dotmobiregistry.net/status_available.txt +1 -25
  82. data/spec/fixtures/responses/whois.dotmobiregistry.net/status_registered.expected +76 -0
  83. data/spec/fixtures/responses/whois.educause.edu/{properties_updated_on_unknown.expected → property_updated_on_unknown.expected} +0 -0
  84. data/spec/fixtures/responses/whois.educause.edu/{properties_updated_on_unknown.txt → property_updated_on_unknown.txt} +0 -0
  85. data/spec/fixtures/responses/whois.godaddy.com/status_registered.expected +87 -0
  86. data/spec/fixtures/responses/whois.godaddy.com/status_registered.txt +60 -0
  87. data/spec/fixtures/responses/whois.markmonitor.com/{properties_empty_contacts.expected → property_contacts_are_blank.expected} +0 -0
  88. data/spec/fixtures/responses/whois.markmonitor.com/{properties_empty_contacts.txt → property_contacts_are_blank.txt} +0 -0
  89. data/spec/fixtures/responses/whois.meregistry.net/{property_nameservers_is_missing.expected → property_nameservers_is_blank.expected} +0 -0
  90. data/spec/fixtures/responses/whois.meregistry.net/{property_nameservers_is_missing.txt → property_nameservers_is_blank.txt} +0 -0
  91. data/spec/fixtures/responses/whois.meregistry.net/status_available.expected +34 -0
  92. data/spec/fixtures/responses/whois.meregistry.net/status_registered.expected +77 -0
  93. data/spec/fixtures/responses/whois.meregistry.net/status_registered.txt +1 -1
  94. data/spec/fixtures/responses/{whois.nic.asia/property_status_client_delete_prohibited.expected → whois.nic.af/property_status_active.expected} +0 -0
  95. data/spec/fixtures/responses/whois.nic.af/property_status_active.txt +56 -0
  96. data/spec/fixtures/responses/{whois.nic.asia/property_status_client_transfer_prohibited.expected → whois.nic.af/property_status_delegated.expected} +0 -0
  97. data/spec/fixtures/responses/whois.nic.af/property_status_delegated.txt +46 -0
  98. data/spec/fixtures/responses/whois.nic.af/property_status_not_registered.expected +8 -0
  99. data/spec/fixtures/responses/whois.nic.af/property_status_not_registered.txt +13 -0
  100. data/spec/fixtures/responses/whois.nic.ag/status_available.expected +34 -0
  101. data/spec/fixtures/responses/whois.nic.ag/status_registered.expected +76 -0
  102. data/spec/fixtures/responses/whois.nic.asia/property_status_multiple.expected +8 -0
  103. data/spec/fixtures/responses/whois.nic.asia/{property_status_client_delete_prohibited.txt → property_status_multiple.txt} +0 -0
  104. data/spec/fixtures/responses/whois.nic.asia/property_status_single.expected +8 -0
  105. data/spec/fixtures/responses/whois.nic.asia/{property_status_client_transfer_prohibited.txt → property_status_single.txt} +76 -76
  106. data/spec/fixtures/responses/whois.nic.asia/status_available.expected +35 -1
  107. data/spec/fixtures/responses/whois.nic.asia/status_registered.expected +78 -1
  108. data/spec/fixtures/responses/whois.nic.dz/{status_available.expected → dz/status_available.expected} +0 -0
  109. data/spec/fixtures/responses/whois.nic.dz/{status_available.txt → dz/status_available.txt} +0 -0
  110. data/spec/fixtures/responses/whois.nic.dz/{status_registered.expected → dz/status_registered.expected} +0 -0
  111. data/spec/fixtures/responses/whois.nic.dz/{status_registered.txt → dz/status_registered.txt} +0 -0
  112. data/spec/fixtures/responses/whois.nic.name/status_available.expected +1 -1
  113. data/spec/fixtures/responses/whois.nic.name/status_registered.expected +1 -1
  114. data/spec/fixtures/responses/whois.nic.travel/property_status_multiple.expected +2 -0
  115. data/spec/fixtures/responses/whois.nic.travel/property_status_multiple.txt +83 -0
  116. data/spec/fixtures/responses/whois.nic.travel/property_status_single.expected +2 -0
  117. data/spec/fixtures/responses/whois.nic.travel/property_status_single.txt +75 -0
  118. data/spec/fixtures/responses/whois.nic.travel/status_available.expected +1 -1
  119. data/spec/fixtures/responses/whois.nic.travel/status_registered.expected +1 -1
  120. data/spec/fixtures/responses/whois.nic.xxx/property_updated_on_blank.expected +2 -0
  121. data/spec/fixtures/responses/whois.nic.xxx/property_updated_on_blank.txt +98 -0
  122. data/spec/fixtures/responses/whois.nic.xxx/status_registered.expected +45 -46
  123. data/spec/fixtures/responses/whois.nic.xxx/status_registered.txt +61 -61
  124. data/spec/fixtures/responses/whois.publicinterestregistry.net/status_available.expected +1 -1
  125. data/spec/fixtures/responses/whois.publicinterestregistry.net/status_registered.expected +8 -1
  126. data/spec/fixtures/responses/whois.registry.in/property_status_missing.expected +1 -1
  127. data/spec/fixtures/responses/whois.registry.in/property_status_multiple.expected +1 -1
  128. data/spec/fixtures/responses/whois.registry.in/property_status_ok.expected +1 -1
  129. data/spec/fixtures/responses/whois.registry.in/status_available.expected +31 -1
  130. data/spec/fixtures/responses/whois.registry.in/status_registered.expected +70 -1
  131. data/spec/fixtures/responses/whois.registry.qa/qa/status_available.expected +56 -0
  132. data/spec/fixtures/responses/whois.registry.qa/qa/status_available.txt +1 -0
  133. data/spec/fixtures/responses/whois.registry.qa/qa/status_registered.expected +91 -0
  134. data/spec/fixtures/responses/whois.registry.qa/qa/status_registered.txt +23 -0
  135. data/spec/fixtures/responses/whois.sgnic.sg/property_nameservers_schema_1_with_ip.expected +12 -0
  136. data/spec/fixtures/responses/whois.sgnic.sg/property_nameservers_schema_1_with_ip.txt +94 -0
  137. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/property_nameservers_with_ip.expected +0 -0
  138. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/property_nameservers_with_ip.txt +0 -0
  139. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/status_available.expected +0 -0
  140. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/status_available.txt +0 -0
  141. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/status_registered.expected +0 -0
  142. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/ru/status_registered.txt +0 -0
  143. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/su/status_available.expected +0 -0
  144. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/su/status_available.txt +0 -0
  145. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/su/status_registered.expected +0 -0
  146. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/su/status_registered.txt +0 -0
  147. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_available.expected +0 -0
  148. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_available.txt +0 -0
  149. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_registered.expected +0 -0
  150. data/spec/fixtures/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_registered.txt +0 -0
  151. data/spec/integration_spec.rb +29 -12
  152. data/spec/support/helpers/spec_helper.rb +0 -10
  153. data/spec/tlds +1 -1
  154. data/spec/whois/record/parser/base_spec.rb +23 -51
  155. data/spec/whois/record/parser/responses/whois.aero/status_available_spec.rb +49 -1
  156. data/spec/whois/record/parser/responses/whois.aero/status_registered_spec.rb +91 -1
  157. data/spec/whois/record/parser/responses/whois.afilias-grs.info/bz/status_available_spec.rb +48 -0
  158. data/spec/whois/record/parser/responses/whois.afilias-grs.info/bz/status_registered_spec.rb +53 -2
  159. data/spec/whois/record/parser/responses/whois.afilias-grs.info/gi/status_available_spec.rb +48 -0
  160. data/spec/whois/record/parser/responses/whois.afilias-grs.info/gi/status_registered_spec.rb +90 -0
  161. data/spec/whois/record/parser/responses/whois.afilias-grs.info/hn/status_available_spec.rb +48 -0
  162. data/spec/whois/record/parser/responses/whois.afilias-grs.info/hn/status_registered_spec.rb +90 -0
  163. data/spec/whois/record/parser/responses/whois.afilias-grs.info/lc/status_available_spec.rb +48 -0
  164. data/spec/whois/record/parser/responses/whois.afilias-grs.info/lc/status_registered_spec.rb +90 -0
  165. data/spec/whois/record/parser/responses/whois.afilias-grs.info/mn/status_available_spec.rb +48 -0
  166. data/spec/whois/record/parser/responses/whois.afilias-grs.info/mn/status_registered_spec.rb +90 -0
  167. data/spec/whois/record/parser/responses/whois.afilias-grs.info/sc/status_available_spec.rb +48 -0
  168. data/spec/whois/record/parser/responses/whois.afilias-grs.info/sc/status_registered_spec.rb +90 -0
  169. data/spec/whois/record/parser/responses/whois.afilias-grs.info/vc/status_available_spec.rb +48 -0
  170. data/spec/whois/record/parser/responses/whois.afilias-grs.info/vc/status_registered_spec.rb +90 -0
  171. data/spec/whois/record/parser/responses/whois.dotmobiregistry.net/status_available_spec.rb +48 -0
  172. data/spec/whois/record/parser/responses/whois.dotmobiregistry.net/status_registered_spec.rb +90 -0
  173. data/spec/whois/record/parser/responses/whois.educause.edu/{properties_updated_on_unknown_spec.rb → property_updated_on_unknown_spec.rb} +3 -3
  174. data/spec/whois/record/parser/responses/whois.godaddy.com/status_registered_spec.rb +131 -0
  175. data/spec/whois/record/parser/responses/whois.markmonitor.com/{properties_empty_contacts_spec.rb → property_contacts_are_blank_spec.rb} +3 -3
  176. data/spec/whois/record/parser/responses/whois.meregistry.net/{property_nameservers_is_missing_spec.rb → property_nameservers_is_blank_spec.rb} +3 -3
  177. data/spec/whois/record/parser/responses/whois.meregistry.net/status_available_spec.rb +48 -0
  178. data/spec/whois/record/parser/responses/whois.meregistry.net/status_registered_spec.rb +91 -0
  179. data/spec/whois/record/parser/responses/whois.nic.af/property_status_active_spec.rb +39 -0
  180. data/spec/whois/record/parser/responses/whois.nic.af/property_status_delegated_spec.rb +39 -0
  181. data/spec/whois/record/parser/responses/whois.nic.af/property_status_not_registered_spec.rb +39 -0
  182. data/spec/whois/record/parser/responses/whois.nic.ag/status_available_spec.rb +48 -0
  183. data/spec/whois/record/parser/responses/whois.nic.ag/status_registered_spec.rb +90 -0
  184. data/spec/whois/record/parser/responses/whois.nic.asia/{property_status_client_delete_prohibited_spec.rb → property_status_multiple_spec.rb} +4 -4
  185. data/spec/whois/record/parser/responses/whois.nic.asia/{property_status_client_transfer_prohibited_spec.rb → property_status_single_spec.rb} +4 -4
  186. data/spec/whois/record/parser/responses/whois.nic.asia/status_available_spec.rb +49 -1
  187. data/spec/whois/record/parser/responses/whois.nic.asia/status_registered_spec.rb +92 -1
  188. data/spec/whois/record/parser/responses/whois.nic.dz/{status_available_spec.rb → dz/status_available_spec.rb} +2 -2
  189. data/spec/whois/record/parser/responses/whois.nic.dz/{status_registered_spec.rb → dz/status_registered_spec.rb} +2 -2
  190. data/spec/whois/record/parser/responses/whois.nic.name/status_available_spec.rb +1 -1
  191. data/spec/whois/record/parser/responses/whois.nic.name/status_registered_spec.rb +1 -1
  192. data/spec/whois/record/parser/responses/whois.nic.travel/property_status_multiple_spec.rb +29 -0
  193. data/spec/whois/record/parser/responses/whois.nic.travel/property_status_single_spec.rb +29 -0
  194. data/spec/whois/record/parser/responses/whois.nic.travel/status_available_spec.rb +1 -1
  195. data/spec/whois/record/parser/responses/whois.nic.travel/status_registered_spec.rb +1 -1
  196. data/spec/whois/record/parser/responses/whois.nic.xxx/property_updated_on_blank_spec.rb +29 -0
  197. data/spec/whois/record/parser/responses/whois.nic.xxx/status_registered_spec.rb +45 -46
  198. data/spec/whois/record/parser/responses/whois.publicinterestregistry.net/status_available_spec.rb +1 -1
  199. data/spec/whois/record/parser/responses/whois.publicinterestregistry.net/status_registered_spec.rb +11 -1
  200. data/spec/whois/record/parser/responses/whois.registry.in/property_status_missing_spec.rb +1 -1
  201. data/spec/whois/record/parser/responses/whois.registry.in/property_status_multiple_spec.rb +1 -1
  202. data/spec/whois/record/parser/responses/whois.registry.in/property_status_ok_spec.rb +1 -1
  203. data/spec/whois/record/parser/responses/whois.registry.in/status_available_spec.rb +44 -1
  204. data/spec/whois/record/parser/responses/whois.registry.in/status_registered_spec.rb +83 -1
  205. data/spec/whois/record/parser/responses/whois.registry.qa/qa/status_available_spec.rb +107 -0
  206. data/spec/whois/record/parser/responses/whois.registry.qa/qa/status_registered_spec.rb +142 -0
  207. data/spec/whois/record/parser/responses/whois.sgnic.sg/property_nameservers_schema_1_with_ip_spec.rb +39 -0
  208. data/spec/whois/record/parser/responses/{whois.ripn.net → whois.tcinet.ru}/ru/property_nameservers_with_ip_spec.rb +4 -4
  209. data/spec/whois/record/parser/responses/{whois.ripn.net/su → whois.tcinet.ru/ru}/status_available_spec.rb +4 -4
  210. data/spec/whois/record/parser/responses/{whois.ripn.net → whois.tcinet.ru}/ru/status_registered_spec.rb +4 -4
  211. data/spec/whois/record/parser/responses/{whois.ripn.net/ru → whois.tcinet.ru/su}/status_available_spec.rb +4 -4
  212. data/spec/whois/record/parser/responses/{whois.ripn.net → whois.tcinet.ru}/su/status_registered_spec.rb +4 -4
  213. data/spec/whois/record/parser/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_available_spec.rb +4 -4
  214. data/spec/whois/record/parser/responses/{whois.ripn.net → whois.tcinet.ru}/xn--p1ai/status_registered_spec.rb +4 -4
  215. data/spec/whois/record_spec.rb +4 -4
  216. data/spec/whois/server/adapters/afilias_spec.rb +3 -3
  217. data/spec/whois/server/adapters/base_spec.rb +50 -10
  218. data/spec/whois/server/adapters/formatted_spec.rb +4 -4
  219. data/spec/whois/server/adapters/pir_spec.rb +3 -3
  220. data/spec/whois/server/adapters/standard_spec.rb +4 -4
  221. data/spec/whois/server/adapters/verisign_spec.rb +7 -7
  222. data/whois.gemspec +4 -4
  223. metadata +101 -57
  224. data/lib/whois/answer.rb +0 -14
data/lib/whois.rb CHANGED
@@ -22,10 +22,6 @@ module Whois
22
22
  AUTHORS = ["Simone Carletti <weppos@weppos.net>"]
23
23
 
24
24
 
25
- # Backwards compatibility
26
- autoload :Answer, 'whois/answer'
27
-
28
-
29
25
  class << self
30
26
 
31
27
  # Queries the WHOIS server for <tt>qstring</tt> and returns
@@ -2,10 +2,12 @@ Whois::Server.define :tld, ".ae.org", "whois.centralnic.com"
2
2
  Whois::Server.define :tld, ".ar.com", "whois.centralnic.com"
3
3
  Whois::Server.define :tld, ".br.com", "whois.centralnic.com"
4
4
  Whois::Server.define :tld, ".cn.com", "whois.centralnic.com"
5
+ Whois::Server.define :tld, ".com.de", "whois.centralnic.com"
5
6
  Whois::Server.define :tld, ".de.com", "whois.centralnic.com"
6
7
  Whois::Server.define :tld, ".eu.com", "whois.centralnic.com"
7
8
  Whois::Server.define :tld, ".gb.com", "whois.centralnic.com"
8
9
  Whois::Server.define :tld, ".gb.net", "whois.centralnic.com"
10
+ Whois::Server.define :tld, ".gr.com", "whois.centralnic.com"
9
11
  Whois::Server.define :tld, ".hu.com", "whois.centralnic.com"
10
12
  Whois::Server.define :tld, ".jpn.com", "whois.centralnic.com"
11
13
  Whois::Server.define :tld, ".kr.com", "whois.centralnic.com"
@@ -18,6 +20,7 @@ Whois::Server.define :tld, ".se.net", "whois.centralnic.com"
18
20
  Whois::Server.define :tld, ".uk.com", "whois.centralnic.com"
19
21
  Whois::Server.define :tld, ".uk.net", "whois.centralnic.com"
20
22
  Whois::Server.define :tld, ".us.com", "whois.centralnic.com"
23
+ Whois::Server.define :tld, ".us.org", "whois.centralnic.com"
21
24
  Whois::Server.define :tld, ".uy.com", "whois.centralnic.com"
22
25
  Whois::Server.define :tld, ".za.com", "whois.centralnic.com"
23
26
  Whois::Server.define :tld, ".com", "whois.crsnic.net", { :adapter => Whois::Server::Adapters::Verisign}
@@ -234,12 +237,12 @@ Whois::Server.define :tld, ".ps", "whois.pnina.ps"
234
237
  Whois::Server.define :tld, ".pt", "whois.dns.pt"
235
238
  Whois::Server.define :tld, ".pw", nil, { :adapter => Whois::Server::Adapters::None }
236
239
  Whois::Server.define :tld, ".py", nil, { :web => "http://www.nic.py/consultas.html", :adapter => Whois::Server::Adapters::Web }
237
- Whois::Server.define :tld, ".qa", nil, { :adapter => Whois::Server::Adapters::None }
240
+ Whois::Server.define :tld, ".qa", "whois.registry.qa"
238
241
  Whois::Server.define :tld, ".re", "whois.nic.fr"
239
242
  Whois::Server.define :tld, ".ro", "whois.rotld.ro"
240
243
  Whois::Server.define :tld, ".rs", nil, { :web => "http://www.nic.rs/en/whois", :adapter => Whois::Server::Adapters::Web }
241
244
  Whois::Server.define :tld, ".edu.ru", "whois.informika.ru"
242
- Whois::Server.define :tld, ".ru", "whois.ripn.net"
245
+ Whois::Server.define :tld, ".ru", "whois.tcinet.ru"
243
246
  Whois::Server.define :tld, ".rw", nil, { :adapter => Whois::Server::Adapters::Web, :web => "http://www.nic.rw/cgi-bin/whois.pl"}
244
247
  Whois::Server.define :tld, ".sa", "saudinic.net.sa"
245
248
  Whois::Server.define :tld, ".sb", "whois.nic.net.sb"
@@ -257,7 +260,7 @@ Whois::Server.define :tld, ".sn", "whois.nic.sn"
257
260
  Whois::Server.define :tld, ".so", "whois.nic.so"
258
261
  Whois::Server.define :tld, ".sr", nil, { :adapter => Whois::Server::Adapters::None }
259
262
  Whois::Server.define :tld, ".st", "whois.nic.st"
260
- Whois::Server.define :tld, ".su", "whois.ripn.net"
263
+ Whois::Server.define :tld, ".su", "whois.tcinet.ru"
261
264
  Whois::Server.define :tld, ".sv", nil, { :web => "http://www.uca.edu.sv/dns/", :adapter => Whois::Server::Adapters::Web }
262
265
  Whois::Server.define :tld, ".sy", nil, { :adapter => Whois::Server::Adapters::None }
263
266
  Whois::Server.define :tld, ".sz", nil, { :adapter => Whois::Server::Adapters::None }
@@ -335,12 +338,14 @@ Whois::Server.define :tld, ".xn--mgbbh1a71e", nil, { :adapter => Whois::Server::
335
338
  Whois::Server.define :tld, ".xn--mgberp4a5d4ar", "whois.nic.net.sa"
336
339
  Whois::Server.define :tld, ".xn--o3cw4h", "whois.thnic.co.th"
337
340
  Whois::Server.define :tld, ".xn--ogbpf8fl", nil, { :adapter => Whois::Server::Adapters::None }
338
- Whois::Server.define :tld, ".xn--p1ai", "whois.ripn.net"
341
+ Whois::Server.define :tld, ".xn--p1ai", "whois.tcinet.ru"
339
342
  Whois::Server.define :tld, ".xn--pgbs0dh", nil, { :adapter => Whois::Server::Adapters::None }
340
343
  Whois::Server.define :tld, ".xn--s9brj9c", nil, { :adapter => Whois::Server::Adapters::None }
341
344
  Whois::Server.define :tld, ".xn--wgbh1c", "whois.dotmasr.eg"
342
- Whois::Server.define :tld, ".xn--wgbl6a", nil, { :adapter => Whois::Server::Adapters::None }
345
+ Whois::Server.define :tld, ".xn--wgbl6a", "whois.registry.qa"
346
+ Whois::Server.define :tld, ".xn--lgbbat1ad8j", "whois.nic.dz"
343
347
  Whois::Server.define :tld, ".xn--xkc2al3hye2a", nil, { :adapter => Whois::Server::Adapters::None }
344
348
  Whois::Server.define :tld, ".xn--xkc2dl3a5ee0h", nil, { :adapter => Whois::Server::Adapters::None }
349
+ Whois::Server.define :tld, ".xn--mgbc0a9azcg", nil, { :adapter => Whois::Server::Adapters::None }
345
350
  Whois::Server.define :tld, ".xn--yfro4i67o", "whois.sgnic.sg"
346
351
  Whois::Server.define :tld, ".xn--ygbi2ammx", "whois.pnina.ps"
data/lib/whois/record.rb CHANGED
@@ -67,9 +67,6 @@ module Whois
67
67
  true
68
68
  elsif other.is_a?(self.class)
69
69
  to_s == other.to_s
70
- elsif other.is_a?(String)
71
- Whois.deprecate "Comparing an record with a String is deprecated and will be removed in Whois 2.1."
72
- to_s == other.to_s
73
70
  else
74
71
  false
75
72
  end
@@ -283,10 +283,10 @@ module Whois
283
283
  elsif parser = select_parser(method, :supported)
284
284
  parser.send(method, *args, &block)
285
285
 
286
- # Select a parser where the property is defined
287
- # (but not supported) and call the method.
286
+ # Select a parser where the property is defined but not supported
287
+ # and call the method.
288
288
  # The call is expected to raise an exception.
289
- elsif parser = select_parser(method)
289
+ elsif parser = select_parser(method, :not_supported)
290
290
  parser.send(method, *args, &block)
291
291
 
292
292
  # The property is not supported nor defined.
@@ -6,10 +6,24 @@
6
6
  - verisign : indented keyvalue with text
7
7
  - cnnic : keyvalue
8
8
  - biz : keyvalue + lastupdate + disclaimer
9
- - info : disclaimer + keyvalue
10
9
 
11
10
  ---
12
11
 
12
+ # afilias
13
+ - whois.aero
14
+ - whois.afilias-grs.info
15
+ - whois.afilias.info
16
+ - whois.nic.ag
17
+ - whois.registry.in
18
+ # also
19
+ - whois.nic.xxx
20
+ - whois.dotmobyregistry.net
21
+ - whois.publicinternetregistry.org
22
+ # also
23
+ - whois.nic.asia
24
+ - whois.meregistry.net
25
+
26
+
13
27
  .us
14
28
  .biz
15
29
  .travel
@@ -21,13 +35,6 @@ whois.cat
21
35
  .ve
22
36
  .uy
23
37
 
24
- # afilias
25
- whois.dotmobyregistry.net
26
- whois.afilias.info
27
- whois.afilias-grs.info
28
- whois.aero
29
- whois.nic.xxx
30
-
31
38
  whois.nic.af
32
39
  whois.nic.mu
33
40
  whois.nic.gl
@@ -11,7 +11,7 @@ require 'time'
11
11
  require 'whois/record/contact'
12
12
  require 'whois/record/registrar'
13
13
  require 'whois/record/nameserver'
14
- require 'whois/record/parser/features/ast'
14
+ require 'whois/record/parser/scanners/ast'
15
15
 
16
16
 
17
17
  module Whois
@@ -19,41 +19,18 @@ module Whois
19
19
  class Parser
20
20
 
21
21
 
22
- # This class is intended to be the base abstract class for all
22
+ # Represents the abstract base parser class for all
23
23
  # server-specific parser implementations.
24
24
  #
25
- # == Available Methods
26
- #
27
- # The Base class is for the most part auto-generated via meta programming.
25
+ # NOTE. This class is for the most part auto-generated via meta programming.
28
26
  # This is the reason why RDoc can't detect and document all available methods.
29
27
  #
28
+ # @abstract
29
+ #
30
30
  class Base
31
31
 
32
- @@property_registry = {}
33
-
34
- # Returns the <tt>@@property_registry</tt> if <tt>klass</tt> is nil,
35
- # otherwise returns the value in <tt>@@property_registry</tt> for given <tt>klass</tt>.
36
- # <tt>klass</tt> is expected to be a class name.
37
- #
38
- # Returned value is always a hash. If <tt>@@property_registry[klass]</tt>
39
- # doesn't exist, this method automatically initializes it to an empty Hash.
40
- #
41
- # @param [Class] klass
42
- # @return [Hash]
43
- #
44
- # @example Get the full registry
45
- # property_registry
46
- #
47
- # @example Get the registry for a specfic Class
48
- # property_registry(ParserClass)
49
- #
50
- def self.property_registry(klass = nil)
51
- if klass.nil?
52
- @@property_registry
53
- else
54
- @@property_registry[klass] ||= {}
55
- end
56
- end
32
+ class_attribute :_properties
33
+ self._properties = {}
57
34
 
58
35
  # Returns the status for the +property+ passed as symbol.
59
36
  #
@@ -70,11 +47,11 @@ module Whois
70
47
  # # => :supported
71
48
  #
72
49
  def self.property_status(property)
73
- property_registry(self)[property]
50
+ self._properties[property]
74
51
  end
75
52
 
76
53
  # Check if the +property+ passed as symbol
77
- # is registered in the +property_registry+ for current parser.
54
+ # is registered in the registry for current parser.
78
55
  #
79
56
  # @param [Symbol] property
80
57
  # @param [Symbol] status
@@ -91,9 +68,9 @@ module Whois
91
68
  #
92
69
  def self.property_registered?(property, status = :any)
93
70
  if status == :any
94
- property_registry(self).key?(property)
71
+ self._properties.key?(property)
95
72
  else
96
- property_registry(self)[property] == status
73
+ self._properties[property] == status
97
74
  end
98
75
  end
99
76
 
@@ -105,7 +82,7 @@ module Whois
105
82
  # @return [void]
106
83
  #
107
84
  def self.property_register(property, status)
108
- property_registry(self).merge!({ property => status })
85
+ self._properties = self._properties.merge({ property => status })
109
86
  end
110
87
 
111
88
 
@@ -0,0 +1,156 @@
1
+ #--
2
+ # Ruby Whois
3
+ #
4
+ # An intelligent pure Ruby WHOIS client and parser.
5
+ #
6
+ # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
7
+ #++
8
+
9
+
10
+ require 'whois/record/parser/base'
11
+ require 'whois/record/parser/scanners/afilias'
12
+
13
+
14
+ module Whois
15
+ class Record
16
+ class Parser
17
+
18
+ # Base parser for Afilias servers.
19
+ #
20
+ # @abstract
21
+ #
22
+ class BaseAfilias < Base
23
+ include Scanners::Ast
24
+
25
+
26
+ property_supported :disclaimer do
27
+ node("property:disclaimer")
28
+ end
29
+
30
+
31
+ property_supported :domain do
32
+ node("Domain Name", &:downcase)
33
+ end
34
+
35
+ property_supported :domain_id do
36
+ node("Domain ID")
37
+ end
38
+
39
+
40
+ property_not_supported :referral_whois
41
+
42
+ property_not_supported :referral_url
43
+
44
+
45
+ property_supported :status do
46
+ Array.wrap(node("Status"))
47
+ end
48
+
49
+ property_supported :available? do
50
+ !!node("status:available")
51
+ end
52
+
53
+ property_supported :registered? do
54
+ !available?
55
+ end
56
+
57
+
58
+ property_supported :created_on do
59
+ node("Created On") do |value|
60
+ Time.parse(value)
61
+ end
62
+ end
63
+
64
+ property_supported :updated_on do
65
+ node("Last Updated On") do |value|
66
+ Time.parse(value)
67
+ end
68
+ end
69
+
70
+ property_supported :expires_on do
71
+ node("Expiration Date") do |value|
72
+ Time.parse(value)
73
+ end
74
+ end
75
+
76
+
77
+ property_supported :registrar do
78
+ node("Sponsoring Registrar") do |value|
79
+ parts = decompose_registrar(value) ||
80
+ Whois.bug!(ParserError, "Unknown registrar format `#{value}'")
81
+
82
+ Record::Registrar.new(
83
+ :id => parts[0],
84
+ :name => parts[1],
85
+ :organization => parts[1]
86
+ )
87
+ end
88
+ end
89
+
90
+ property_supported :registrant_contacts do
91
+ contact("Registrant", Whois::Record::Contact::TYPE_REGISTRANT)
92
+ end
93
+
94
+ property_supported :admin_contacts do
95
+ contact("Admin", Whois::Record::Contact::TYPE_ADMIN)
96
+ end
97
+
98
+ property_supported :technical_contacts do
99
+ contact("Tech", Whois::Record::Contact::TYPE_TECHNICAL)
100
+ end
101
+
102
+
103
+ property_supported :nameservers do
104
+ Array.wrap(node("Name Server")).reject(&:empty?).map do |name|
105
+ Nameserver.new(name.downcase)
106
+ end
107
+ end
108
+
109
+
110
+ # Initializes a new {Scanners::Afilias} instance
111
+ # passing the {#content_for_scanner}
112
+ # and calls +parse+ on it.
113
+ #
114
+ # @return [Hash]
115
+ def parse
116
+ Scanners::Afilias.new(content_for_scanner).parse
117
+ end
118
+
119
+
120
+ private
121
+
122
+ def contact(element, type)
123
+ node("#{element} ID") do
124
+ address = (1..3).
125
+ map { |i| node("#{element} Street#{i}") }.
126
+ delete_if { |i| i.nil? || i.empty? }.
127
+ join("\n")
128
+
129
+ Record::Contact.new(
130
+ :type => type,
131
+ :id => node("#{element} ID"),
132
+ :name => node("#{element} Name"),
133
+ :organization => node("#{element} Organization"),
134
+ :address => address,
135
+ :city => node("#{element} City"),
136
+ :zip => node("#{element} Postal Code"),
137
+ :state => node("#{element} State/Province"),
138
+ :country_code => node("#{element} Country"),
139
+ :phone => node("#{element} Phone"),
140
+ :fax => node("#{element} FAX"),
141
+ :email => node("#{element} Email")
142
+ )
143
+ end
144
+ end
145
+
146
+ def decompose_registrar(value)
147
+ if value =~ /(.+?) \((.+?)\)/
148
+ [$2, $1]
149
+ end
150
+ end
151
+
152
+ end
153
+
154
+ end
155
+ end
156
+ end
@@ -14,12 +14,16 @@ module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.example.com parser
19
- #
20
17
  # Parser for the whois.example.com server.
18
+ #--
19
+ # In case you are not implementing all the methods,
20
+ # please add the following statement to the class docblock.
21
21
  #
22
- class WhoisExampleCom < Base
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
+ # ++
26
+ class Example < Base
23
27
 
24
28
  # Gets the registry disclaimer that comes with the record.
25
29
  #
@@ -21,7 +21,7 @@ module Whois
21
21
  # Parser for the jobswhois.verisign-grs.com server.
22
22
  #
23
23
  class JobswhoisVerisignGrsCom < Base
24
- include Features::Ast
24
+ include Scanners::Ast
25
25
 
26
26
  property_supported :disclaimer do
27
27
  node("Disclaimer")
@@ -87,7 +87,7 @@ module Whois
87
87
 
88
88
 
89
89
  # Initializes a new {Scanners::Verisign} instance
90
- # passing the {Whois::Record::Parser::Base#content_for_scanner}
90
+ # passing the {#content_for_scanner}
91
91
  # and calls +parse+ on it.
92
92
  #
93
93
  # @return [Hash]
@@ -19,25 +19,34 @@ module Whois
19
19
 
20
20
  def parse_content
21
21
  parse_available ||
22
+ parse_throttled || # .ORG
22
23
  parse_disclaimer ||
23
24
  parse_keyvalue ||
24
- trim_newline ||
25
+
26
+ trim_empty_line ||
25
27
  error!("Unexpected token")
26
28
  end
27
29
 
28
30
  def parse_available
29
31
  if @input.scan(/^NOT FOUND\n/)
30
- @ast["status-available"] = true
32
+ @ast["status:available"] = true
33
+ end
34
+ end
35
+
36
+ def parse_throttled
37
+ if @input.match?(/^WHOIS LIMIT EXCEEDED/)
38
+ @ast["response:throttled"] = true
39
+ @input.skip(/^.+\n/)
31
40
  end
32
41
  end
33
42
 
34
43
  def parse_disclaimer
35
- if @input.match?(/^Access to/)
44
+ if @input.pos == 0
36
45
  lines = []
37
46
  while @input.scan(/^(.+)\n/)
38
47
  lines << @input[1].strip
39
48
  end
40
- @ast["property-disclaimer"] = lines.join(" ")
49
+ @ast["property:disclaimer"] = lines.join(" ")
41
50
  end
42
51
  end
43
52