nominet-epp 0.0.12 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.travis.yml +14 -0
  4. data/.yardopts +8 -2
  5. data/Gemfile +22 -0
  6. data/Gemfile.lock +64 -0
  7. data/HISTORY.md +78 -0
  8. data/LICENSE +1 -1
  9. data/README.md +23 -0
  10. data/Rakefile +2 -37
  11. data/gemfiles/Gemfile.ruby18 +13 -0
  12. data/lib/nominet-epp/client.rb +364 -0
  13. data/lib/nominet-epp/notification.rb +346 -0
  14. data/lib/nominet-epp/operations.rb +2 -7
  15. data/lib/nominet-epp/request.rb +165 -0
  16. data/lib/nominet-epp/requests/contact/check.rb +9 -0
  17. data/lib/nominet-epp/requests/contact/create.rb +60 -0
  18. data/lib/nominet-epp/requests/contact/delete.rb +9 -0
  19. data/lib/nominet-epp/requests/contact/info.rb +9 -0
  20. data/lib/nominet-epp/requests/contact/release.rb +33 -0
  21. data/lib/nominet-epp/requests/contact/update.rb +63 -0
  22. data/lib/nominet-epp/requests/custom/handshake.rb +36 -0
  23. data/lib/nominet-epp/requests/custom/list.rb +38 -0
  24. data/lib/nominet-epp/requests/custom/tag_list.rb +25 -0
  25. data/lib/nominet-epp/requests/domain/check.rb +98 -0
  26. data/lib/nominet-epp/requests/domain/create.rb +97 -0
  27. data/lib/nominet-epp/requests/domain/delete.rb +9 -0
  28. data/lib/nominet-epp/requests/domain/info.rb +9 -0
  29. data/lib/nominet-epp/requests/domain/release.rb +33 -0
  30. data/lib/nominet-epp/requests/domain/renew.rb +9 -0
  31. data/lib/nominet-epp/requests/domain/unrenew.rb +33 -0
  32. data/lib/nominet-epp/requests/domain/update.rb +134 -0
  33. data/lib/nominet-epp/requests/host/check.rb +9 -0
  34. data/lib/nominet-epp/requests/host/create.rb +9 -0
  35. data/lib/nominet-epp/requests/host/delete.rb +9 -0
  36. data/lib/nominet-epp/requests/host/info.rb +9 -0
  37. data/lib/nominet-epp/requests/host/update.rb +9 -0
  38. data/lib/nominet-epp/responses/contact/check_response.rb +10 -0
  39. data/lib/nominet-epp/responses/contact/create_response.rb +14 -0
  40. data/lib/nominet-epp/responses/contact/delete_response.rb +10 -0
  41. data/lib/nominet-epp/responses/contact/info_response.rb +89 -0
  42. data/lib/nominet-epp/responses/contact/release_response.rb +10 -0
  43. data/lib/nominet-epp/responses/contact/update_response.rb +10 -0
  44. data/lib/nominet-epp/responses/custom/handshake_response.rb +33 -0
  45. data/lib/nominet-epp/responses/custom/list_response.rb +29 -0
  46. data/lib/nominet-epp/responses/custom/tag_list_response.rb +37 -0
  47. data/lib/nominet-epp/responses/domain/check_response.rb +40 -0
  48. data/lib/nominet-epp/responses/domain/create_response.rb +10 -0
  49. data/lib/nominet-epp/responses/domain/delete_response.rb +10 -0
  50. data/lib/nominet-epp/responses/domain/info_response.rb +128 -0
  51. data/lib/nominet-epp/responses/domain/release_response.rb +10 -0
  52. data/lib/nominet-epp/responses/domain/renew_response.rb +10 -0
  53. data/lib/nominet-epp/responses/domain/unrenew_response.rb +26 -0
  54. data/lib/nominet-epp/responses/domain/update_response.rb +10 -0
  55. data/lib/nominet-epp/responses/host/check_response.rb +10 -0
  56. data/lib/nominet-epp/responses/host/create_response.rb +14 -0
  57. data/lib/nominet-epp/responses/host/delete_response.rb +10 -0
  58. data/lib/nominet-epp/responses/host/info_response.rb +14 -0
  59. data/lib/nominet-epp/responses/host/update_response.rb +10 -0
  60. data/lib/nominet-epp/responses/response.rb +27 -0
  61. data/lib/nominet-epp/version.rb +4 -0
  62. data/lib/nominet-epp.rb +60 -161
  63. data/nominet-epp.gemspec +15 -65
  64. data/test/helper.rb +57 -0
  65. data/test/notifications/test_contact_deleted_notification.rb +23 -0
  66. data/test/notifications/test_domain_cancelled_notification.rb +23 -0
  67. data/test/notifications/test_domains_released_notification.rb +34 -0
  68. data/test/notifications/test_domains_suspended_notification.rb +30 -0
  69. data/test/notifications/test_handshake_rejected_notification.rb +34 -0
  70. data/test/notifications/test_registrant_transfer_notification.rb +78 -0
  71. data/test/notifications/test_registrar_change_notification.rb +119 -0
  72. data/test/requests/contact/test_contact_check_request.rb +25 -0
  73. data/test/requests/contact/test_contact_create_request.rb +104 -0
  74. data/test/requests/contact/test_contact_delete_request.rb +20 -0
  75. data/test/requests/contact/test_contact_info_request.rb +20 -0
  76. data/test/requests/contact/test_contact_release_request.rb +29 -0
  77. data/test/requests/contact/test_contact_update_request.rb +111 -0
  78. data/test/requests/custom/test_custom_handshake_request.rb +42 -0
  79. data/test/requests/custom/test_custom_list_request.rb +44 -0
  80. data/test/requests/custom/test_custom_tag_list_request.rb +21 -0
  81. data/test/requests/domain/test_domain_check_request.rb +140 -0
  82. data/test/requests/domain/test_domain_create_request.rb +136 -0
  83. data/test/requests/domain/test_domain_delete_request.rb +20 -0
  84. data/test/requests/domain/test_domain_info_request.rb +20 -0
  85. data/test/requests/domain/test_domain_release_request.rb +29 -0
  86. data/test/requests/domain/test_domain_renew_request.rb +15 -0
  87. data/test/requests/domain/test_domain_unrenew_request.rb +32 -0
  88. data/test/requests/domain/test_domain_update_request.rb +163 -0
  89. data/test/requests/host/test_host_check_request.rb +25 -0
  90. data/test/requests/host/test_host_create_request.rb +33 -0
  91. data/test/requests/host/test_host_delete_request.rb +20 -0
  92. data/test/requests/host/test_host_info_request.rb +20 -0
  93. data/test/requests/host/test_host_update_request.rb +55 -0
  94. data/test/responses/contact/test_contact_check_response.rb +28 -0
  95. data/test/responses/contact/test_contact_create_response.rb +28 -0
  96. data/test/responses/contact/test_contact_delete_response.rb +18 -0
  97. data/test/responses/contact/test_contact_info_response.rb +79 -0
  98. data/test/responses/contact/test_contact_release_response.rb +18 -0
  99. data/test/responses/contact/test_contact_update_response.rb +18 -0
  100. data/test/responses/custom/test_custom_handshake_response.rb +27 -0
  101. data/test/responses/custom/test_custom_list_response.rb +44 -0
  102. data/test/responses/custom/test_custom_tag_list_response.rb +43 -0
  103. data/test/responses/domain/test_domain_check_response.rb +56 -0
  104. data/test/responses/domain/test_domain_create_response.rb +34 -0
  105. data/test/responses/domain/test_domain_delete_response.rb +18 -0
  106. data/test/responses/domain/test_domain_info_response.rb +76 -0
  107. data/test/responses/domain/test_domain_release_response.rb +18 -0
  108. data/test/responses/domain/test_domain_renew_response.rb +27 -0
  109. data/test/responses/domain/test_domain_unrenew_response.rb +32 -0
  110. data/test/responses/domain/test_domain_update_response.rb +18 -0
  111. data/test/responses/host/test_host_check_response.rb +28 -0
  112. data/test/responses/host/test_host_create_response.rb +28 -0
  113. data/test/responses/host/test_host_delete_response.rb +18 -0
  114. data/test/responses/host/test_host_info_response.rb +28 -0
  115. data/test/responses/host/test_host_update_response.rb +18 -0
  116. data/test/support/responses/contact/check.xml +23 -0
  117. data/test/support/responses/contact/create.xml +23 -0
  118. data/test/support/responses/contact/delete.xml +12 -0
  119. data/test/support/responses/contact/info.xml +46 -0
  120. data/test/support/responses/contact/release.xml +12 -0
  121. data/test/support/responses/contact/update.xml +12 -0
  122. data/test/support/responses/custom/handshake.xml +24 -0
  123. data/test/support/responses/custom/list.xml +28 -0
  124. data/test/support/responses/custom/list_empty.xml +21 -0
  125. data/test/support/responses/custom/tag_list.xml +28 -0
  126. data/test/support/responses/domain/check-direct-rights.xml +1 -0
  127. data/test/support/responses/domain/check.xml +25 -0
  128. data/test/support/responses/domain/create.xml +24 -0
  129. data/test/support/responses/domain/delete.xml +12 -0
  130. data/test/support/responses/domain/info.xml +45 -0
  131. data/test/support/responses/domain/release.xml +12 -0
  132. data/test/support/responses/domain/renew.xml +24 -0
  133. data/test/support/responses/domain/unrenew.xml +26 -0
  134. data/test/support/responses/domain/update.xml +12 -0
  135. data/test/support/responses/host/check.xml +23 -0
  136. data/test/support/responses/host/create.xml +18 -0
  137. data/test/support/responses/host/delete.xml +12 -0
  138. data/test/support/responses/host/info.xml +25 -0
  139. data/test/support/responses/host/update.xml +12 -0
  140. data/test/support/responses/notifications/abuse-feed.xml +31 -0
  141. data/test/support/responses/notifications/account-change.xml +39 -0
  142. data/test/support/responses/notifications/contact-deleted.xml +22 -0
  143. data/test/support/responses/notifications/data-quality.xml +53 -0
  144. data/test/support/responses/notifications/domain-cancelled.xml +22 -0
  145. data/test/support/responses/notifications/domains-released.xml +31 -0
  146. data/test/support/responses/notifications/domains-suspended.xml +26 -0
  147. data/test/support/responses/notifications/handshake-rejected.xml +31 -0
  148. data/test/support/responses/notifications/handshake-request.xml +65 -0
  149. data/test/support/responses/notifications/hosts-cancelled.xml +28 -0
  150. data/test/support/responses/notifications/referral-accepted.xml +23 -0
  151. data/test/support/responses/notifications/referral-rejected.xml +22 -0
  152. data/test/support/responses/notifications/registrant-transfer.xml +54 -0
  153. data/test/support/responses/notifications/registrar-change.xml +67 -0
  154. data/test/support/schemas/README +12 -0
  155. data/test/support/schemas/RELEASENOTES +54 -0
  156. data/test/support/schemas/contact-1.0.xsd +387 -0
  157. data/test/support/schemas/contact-nom-ext-1.0.xsd +144 -0
  158. data/test/support/schemas/domain-1.0.xsd +432 -0
  159. data/test/support/schemas/domain-nom-ext-1.2.xsd +215 -0
  160. data/test/support/schemas/epp-1.0.xsd +403 -0
  161. data/test/support/schemas/eppcom-1.0.xsd +93 -0
  162. data/test/support/schemas/host-1.0.xsd +240 -0
  163. data/test/support/schemas/nom-abuse-feed-1.0.xsd +46 -0
  164. data/test/support/schemas/nom-direct-rights-1.0.xsd +48 -0
  165. data/test/support/schemas/nom-root-std-1.0.7.xsd +47 -0
  166. data/test/support/schemas/nom-root-tag-1.0.xsd +31 -0
  167. data/test/support/schemas/nom-tag-1.0.xsd +71 -0
  168. data/test/support/schemas/secDNS-1.1.xsd +127 -0
  169. data/test/support/schemas/std-contact-id-1.0.xsd +35 -0
  170. data/test/support/schemas/std-fork-1.0.xsd +31 -0
  171. data/test/support/schemas/std-handshake-1.0.xsd +61 -0
  172. data/test/support/schemas/std-list-1.0.xsd +55 -0
  173. data/test/support/schemas/std-locks-1.0.xsd +53 -0
  174. data/test/support/schemas/std-notifications-1.2.xsd +197 -0
  175. data/test/support/schemas/std-release-1.0.xsd +39 -0
  176. data/test/support/schemas/std-unrenew-1.0.xsd +26 -0
  177. data/test/support/schemas/std-warning-1.1.xsd +145 -0
  178. data/test/test_nominet-epp.rb +3 -3
  179. metadata +324 -104
  180. data/History.rdoc +0 -78
  181. data/README.rdoc +0 -23
  182. data/VERSION +0 -1
  183. data/lib/nominet-epp/operations/check.rb +0 -39
  184. data/lib/nominet-epp/operations/create.rb +0 -138
  185. data/lib/nominet-epp/operations/delete.rb +0 -20
  186. data/lib/nominet-epp/operations/fork.rb +0 -53
  187. data/lib/nominet-epp/operations/hello.rb +0 -11
  188. data/lib/nominet-epp/operations/info.rb +0 -93
  189. data/lib/nominet-epp/operations/list.rb +0 -83
  190. data/lib/nominet-epp/operations/lock.rb +0 -56
  191. data/lib/nominet-epp/operations/merge.rb +0 -41
  192. data/lib/nominet-epp/operations/poll.rb +0 -64
  193. data/lib/nominet-epp/operations/renew.rb +0 -40
  194. data/lib/nominet-epp/operations/transfer.rb +0 -84
  195. data/lib/nominet-epp/operations/unlock.rb +0 -56
  196. data/lib/nominet-epp/operations/unrenew.rb +0 -36
  197. data/lib/nominet-epp/operations/update.rb +0 -176
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1baec8eaf94460dfaaffe706aab21f691db5e124
4
+ data.tar.gz: 18c591b8f71fc9af7ff4b67b6bd600e9c4402f37
5
+ SHA512:
6
+ metadata.gz: 30bff530d232683cc4b6724c193c562fecd39b4ebfc09208c524c8f4e4a89900038485dd2c34f94714cc09b0088b4aa6afb6c0cbe81bb0f23964ea82b568ed08
7
+ data.tar.gz: ced5fbd803365d58a870a0e791be50b00f447518cb421a255a2936410ab5f9c8ed0f3d73b99f6384a05724790c19879e24dfd28d6ec126610848be38bf17df54
data/.gitignore ADDED
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ .bundle
18
+ coverage
19
+ rdoc
20
+ pkg
21
+
22
+ ## PROJECT::SPECIFIC
23
+ .yardoc
24
+ doc
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ bundler_args: --without doc coverage development
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ matrix:
7
+ include:
8
+ - rvm: 1.8.7
9
+ gemfile: gemfiles/Gemfile.ruby18
10
+ - rvm: ree
11
+ gemfile: gemfiles/Gemfile.ruby18
12
+ branches:
13
+ only:
14
+ - standard-epp
data/.yardopts CHANGED
@@ -1,2 +1,8 @@
1
- lib/**/*.rb -
2
- History.rdoc LICENSE
1
+ lib/**/*.rb
2
+ --tag internal
3
+ --hide-tag internal
4
+ --private
5
+ --protected
6
+ -r README.md
7
+ -
8
+ HISTORY.md LICENSE
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nominet-epp.gemspec
4
+ gemspec
5
+
6
+ gem 'rake'
7
+ gem 'epp-client', :github => "m247/epp-client"
8
+
9
+ group :development do
10
+ gem 'pry'
11
+ gem 'pry-doc'
12
+ gem 'awesome_print'
13
+ end
14
+
15
+ group :test do
16
+ gem 'shoulda'
17
+ end
18
+
19
+ group :doc do
20
+ gem 'yard'
21
+ gem 'redcarpet'
22
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,64 @@
1
+ GIT
2
+ remote: git://github.com/m247/epp-client.git
3
+ revision: a07e51fefcc2a68a317cf1200d4d80ce0b7dbfe0
4
+ specs:
5
+ epp-client (1.0.0)
6
+ libxml-ruby
7
+
8
+ PATH
9
+ remote: .
10
+ specs:
11
+ nominet-epp (1.0.0)
12
+ epp-client (~> 1.0.0)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ activesupport (4.0.0)
18
+ i18n (~> 0.6, >= 0.6.4)
19
+ minitest (~> 4.2)
20
+ multi_json (~> 1.3)
21
+ thread_safe (~> 0.1)
22
+ tzinfo (~> 0.3.37)
23
+ atomic (1.1.14)
24
+ awesome_print (1.2.0)
25
+ coderay (1.0.9)
26
+ i18n (0.6.5)
27
+ libxml-ruby (2.7.0)
28
+ method_source (0.8.2)
29
+ minitest (4.7.5)
30
+ multi_json (1.8.0)
31
+ pry (0.9.12.2)
32
+ coderay (~> 1.0.5)
33
+ method_source (~> 0.8)
34
+ slop (~> 3.4)
35
+ pry-doc (0.4.6)
36
+ pry (>= 0.9)
37
+ yard (>= 0.8)
38
+ rake (10.1.0)
39
+ redcarpet (3.0.0)
40
+ shoulda (3.5.0)
41
+ shoulda-context (~> 1.0, >= 1.0.1)
42
+ shoulda-matchers (>= 1.4.1, < 3.0)
43
+ shoulda-context (1.1.5)
44
+ shoulda-matchers (2.4.0)
45
+ activesupport (>= 3.0.0)
46
+ slop (3.4.6)
47
+ thread_safe (0.1.3)
48
+ atomic
49
+ tzinfo (0.3.37)
50
+ yard (0.8.7.2)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ awesome_print
57
+ epp-client!
58
+ nominet-epp!
59
+ pry
60
+ pry-doc
61
+ rake
62
+ redcarpet
63
+ shoulda
64
+ yard
data/HISTORY.md ADDED
@@ -0,0 +1,78 @@
1
+ # NominetEPP History
2
+
3
+ ## 0.0.12 / 2011-05-24
4
+
5
+ * Capture +domain:failData+ information from +create+ operation failures.
6
+
7
+ ## 0.0.11 / 2011-05-17
8
+
9
+ * Remove setting account:contact[type] attribute as this is not in the schema
10
+
11
+ ## 0.0.10 / 2011-05-04
12
+
13
+ * Fix syntax error in helpers.rb
14
+
15
+ ## 0.0.9 / 2011-05-04
16
+
17
+ * Correct implementation of Update Operation for domain, account and contact to send
18
+ the correct sequence of XML elements
19
+
20
+ ## 0.0.8 / 2011-05-03
21
+
22
+ * Amend account:contact elements in Create operation to ensure order attribute range
23
+ * Fix sequencing of elements in account:addr block
24
+ * Fix sequencing of elements in contact:create block
25
+ * Fix sequencing of elements in account:create block
26
+ * Enforce the correct element sequencing for the domain:create operation
27
+
28
+ ## 0.0.7 / 2011-04-21
29
+
30
+ * Yank v0.0.6 and bump version to fix bug introduced in v0.0.6
31
+
32
+ ## 0.0.6 / 2011-04-21
33
+
34
+ * Fix "Command Syntax Error" response for Create operation with "2y" style periods
35
+
36
+ ## 0.0.5 / 2011-02-24
37
+
38
+ * Many bug fixes in Create operation
39
+ * Support for using `host:update` to modify name server glue information.
40
+
41
+ ## 0.0.4 / 2011-01-31
42
+
43
+ * Operations now cache their responses, accessible through `Client#last_response`
44
+ * Last response messages are available through `Client#last_message`
45
+
46
+ ## 0.0.3 / 2011-01-17
47
+
48
+ * Tweak how #poll method works w.r.t blocks
49
+
50
+ ## 0.0.2 / 2011-01-07
51
+
52
+ * Add Documentation
53
+ * Support the 'abuse-limit' on Nominet check operation
54
+ * Fix issue with info operation XML response parsing
55
+
56
+ ## 0.0.1 / 2010-05-26
57
+
58
+ * Add support for 'none' and 'all' options on list operation
59
+ * Fix bugs in info operation for account objects
60
+ * Improve handling of XML namespaces and schema locations
61
+
62
+ ## 0.0.0 / 2010-05-25
63
+
64
+ * Initial release
65
+ * Supports the following operations
66
+ * Create
67
+ * Delete
68
+ * Fork
69
+ * Hello
70
+ * Info
71
+ * List
72
+ * Lock
73
+ * Merge
74
+ * Poll
75
+ * Transfer
76
+ * Unlock
77
+ * Unrenew
78
+ * Update
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Geoff Garside
1
+ Copyright (c) 2010 Geoff Garside (M247 Ltd)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Nominet EPP
2
+
3
+ Ruby interface to the [Nominet EPP][http://www.nominet.org.uk/registrars/systems/nominetepp] registrar interface.
4
+
5
+ ## Initialise a client
6
+
7
+ require 'nominet-epp'
8
+ client = NominetEPP::Client.new('TAGNAME', 'password')
9
+ testclient = NominetEPP::Client.new('TAGNAME', 'password', 'testbed-epp.nominet.org.uk')
10
+
11
+ ## Note on Patches/Pull Requests
12
+
13
+ * Fork the project.
14
+ * Make your feature addition or bug fix.
15
+ * Add tests for it. This is important so I don't break it in a
16
+ future version unintentionally.
17
+ * Commit, do not mess with rakefile, version, or history.
18
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
19
+ * Send me a pull request. Bonus points for topic branches.
20
+
21
+ ## Copyright
22
+
23
+ Copyright (c) 2010 Geoff Garside (M247 Ltd). See LICENSE for details.
data/Rakefile CHANGED
@@ -1,25 +1,5 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "nominet-epp"
8
- gem.summary = %Q{Nominet EPP (Extensible Provisioning Protocol) Client}
9
- gem.description = %Q{Client for communicating with the Nominet EPP}
10
- gem.email = "geoff@geoffgarside.co.uk"
11
- gem.homepage = "http://github.com/geoffgarside/nominet-epp"
12
- gem.authors = ["Geoff Garside"]
13
- gem.add_development_dependency "shoulda", ">= 0"
14
- gem.add_development_dependency "yard", ">= 0"
15
-
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- gem.add_dependency "epp-client", ">= 0"
18
- end
19
- Jeweler::GemcutterTasks.new
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
22
- end
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
23
3
 
24
4
  require 'rake/testtask'
25
5
  Rake::TestTask.new(:test) do |test|
@@ -28,21 +8,6 @@ Rake::TestTask.new(:test) do |test|
28
8
  test.verbose = true
29
9
  end
30
10
 
31
- begin
32
- require 'rcov/rcovtask'
33
- Rcov::RcovTask.new do |test|
34
- test.libs << 'test'
35
- test.pattern = 'test/**/test_*.rb'
36
- test.verbose = true
37
- end
38
- rescue LoadError
39
- task :rcov do
40
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
41
- end
42
- end
43
-
44
- task :test => :check_dependencies
45
-
46
11
  task :default => :test
47
12
 
48
13
  begin
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nominet-epp.gemspec
4
+ gemspec :path => '../'
5
+
6
+ gem 'rake'
7
+ gem 'activesupport', '~> 3.2.14'
8
+ gem 'epp-client', :github => "m247/epp-client"
9
+
10
+ group :test do
11
+ gem 'shoulda-matchers', '~> 1.5.6'
12
+ gem 'shoulda'
13
+ end
@@ -0,0 +1,364 @@
1
+ module NominetEPP
2
+ # Front end interface Client to the NominetEPP Service
3
+ class Client
4
+ # Standard EPP Services to be used
5
+ SERVICE_URNS = EPP::Client::DEFAULT_SERVICES
6
+
7
+ # Additional Nominet specific service extensions
8
+ SERVICE_EXTENSION_URNS = %w(
9
+ urn:ietf:params:xml:ns:secDNS-1.1
10
+ http://www.nominet.org.uk/epp/xml/domain-nom-ext-1.2
11
+ http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0
12
+ http://www.nominet.org.uk/epp/xml/std-notifications-1.2
13
+ http://www.nominet.org.uk/epp/xml/std-handshake-1.0
14
+ http://www.nominet.org.uk/epp/xml/std-warning-1.1
15
+ http://www.nominet.org.uk/epp/xml/std-release-1.0
16
+ http://www.nominet.org.uk/epp/xml/std-unrenew-1.0
17
+ http://www.nominet.org.uk/epp/xml/std-list-1.0
18
+ http://www.nominet.org.uk/epp/xml/nom-direct-rights-1.0)
19
+
20
+ # Create a new instance of NominetEPP::Client
21
+ #
22
+ # @param [String] tag Nominet TAG
23
+ # @param [String] passwd Nominet TAG EPP Password
24
+ # @param [String] server Nominet EPP Server address (nil forces default)
25
+ # @param [String] address_family 'AF_INET' or 'AF_INET6' or either of the
26
+ # appropriate socket constants. Will cause connections to be
27
+ # limited to this address family. Default try all addresses.
28
+ def initialize(tag, passwd, server = 'epp.nominet.org.uk', address_family = nil)
29
+ @tag, @server = tag, (server || 'epp.nominet.org.uk')
30
+ @client = EPP::Client.new(@tag, passwd, @server, :services => SERVICE_URNS,
31
+ :extensions => SERVICE_EXTENSION_URNS, :address_family => address_family)
32
+ end
33
+
34
+ # @see Object#inspect
35
+ def inspect
36
+ "#<#{self.class} #{@tag}@#{@server}>"
37
+ end
38
+
39
+ def self.logger=(l)
40
+ @@logger = l
41
+ end
42
+ def self.logger
43
+ @@logger ||= Logger.new(STDERR).tap do |l|
44
+ l.level = Logger::ERROR
45
+ end
46
+ end
47
+ def logger
48
+ self.class.logger
49
+ end
50
+
51
+ # Returns the last EPP::Request sent
52
+ #
53
+ # @return [EPP::Request] last sent request
54
+ def last_request
55
+ @client.last_request
56
+ end
57
+
58
+ # Returns the last EPP::Response received
59
+ #
60
+ # @return [EPP::Response] last received response
61
+ def last_response
62
+ @client.last_response
63
+ end
64
+
65
+ # Returns the last EPP message received
66
+ #
67
+ # @return [String] last EPP message
68
+ # @see #last_response
69
+ def last_message
70
+ last_response.message
71
+ end
72
+
73
+ # Returns the last Nominet failData response found
74
+ #
75
+ # @note This is presently only set by certain method calls,
76
+ # so it may not always be present.
77
+ # @return [Hash] last failData found
78
+ def last_error_info
79
+ @error_info || {}
80
+ end
81
+
82
+ def greeting
83
+ @client._greeting
84
+ end
85
+
86
+ def hello
87
+ @client.hello
88
+ end
89
+
90
+ def check(entity, *names)
91
+ check_entity! entity
92
+
93
+ mod = module_for_type(entity)
94
+ req = mod::Check.new(*names)
95
+ res = @client.check(req.command, req.extension)
96
+
97
+ mod::CheckResponse.new(res)
98
+ end
99
+
100
+ def create(entity, name, attributes = {})
101
+ check_entity! entity
102
+
103
+ mod = module_for_type(entity)
104
+ req = mod::Create.new(name, attributes)
105
+ res = @client.create(req.command, req.extension)
106
+
107
+ mod::CreateResponse.new(res)
108
+ end
109
+
110
+ def delete(entity, name)
111
+ check_entity! entity
112
+
113
+ unless entity == :domain || entity == 'domain'
114
+ raise ArgumentError, "#{entity} entity is not supported for the delete operation at this time"
115
+ end
116
+
117
+ mod = module_for_type(entity)
118
+ req = mod::Delete.new(name)
119
+ res = @client.delete(req.command, req.extension)
120
+
121
+ mod::DeleteResponse.new(res)
122
+ end
123
+
124
+ def info(entity, name)
125
+ check_entity! entity
126
+
127
+ mod = module_for_type(entity)
128
+ req = mod::Info.new(name)
129
+ res = @client.info(req.command, req.extension)
130
+
131
+ mod::InfoResponse.new(res)
132
+ end
133
+
134
+ def poll
135
+ while res = @client.poll
136
+ res = Notification.new(res)
137
+
138
+ return if res.code != 1301 || res.msgQ['count'] == '0'
139
+ return [res.msgQ['id'], res] unless block_given?
140
+
141
+ result = yield res
142
+ return if result == false
143
+
144
+ raise AckError, "failed to acknowledge #{res.msgQ['id']}" unless @client.ack(res.msgQ['id'])
145
+ end
146
+ end
147
+
148
+ def ack(msgID)
149
+ @client.ack(msgID)
150
+ end
151
+
152
+ def release(entity, name, tag)
153
+ entity = :contact if entity == 'registrant' || entity == :registrant
154
+ check_entity! entity
155
+
156
+ if entity == 'host' || entity == :host
157
+ raise ArgumentError, "host entity is not support for the release operation"
158
+ end
159
+
160
+ mod = module_for_type(entity)
161
+ req = mod::Release.new(name, tag)
162
+ res = @client.update(req.command, req.extension)
163
+
164
+ mod::ReleaseResponse.new(res)
165
+ end
166
+
167
+ def renew(name, expiry_date, period = '2y')
168
+ req = Domain::Renew.new(name, expiry_date, period)
169
+ res = @client.renew(req.command, req.extension)
170
+
171
+ Domain::RenewResponse.new(res)
172
+ end
173
+
174
+ def update(entity, name, changes = {})
175
+ check_entity! entity
176
+
177
+ mod = module_for_type(entity)
178
+ req = mod::Update.new(name, changes)
179
+ res = @client.update(req.command, req.extension)
180
+
181
+ mod::UpdateResponse.new(res)
182
+ end
183
+
184
+ private
185
+ def check_entity!(entity)
186
+ unless [:domain, :contact, :host, 'domain', 'contact', 'host'].include?(entity)
187
+ raise ArgumentError, "Unsupported entity #{entity}"
188
+ end
189
+ end
190
+ def module_for_type(name)
191
+ case name
192
+ when :domain, 'domain'
193
+ Domain
194
+ when :contact, 'contact'
195
+ Contact
196
+ when :host, 'host'
197
+ Host
198
+ end
199
+ end
200
+
201
+ # Wrapper for ActiveSupport::Notifications if available to perform
202
+ # instrumentation of methods.
203
+ #
204
+ # @internal
205
+ # @param [String,Symbol] name Instrument name. Will be prefixed with "request.nominetepp".
206
+ # @param [Hash] payload Extra information to be included with the instrumentation data.
207
+ def instrument(name, payload = {})
208
+ if defined?(ActiveSupport::Notifications)
209
+ ActiveSupport::Notifications.instrument("request.nominetepp.#{name}", payload) do
210
+ yield
211
+ end
212
+ else
213
+ yield
214
+ end
215
+ end
216
+
217
+ # OldAPI
218
+ public
219
+ alias_method :new_check, :check
220
+ alias_method :new_create, :create
221
+ alias_method :new_delete, :delete
222
+ alias_method :new_release, :release
223
+ alias_method :new_renew, :renew
224
+ alias_method :new_update, :update
225
+ alias_method :new_info, :info
226
+
227
+ def check(entity, *names)
228
+ res = new_check(entity, *names)
229
+
230
+ if res.respond_to?(:abuse_limit)
231
+ @check_limit = res.abuse_limit
232
+ end
233
+
234
+ return res.available?(names.first) if names.length == 1
235
+
236
+ names.inject({}) do |hash, name|
237
+ hash[name] = res.available?(name)
238
+ hash
239
+ end
240
+ end
241
+ def create(entity, name, attributes = {})
242
+ res = new_create(entity, name, attributes)
243
+
244
+ if res.success?
245
+ case entity
246
+ when :domain, 'domain'
247
+ { :name => res.name,
248
+ :crDate => res.creation_date,
249
+ :exDate => res.expiration_date }
250
+ when :contact, 'contact'
251
+ { :name => res.id,
252
+ :crDate => res.creation_date }
253
+ when :host, 'host'
254
+ { :name => res.id,
255
+ :crDate => res.creation_date }
256
+ end
257
+ else
258
+ @error_info = { :name => res.message, :reason => res.error_reason }
259
+ return false
260
+ end
261
+ end
262
+ def delete(entity, name)
263
+ res = new_delete(entity, name)
264
+ res.success?
265
+ end
266
+ def release(entity, name, tag)
267
+ res = new_release(entity, name, tag)
268
+
269
+ case res.code
270
+ when 1000
271
+ { :result => true }
272
+ when 1001
273
+ { :result => :handshake }
274
+ else
275
+ false
276
+ end
277
+ end
278
+ def renew(name, expiry_date, period = '2y')
279
+ res = new_renew(name, expiry_date, period)
280
+
281
+ return false unless res.success?
282
+
283
+ raise "Renewed name #{res.name} does not match #{name}" if res.name != name
284
+ return res.expiration_date
285
+ end
286
+ def update(entity, name, changes = {})
287
+ res = new_update(entity, name, changes)
288
+ res.success?
289
+ end
290
+ def info(entity, name)
291
+ res = new_info(entity, name)
292
+
293
+ return false unless res.success?
294
+ return self.send(:"old_info_#{entity}", res)
295
+ end
296
+ def old_info_domain(res)
297
+ nameservers = res.nameservers.map do |ns|
298
+ h = { :name => ns['name'] }
299
+ h[:v4] = ns['ipv4'] if ns['ipv4']
300
+ h[:v6] = ns['ipv6'] if ns['ipv6']
301
+ h
302
+ end
303
+
304
+ {
305
+ :name => res.name,
306
+ :roid => res.roid,
307
+ :registrant => res.registrant,
308
+ :ns => nameservers,
309
+ :host => res.hosts,
310
+ :clID => res.client_id,
311
+ :crID => res.creator_id,
312
+ :crDate => res.created_date,
313
+ :upDate => res.updated_date,
314
+ :exDate => res.expiration_date,
315
+ :reg_status => res.reg_status,
316
+ :first_bill => res.first_bill,
317
+ :recur_bill => res.recur_bill,
318
+ :auto_bill => res.auto_bill,
319
+ :auto_period => res.auto_period,
320
+ :next_bill => res.next_bill,
321
+ :next_period => res.next_period,
322
+ :renew_not_required => res.renew_not_required,
323
+ :notes => res.notes,
324
+ :reseller => res.reseller,
325
+ :ds => res.ds
326
+ }
327
+ end
328
+ def old_info_contact(res)
329
+ {
330
+ :id => res.id,
331
+ :roid => res.roid,
332
+ :status => res.status[0],
333
+ :postal_info => res.postal_info,
334
+ :voice => res.voice,
335
+ :email => res.email,
336
+ :clID => res.client_id,
337
+ :crID => res.creator_id,
338
+ :crDate => res.created_date,
339
+ :type => res.type,
340
+ :trad_name => res.trad_name,
341
+ :co_no => res.co_no,
342
+ :opt_out => res.opt_out
343
+ }
344
+ end
345
+ def old_info_host(res)
346
+ addrs = res.addresses.try(:dup) || {}
347
+ addrs[:v4] = addrs.delete('ipv4')
348
+ addrs[:v6] = addrs.delete('ipv6')
349
+
350
+ addrs[:v4] = addrs[:v4][0] if addrs[:v4].kind_of?(Array)
351
+ addrs[:v6] = addrs[:v6][0] if addrs[:v6].kind_of?(Array)
352
+
353
+ {
354
+ :name => res.name,
355
+ :roid => res.roid,
356
+ :status => res.status[0],
357
+ :clID => res.client_id,
358
+ :crID => res.creator_id,
359
+ :crDate => res.created_date,
360
+ :addr => addrs
361
+ }
362
+ end
363
+ end
364
+ end