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
@@ -0,0 +1,117 @@
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/whois.registry.qa.rb'
12
+
13
+
14
+ module Whois
15
+ class Record
16
+ class Parser
17
+
18
+ # Parser for the whois.registry.qa server.
19
+ #
20
+ # @since 2.1.0
21
+ class WhoisRegistryQa < Base
22
+ include Scanners::Ast
23
+
24
+ property_not_supported :disclaimer
25
+
26
+
27
+ property_supported :domain do
28
+ node("Domain Name")
29
+ end
30
+
31
+ property_not_supported :domain_id
32
+
33
+
34
+ property_not_supported :referral_whois
35
+
36
+ property_not_supported :referral_url
37
+
38
+
39
+ property_supported :status do
40
+ Array.wrap(node("Status"))
41
+ end
42
+
43
+ property_supported :available? do
44
+ !!node("status:available")
45
+ end
46
+
47
+ property_supported :registered? do
48
+ !available?
49
+ end
50
+
51
+
52
+ property_not_supported :created_on
53
+
54
+ property_not_supported :updated_on
55
+
56
+ property_not_supported :expires_on
57
+
58
+
59
+ property_supported :registrar do
60
+ node("Registrar ID") do |raw|
61
+ Record::Registrar.new(
62
+ :id => node("Registrar ID"),
63
+ :name => node("Registrar Name"),
64
+ :organization => node("Registrar Name")
65
+ )
66
+ end
67
+ end
68
+
69
+
70
+ property_supported :registrant_contacts do
71
+ contact("Registrant Contact", Whois::Record::Contact::TYPE_REGISTRANT)
72
+ end
73
+
74
+ property_not_supported :admin_contacts
75
+
76
+ property_supported :technical_contacts do
77
+ contact("Tech Contact", Whois::Record::Contact::TYPE_TECHNICAL)
78
+ end
79
+
80
+
81
+ property_supported :nameservers do
82
+ node("Name Server") do |value|
83
+ value.zip(node("Name Server IP")).map do |name, ipv4|
84
+ Nameserver.new(:name => name, :ipv4 => ipv4)
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+ # Initializes a new {Scanners::WhoisRegistryQa} instance
91
+ # passing the {#content_for_scanner}
92
+ # and calls +parse+ on it.
93
+ #
94
+ # @return [Hash]
95
+ def parse
96
+ Scanners::WhoisRegistryQa.new(content_for_scanner).parse
97
+ end
98
+
99
+
100
+ protected
101
+
102
+ def contact(element, type)
103
+ node("#{element} ID") do |raw|
104
+ Record::Contact.new(
105
+ :type => type,
106
+ :id => node("#{element} ID"),
107
+ :name => node("#{element} Name"),
108
+ :email => node("#{element} Email")
109
+ )
110
+ end
111
+ end
112
+
113
+ end
114
+
115
+ end
116
+ end
117
+ end
@@ -7,96 +7,16 @@
7
7
  #++
8
8
 
9
9
 
10
- require 'whois/record/parser/base'
10
+ require 'whois/record/parser/whois.tcinet.ru.rb'
11
11
 
12
12
 
13
13
  module Whois
14
14
  class Record
15
15
  class Parser
16
16
 
17
- #
18
- # = whois.ripn.net parser
19
- #
20
- # Parser for the whois.ripn.net server.
21
- #
22
- # NOTE: This parser is just a stub and provides only a few basic methods
23
- # to check for domain availability and get domain status.
24
- # Please consider to contribute implementing missing methods.
25
- # See WhoisNicIt parser for an explanation of all available methods
26
- # and examples.
27
- #
28
- class WhoisRipnNet < Base
29
-
30
- property_supported :status do
31
- if content_for_scanner =~ /state:\s+(.+?)\n/
32
- $1.split(",").map(&:strip)
33
- else
34
- []
35
- end
36
- end
37
-
38
- property_supported :available? do
39
- !!(content_for_scanner =~ /No entries found/)
40
- end
41
-
42
- property_supported :registered? do
43
- !available?
44
- end
45
-
46
-
47
- property_supported :created_on do
48
- if content_for_scanner =~ /created:\s+(.*)\n/
49
- Time.parse($1)
50
- end
51
- end
52
-
53
- property_not_supported :updated_on
54
-
55
- property_supported :expires_on do
56
- if content_for_scanner =~ /paid-till:\s+(.*)\n/
57
- Time.parse($1)
58
- end
59
- end
60
-
61
-
62
- property_supported :registrar do
63
- if content_for_scanner =~ /registrar:\s+(.*)\n/
64
- Record::Registrar.new(:id => $1)
65
- end
66
- end
67
-
68
-
69
- property_supported :admin_contacts do
70
- content_for_scanner.scan(/e-mail:\s+(.+)\n/).flatten.map do |email|
71
- Record::Contact.new(
72
- :type => Record::Contact::TYPE_ADMIN,
73
- :name => content_for_scanner[/person:\s+(.+)\n/, 1],
74
- :organization => content_for_scanner[/org:\s+(.+)\n/, 1],
75
- :phone => content_for_scanner[/phone:\s+(.+)\n/, 1],
76
- :fax => content_for_scanner[/fax-no:\s+(.+)\n/, 1],
77
- :email => email
78
- )
79
- end
80
- end
81
-
82
- property_not_supported :registrant_contacts
83
-
84
- property_not_supported :technical_contacts
85
-
86
-
87
- # Nameservers are listed in the following formats:
88
- #
89
- # nserver: ns.masterhost.ru.
90
- # nserver: ns.masterhost.ru. 217.16.20.30
91
- #
92
- property_supported :nameservers do
93
- content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
94
- name, ipv4 = line.split(/\s+/)
95
- Record::Nameserver.new(name.chomp("."), ipv4)
96
- end
97
- end
98
-
99
- end
17
+ # Parser for the <tt>whois.ripn.net</tt> server.
18
+ # Aliases the <tt>whois.tcinet.ru</tt> parser.
19
+ WhoisRipnNet = WhoisTcinetRu
100
20
 
101
21
  end
102
22
  end
@@ -60,16 +60,24 @@ module Whois
60
60
  values = case value = $1.downcase
61
61
  # schema-1
62
62
  when /^(?:\s+([\w.-]+)\n){2,}/
63
- value.split("\n").map(&:strip)
63
+ value.scan(/\s+([\w.-]+)\n/).map do |match|
64
+ { :name => match[0] }
65
+ end
66
+ when /^(?:\s+([\w.-]+)\s+\((.+)\)\n){2,}/
67
+ value.scan(/\s+([\w.-]+)\s+\((.+)\)\n/).map do |match|
68
+ { :name => match[0], :ipv4 => match[1] }
69
+ end
64
70
  # schema-2
65
71
  when /^(?:\s+([\w.-]+)){2,}/
66
- value.strip.split(/\s+/)
72
+ value.strip.split(/\s+/).map do |name|
73
+ { :name => name }
74
+ end
67
75
  else
68
- Whois.bug!("Unknown nameservers format `#{value}'")
76
+ Whois.bug!(ParserError, "Unknown nameservers format `#{value}'")
69
77
  end
70
78
 
71
- values.map do |name|
72
- Record::Nameserver.new(name)
79
+ values.map do |params|
80
+ Record::Nameserver.new(params)
73
81
  end
74
82
  end
75
83
  end
@@ -0,0 +1,102 @@
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
+
12
+
13
+ module Whois
14
+ class Record
15
+ class Parser
16
+
17
+ # Parser for the whois.tcinet.ru server.
18
+ #
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.
25
+ #
26
+ # @since 2.1.0
27
+ class WhoisTcinetRu < Base
28
+
29
+ property_supported :status do
30
+ if content_for_scanner =~ /state:\s+(.+?)\n/
31
+ $1.split(",").map(&:strip)
32
+ else
33
+ []
34
+ end
35
+ end
36
+
37
+ property_supported :available? do
38
+ !!(content_for_scanner =~ /No entries found/)
39
+ end
40
+
41
+ property_supported :registered? do
42
+ !available?
43
+ end
44
+
45
+
46
+ property_supported :created_on do
47
+ if content_for_scanner =~ /created:\s+(.*)\n/
48
+ Time.parse($1)
49
+ end
50
+ end
51
+
52
+ property_not_supported :updated_on
53
+
54
+ property_supported :expires_on do
55
+ if content_for_scanner =~ /paid-till:\s+(.*)\n/
56
+ Time.parse($1)
57
+ end
58
+ end
59
+
60
+
61
+ property_supported :registrar do
62
+ if content_for_scanner =~ /registrar:\s+(.*)\n/
63
+ Record::Registrar.new(:id => $1)
64
+ end
65
+ end
66
+
67
+
68
+ property_supported :admin_contacts do
69
+ content_for_scanner.scan(/e-mail:\s+(.+)\n/).flatten.map do |email|
70
+ Record::Contact.new(
71
+ :type => Record::Contact::TYPE_ADMIN,
72
+ :name => content_for_scanner[/person:\s+(.+)\n/, 1],
73
+ :organization => content_for_scanner[/org:\s+(.+)\n/, 1],
74
+ :phone => content_for_scanner[/phone:\s+(.+)\n/, 1],
75
+ :fax => content_for_scanner[/fax-no:\s+(.+)\n/, 1],
76
+ :email => email
77
+ )
78
+ end
79
+ end
80
+
81
+ property_not_supported :registrant_contacts
82
+
83
+ property_not_supported :technical_contacts
84
+
85
+
86
+ # Nameservers are listed in the following formats:
87
+ #
88
+ # nserver: ns.masterhost.ru.
89
+ # nserver: ns.masterhost.ru. 217.16.20.30
90
+ #
91
+ property_supported :nameservers do
92
+ content_for_scanner.scan(/nserver:\s+(.+)\n/).flatten.map do |line|
93
+ name, ipv4 = line.split(/\s+/)
94
+ Record::Nameserver.new(name.chomp("."), ipv4)
95
+ end
96
+ end
97
+
98
+ end
99
+
100
+ end
101
+ end
102
+ end
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
  require 'whois/record/parser/base'
11
- require 'whois/record/parser/scanners/base'
11
+ require 'whois/record/parser/scanners/whois.tld.ee.rb'
12
12
 
13
13
 
14
14
  module Whois
@@ -27,7 +27,7 @@ module Whois
27
27
  # and examples.
28
28
  #
29
29
  class WhoisTldEe < Base
30
- include Features::Ast
30
+ include Scanners::Ast
31
31
 
32
32
  property_supported :status do
33
33
  if content_for_scanner =~ /status:\s+(.+)\n/
@@ -106,13 +106,13 @@ module Whois
106
106
  end
107
107
 
108
108
 
109
- # Initializes a new {Scanner} instance
110
- # passing the {Whois::Record::Parser::Base#content_for_scanner}
109
+ # Initializes a new {Scanners::WhoisTldEe} instance
110
+ # passing the {#content_for_scanner}
111
111
  # and calls +parse+ on it.
112
112
  #
113
113
  # @return [Hash]
114
114
  def parse
115
- Scanner.new(content_for_scanner).parse
115
+ Scanners::WhoisTldEe.new(content_for_scanner).parse
116
116
  end
117
117
 
118
118
 
@@ -130,27 +130,6 @@ module Whois
130
130
  end
131
131
  end
132
132
 
133
-
134
- class Scanner < Scanners::Base
135
-
136
- def parse_content
137
- if @input.scan(/contact:\s+(.*)\n/)
138
- section = @input[1].strip
139
- content = {}
140
-
141
- while @input.scan(/(.*?):\s+(.*?)\n/)
142
- content[@input[1]] = @input[2]
143
- end
144
-
145
- @ast[section] = content
146
- # FIXME: incomplete scanner, it skips all the properties
147
- else
148
- @input.scan(/(.*)\n/)
149
- end
150
- end
151
-
152
- end
153
-
154
133
  end
155
134
  end
156
135
  end
@@ -87,14 +87,6 @@ module Whois
87
87
  content_for_scanner.strip == ""
88
88
  end
89
89
 
90
-
91
- protected
92
-
93
- def incomplete_response?
94
- Whois.deprecate "#{self.class}#response_incomplete? will be removed in Whois 2.1. Please use #{self.class}#response_incomplete?."
95
- response_incomplete?
96
- end
97
-
98
90
  end
99
91
 
100
92
  end
@@ -154,13 +154,27 @@ module Whois
154
154
 
155
155
  # @api public
156
156
  def query_the_socket(query, host, port = nil)
157
- ask_the_socket(
158
- query,
159
- host,
160
- port || options[:port] || DEFAULT_WHOIS_PORT,
161
- options[:bind_host] || DEFAULT_BIND_HOST,
162
- options[:bind_port]
163
- )
157
+ args = []
158
+ args.push(host)
159
+ args.push(port || options[:port] || DEFAULT_WHOIS_PORT)
160
+
161
+ # This is a hack to prevent +TCPSocket.new+ to crash
162
+ # when resolv-replace.rb file is required.
163
+ #
164
+ # +TCPSocket.new+ defaults +local_host+ and +local_port+ to nil
165
+ # but when you require resolv-replace.rb, +local_host+
166
+ # is resolved when you pass any local parameter and in case of nil
167
+ # it raises the following error
168
+ #
169
+ # ArgumentError: cannot interpret as DNS name: nil
170
+ #
171
+ if options[:bind_host] || options[:bind_port]
172
+ args.push(options[:bind_host] || DEFAULT_BIND_HOST)
173
+ args.push(options[:bind_port]) if options[:bind_port]
174
+ end
175
+
176
+ ask_the_socket(query, *args)
177
+
164
178
  rescue *RESCUABLE_CONNECTION_ERRORS => error
165
179
  raise ConnectionError, "#{error.class}: #{error.message}"
166
180
  end
@@ -171,9 +185,8 @@ module Whois
171
185
  # This is for internal use only!
172
186
  #
173
187
  # @api internal
174
- def ask_the_socket(query, host, port, local_host, local_port)
175
- args = [host, port, local_host, local_port].compact
176
- client = TCPSocket.open(host, port, local_host, local_port)
188
+ def ask_the_socket(query, *args)
189
+ client = TCPSocket.new(*args)
177
190
  client.write("#{query}\r\n") # I could use put(foo) and forget the \n
178
191
  client.read # but write/read is more symmetric than puts/read
179
192
  ensure # and I really want to use read instead of gets.