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/CHANGELOG.rdoc CHANGED
@@ -1,6 +1,68 @@
1
1
  = Changelog
2
2
 
3
3
 
4
+ == Release 2.1.0
5
+
6
+ * SERVER: Added .COM.DE, .GR.COM, .US.ORG TLD definitions.
7
+
8
+ * SERVER: Updated .QA and .XN--WGBL6A TLD definitions.
9
+
10
+ * SERVER: Updated .SU, .RU and .XN--P1AI TLD definitions (#87).
11
+
12
+ * SERVER: Added the following new IDN TLDs:
13
+ * .XN--LGBBAT1AD8J (.الجزائر, Algeria) (#95)
14
+ * .XN--MGBC0A9AZCG (.المغرب, Morocco) (#96)
15
+
16
+ * NEW: Ability to define inheritable parsers
17
+
18
+ class Whois::Record::Parser::Afilias < Whois::Record::Parser::Base
19
+ end
20
+
21
+ class Whois::Record::Parser::WhoisNicXxx < Whois::Record::Parser::Afilias
22
+ end
23
+
24
+ Parsers will inherits all the properties from their parents.
25
+
26
+ * NEW: Added the following full parsers:
27
+ * whois.nic.asia
28
+ * whois.meregistry.net
29
+ * whois.dotmobiregistry.net
30
+ * whois.publicinternetregistry.net
31
+ * whois.registry.in
32
+ * whis.nic.ag
33
+ * whois.afilias-grs.info
34
+ * whois.aero
35
+ * whois.nic.xx
36
+ * whois.afilias.info
37
+ * whois.registry.qa (#114)
38
+ * whois.godaddy.com (#105)
39
+
40
+ * CHANGED: use the first public .XXX domain to test the whois.nic.xx response format.
41
+
42
+ * CHANGED: whois.sgnic.sg changed nameservers response format (again).
43
+
44
+ * CHANGED: Extended core_ext section. Since all the extensions belong to ActiveSupport,
45
+ the library attempts to use ActiveSupport if loaded.
46
+
47
+ * CHANGED: Renamed whois.ripn.net to whois.tcinet.ru (#87)
48
+
49
+ * FIXED: In a very rare situation the Whois::Client raises a
50
+ `Errno::EINVAL: Invalid argument - bind(2)' error attempting to connect
51
+ to a WHOIS server (see #40).
52
+
53
+ * FIXED: whois.nic.travel parser must support multiple statuses.
54
+
55
+ * FIXED: whois.nic.name parser must support multiple statuses.
56
+
57
+ * FIXED: whois.nic.af parser must support `Delegated' status.
58
+
59
+ * REMOVED: Removed deprecated Whois::Answer class.
60
+
61
+ * REMOVED: Removed deprecated Whois::Record#== behavior.
62
+
63
+ * REMOVED: Removed deprecated Whois::Record::Parser::WhoisTonicTo#incomplete_response? method.
64
+
65
+
4
66
  == Release 2.0.7
5
67
 
6
68
  * CHANGED: whois.dns.pt changed nameservers response format.
@@ -35,7 +97,8 @@
35
97
 
36
98
  * NEW: Added base whois.nic.sm parser (#97).
37
99
 
38
- * FIXED: whois.meregistry.net parser raises `no time information in ""' when updated_at property is blank.
100
+ * FIXED: whois.meregistry.net parser raises `no time information in ""'
101
+ when updated_at property is blank.
39
102
 
40
103
  * FIXED: whois.nic.it parser must support `NO-PROVIDER' status.
41
104
 
@@ -45,7 +108,7 @@
45
108
 
46
109
  * FIXED: whois.nic.cz parser must support `Update prohibited' status.
47
110
 
48
- * FIXED: The Verisign WHOIS adapter crashes in some rare circumstances
111
+ * FIXED: The Verisign WHOIS adapter crashes in some rare circumstances
49
112
  when the response from the Verisign database doesn't contain a
50
113
  referral (#103)
51
114
 
@@ -65,7 +128,8 @@
65
128
 
66
129
  * FIXED: whois.nic.it parser must support pendingUpdate and pendingTransfer statuses.
67
130
 
68
- * FIXED: whois.nic-se.se crashes in some cases where the modified: attribute is an invalid date.
131
+ * FIXED: whois.nic-se.se crashes in some cases where the `modified:'
132
+ attribute is an invalid date.
69
133
 
70
134
 
71
135
  == Release 2.0.3
@@ -167,8 +231,9 @@
167
231
 
168
232
  * CHANGED: Renamed Whois::Server::Adapters::Base#append_to_buffer to buffer_append.
169
233
 
170
- * CHANGED: Whois::Answer::Parser::Base#response_throttled? and Whois::Answer::Parser::Base#invalid? are not defined by default.
171
- Define the method in the implementation, and Whois::Answer::Parser will automatically use it.
234
+ * CHANGED: Whois::Answer::Parser::Base#response_throttled? and Whois::Answer::Parser::Base#invalid?
235
+ are not defined by default. Define the method in the implementation,
236
+ and Whois::Answer::Parser will automatically use it.
172
237
 
173
238
  * CHANGED: Removed &block from method definition to avoid creating block objects when yield is used (#66)
174
239
 
@@ -180,9 +245,12 @@
180
245
 
181
246
  * CHANGED: Change #nameservers property to return an Array of Nameserver (#76, see #71, see #64).
182
247
 
183
- * CHANGED: Whois#query no longer raises Errno or SocketError. The errors are now rescued and re-raised as Whois::ConnectionError.
248
+ * CHANGED: Whois#query no longer raises Errno or SocketError.
249
+ The errors are now rescued and re-raised as Whois::ConnectionError.
184
250
 
185
- * CHANGED: #admin_contact, #technical_contact and #registrant_contact have been renamed to #admin_contacts, #technical_contacts and #registrant_contacts and they now returns an array of Contact, instead of a single Contact.
251
+ * CHANGED: #admin_contact, #technical_contact and #registrant_contact
252
+ have been renamed to #admin_contacts, #technical_contacts and #registrant_contacts
253
+ and they now returns an array of Contact, instead of a single Contact.
186
254
 
187
255
  * CHANGED: Migrated all tests to RSpec.
188
256
 
@@ -193,7 +261,8 @@
193
261
 
194
262
  * FIXED: Make sure a warning is issued when #registered? or #available? returns nil.
195
263
 
196
- * FIXED: Fixed a bug with the whois.crsnic.net parser where the name server contains "no nameserver" instead of a valid host.
264
+ * FIXED: Fixed a bug with the whois.crsnic.net parser where the name server
265
+ contains "no nameserver" instead of a valid host.
197
266
 
198
267
  * FIXED: Fixed a bug which prevents a client to be created with nil timeout.
199
268
 
@@ -236,9 +305,14 @@
236
305
  * Whois#query no longer raises Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, SocketError.
237
306
  The errors are now rescued and re-raised as Whois::ConnectionError.
238
307
 
239
- * #admin_contact, #technical_contact and #registrant_contact have been renamed to #admin_contacts, #technical_contacts and #registrant_contacts and they now returns an array of Contact, instead of a single Contact. #admin_contact, #technical_contact and #registrant_contact still exists in the Answer as a convenient shortcut.
308
+ * #admin_contact, #technical_contact and #registrant_contact
309
+ have been renamed to #admin_contacts, #technical_contacts and #registrant_contacts
310
+ and they now returns an array of Contact, instead of a single Contact.
311
+ #admin_contact, #technical_contact and #registrant_contact still exists
312
+ in the Answer as a convenient shortcut.
240
313
 
241
- * Renamed Whois::Answer::Parser::Base.register_property to Whois::Answer::Parser::Base.property_register.
314
+ * Renamed Whois::Answer::Parser::Base.register_property to
315
+ Whois::Answer::Parser::Base.property_register.
242
316
 
243
317
 
244
318
  == Release 1.6.6
data/Rakefile CHANGED
@@ -118,13 +118,6 @@ YARD::Rake::YardocTask.new(:yardoc) do |y|
118
118
  end
119
119
 
120
120
  namespace :yardoc do
121
- desc "Publish YARD documentation to the site"
122
- task :publish => ["yardoc:clobber", "yardoc"] do
123
- ENV["username"] || raise(ArgumentError, "Missing ssh username")
124
- sh "rsync -avz --delete yardoc/ #{ENV["username"]}@alamak:/home/#{ENV["username"]}/ruby-whois.org/api"
125
- end
126
-
127
- desc "Remove YARD products"
128
121
  task :clobber do
129
122
  rm_r "yardoc" rescue nil
130
123
  end
data/lib/core_ext.rb CHANGED
@@ -1,45 +1,9 @@
1
- require 'date'
2
-
3
- class DateTime
4
-
5
- # Don't remove method if exists or it will conflict with ActiveRecord.
6
- # See http://github.com/weppos/whois/issues#issue/24
7
- unless method_defined?(:to_time)
8
- # Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class
9
- # If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time.
10
- #
11
- # Extracted from ActiveSupport.
12
- def to_time
13
- self.offset == 0 ? ::Time.utc(year, month, day, hour, min, sec) : self
14
- end
15
- end
16
-
17
- end
18
-
19
-
20
- class Array
21
-
22
- # Wraps its argument in an array unless it is already an array (or array-like).
23
- #
24
- # Specifically:
25
- #
26
- # * If the argument is +nil+ an empty list is returned.
27
- # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
28
- # * Otherwise, returns an array with the argument as its single element.
29
- #
30
- # Array.wrap(nil) # => []
31
- # Array.wrap([1, 2, 3]) # => [1, 2, 3]
32
- # Array.wrap(0) # => [0]
33
- #
34
- # Extracted from ActiveSupport.
35
- def self.wrap(object)
36
- if object.nil?
37
- []
38
- elsif object.respond_to?(:to_ary)
39
- object.to_ary
40
- else
41
- [object]
42
- end
43
- end unless respond_to?(:wrap)
44
-
45
- end
1
+ if defined?(ActiveSupport) && ActiveSupport::VERSION::MAJOR == 3
2
+ require 'active_support/core_ext/array/wrap'
3
+ require 'active_support/core_ext/date_time/conversions'
4
+ require 'core_ext/class/attribute'
5
+ else
6
+ require 'core_ext/array/wrap'
7
+ require 'core_ext/date_time/conversions'
8
+ require 'core_ext/class/attribute'
9
+ end
@@ -0,0 +1,29 @@
1
+ class Hash
2
+ # By default, only instances of Hash itself are extractable.
3
+ # Subclasses of Hash may implement this method and return
4
+ # true to declare themselves as extractable. If a Hash
5
+ # is extractable, Array#extract_options! pops it from
6
+ # the Array when it is the last element of the Array.
7
+ def extractable_options?
8
+ instance_of?(Hash)
9
+ end
10
+ end
11
+
12
+ class Array
13
+ # Extracts options from a set of arguments. Removes and returns the last
14
+ # element in the array if it's a hash, otherwise returns a blank hash.
15
+ #
16
+ # def options(*args)
17
+ # args.extract_options!
18
+ # end
19
+ #
20
+ # options(1, 2) # => {}
21
+ # options(1, 2, :a => :b) # => {:a=>:b}
22
+ def extract_options!
23
+ if last.is_a?(Hash) && last.extractable_options?
24
+ pop
25
+ else
26
+ {}
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,48 @@
1
+ class Array
2
+ # Wraps its argument in an array unless it is already an array (or array-like).
3
+ #
4
+ # Specifically:
5
+ #
6
+ # * If the argument is +nil+ an empty list is returned.
7
+ # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
8
+ # * Otherwise, returns an array with the argument as its single element.
9
+ #
10
+ # Array.wrap(nil) # => []
11
+ # Array.wrap([1, 2, 3]) # => [1, 2, 3]
12
+ # Array.wrap(0) # => [0]
13
+ #
14
+ # This method is similar in purpose to <tt>Kernel#Array</tt>, but there are some differences:
15
+ #
16
+ # * If the argument responds to +to_ary+ the method is invoked. <tt>Kernel#Array</tt>
17
+ # moves on to try +to_a+ if the returned value is +nil+, but <tt>Array.wrap</tt> returns
18
+ # such a +nil+ right away.
19
+ # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, <tt>Kernel#Array</tt>
20
+ # raises an exception, while <tt>Array.wrap</tt> does not, it just returns the value.
21
+ # * It does not call +to_a+ on the argument, though special-cases +nil+ to return an empty array.
22
+ #
23
+ # The last point is particularly worth comparing for some enumerables:
24
+ #
25
+ # Array(:foo => :bar) # => [[:foo, :bar]]
26
+ # Array.wrap(:foo => :bar) # => [{:foo => :bar}]
27
+ #
28
+ # Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8
29
+ # Array.wrap("foo\nbar") # => ["foo\nbar"]
30
+ #
31
+ # There's also a related idiom that uses the splat operator:
32
+ #
33
+ # [*object]
34
+ #
35
+ # which returns <tt>[nil]</tt> for +nil+, and calls to <tt>Array(object)</tt> otherwise.
36
+ #
37
+ # Thus, in this case the behavior is different for +nil+, and the differences with
38
+ # <tt>Kernel#Array</tt> explained above apply to the rest of +object+s.
39
+ def self.wrap(object)
40
+ if object.nil?
41
+ []
42
+ elsif object.respond_to?(:to_ary)
43
+ object.to_ary || [object]
44
+ else
45
+ [object]
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,115 @@
1
+ require 'core_ext/kernel/singleton_class'
2
+ require 'core_ext/module/remove_method'
3
+ require 'core_ext/array/extract_options'
4
+
5
+ class Class
6
+ # Declare a class-level attribute whose value is inheritable by subclasses.
7
+ # Subclasses can change their own value and it will not impact parent class.
8
+ #
9
+ # class Base
10
+ # class_attribute :setting
11
+ # end
12
+ #
13
+ # class Subclass < Base
14
+ # end
15
+ #
16
+ # Base.setting = true
17
+ # Subclass.setting # => true
18
+ # Subclass.setting = false
19
+ # Subclass.setting # => false
20
+ # Base.setting # => true
21
+ #
22
+ # In the above case as long as Subclass does not assign a value to setting
23
+ # by performing <tt>Subclass.setting = _something_ </tt>, <tt>Subclass.setting</tt>
24
+ # would read value assigned to parent class. Once Subclass assigns a value then
25
+ # the value assigned by Subclass would be returned.
26
+ #
27
+ # This matches normal Ruby method inheritance: think of writing an attribute
28
+ # on a subclass as overriding the reader method. However, you need to be aware
29
+ # when using +class_attribute+ with mutable structures as +Array+ or +Hash+.
30
+ # In such cases, you don't want to do changes in places but use setters:
31
+ #
32
+ # Base.setting = []
33
+ # Base.setting # => []
34
+ # Subclass.setting # => []
35
+ #
36
+ # # Appending in child changes both parent and child because it is the same object:
37
+ # Subclass.setting << :foo
38
+ # Base.setting # => [:foo]
39
+ # Subclass.setting # => [:foo]
40
+ #
41
+ # # Use setters to not propagate changes:
42
+ # Base.setting = []
43
+ # Subclass.setting += [:foo]
44
+ # Base.setting # => []
45
+ # Subclass.setting # => [:foo]
46
+ #
47
+ # For convenience, a query method is defined as well:
48
+ #
49
+ # Subclass.setting? # => false
50
+ #
51
+ # Instances may overwrite the class value in the same way:
52
+ #
53
+ # Base.setting = true
54
+ # object = Base.new
55
+ # object.setting # => true
56
+ # object.setting = false
57
+ # object.setting # => false
58
+ # Base.setting # => true
59
+ #
60
+ # To opt out of the instance reader method, pass :instance_reader => false.
61
+ #
62
+ # object.setting # => NoMethodError
63
+ # object.setting? # => NoMethodError
64
+ #
65
+ # To opt out of the instance writer method, pass :instance_writer => false.
66
+ #
67
+ # object.setting = false # => NoMethodError
68
+ def class_attribute(*attrs)
69
+ options = attrs.extract_options!
70
+ instance_reader = options.fetch(:instance_reader, true)
71
+ instance_writer = options.fetch(:instance_writer, true)
72
+
73
+ attrs.each do |name|
74
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
75
+ def self.#{name}() nil end
76
+ def self.#{name}?() !!#{name} end
77
+
78
+ def self.#{name}=(val)
79
+ singleton_class.class_eval do
80
+ remove_possible_method(:#{name})
81
+ define_method(:#{name}) { val }
82
+ end
83
+
84
+ if singleton_class?
85
+ class_eval do
86
+ remove_possible_method(:#{name})
87
+ def #{name}
88
+ defined?(@#{name}) ? @#{name} : singleton_class.#{name}
89
+ end
90
+ end
91
+ end
92
+ val
93
+ end
94
+
95
+ if instance_reader
96
+ remove_possible_method :#{name}
97
+ def #{name}
98
+ defined?(@#{name}) ? @#{name} : self.class.#{name}
99
+ end
100
+
101
+ def #{name}?
102
+ !!#{name}
103
+ end
104
+ end
105
+ RUBY
106
+
107
+ attr_writer name if instance_writer
108
+ end
109
+ end
110
+
111
+ private
112
+ def singleton_class?
113
+ !name || '' == name
114
+ end
115
+ end
@@ -0,0 +1,15 @@
1
+ require 'date'
2
+
3
+
4
+ class DateTime
5
+ # Ruby 1.9 has DateTime#to_time which internally relies on Time. We define our own #to_time which allows
6
+ # DateTimes outside the range of what can be created with Time.
7
+ remove_method :to_time if instance_methods.include?(:to_time)
8
+
9
+ # Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class.
10
+ # If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time.
11
+ def to_time
12
+ self.offset == 0 ? ::Time.utc(year, month, day, hour, min, sec, sec_fraction * (RUBY_VERSION < '1.9' ? 86400000000 : 1000000)) : self
13
+ end
14
+
15
+ end
@@ -0,0 +1,13 @@
1
+ module Kernel
2
+ # Returns the object's singleton class.
3
+ def singleton_class
4
+ class << self
5
+ self
6
+ end
7
+ end unless respond_to?(:singleton_class) # exists in 1.9.2
8
+
9
+ # class_eval on an object acts like singleton_class.class_eval.
10
+ def class_eval(*args, &block)
11
+ singleton_class.class_eval(*args, &block)
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class Module
2
+ def remove_possible_method(method)
3
+ if method_defined?(method) || private_method_defined?(method)
4
+ remove_method(method)
5
+ end
6
+ rescue NameError
7
+ # If the requested method is defined on a superclass or included module,
8
+ # method_defined? returns true but remove_method throws a NameError.
9
+ # Ignore this.
10
+ end
11
+
12
+ def redefine_method(method, &block)
13
+ remove_possible_method(method)
14
+ define_method(method, &block)
15
+ end
16
+ end