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.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +14 -0
- data/.yardopts +8 -2
- data/Gemfile +22 -0
- data/Gemfile.lock +64 -0
- data/HISTORY.md +78 -0
- data/LICENSE +1 -1
- data/README.md +23 -0
- data/Rakefile +2 -37
- data/gemfiles/Gemfile.ruby18 +13 -0
- data/lib/nominet-epp/client.rb +364 -0
- data/lib/nominet-epp/notification.rb +346 -0
- data/lib/nominet-epp/operations.rb +2 -7
- data/lib/nominet-epp/request.rb +165 -0
- data/lib/nominet-epp/requests/contact/check.rb +9 -0
- data/lib/nominet-epp/requests/contact/create.rb +60 -0
- data/lib/nominet-epp/requests/contact/delete.rb +9 -0
- data/lib/nominet-epp/requests/contact/info.rb +9 -0
- data/lib/nominet-epp/requests/contact/release.rb +33 -0
- data/lib/nominet-epp/requests/contact/update.rb +63 -0
- data/lib/nominet-epp/requests/custom/handshake.rb +36 -0
- data/lib/nominet-epp/requests/custom/list.rb +38 -0
- data/lib/nominet-epp/requests/custom/tag_list.rb +25 -0
- data/lib/nominet-epp/requests/domain/check.rb +98 -0
- data/lib/nominet-epp/requests/domain/create.rb +97 -0
- data/lib/nominet-epp/requests/domain/delete.rb +9 -0
- data/lib/nominet-epp/requests/domain/info.rb +9 -0
- data/lib/nominet-epp/requests/domain/release.rb +33 -0
- data/lib/nominet-epp/requests/domain/renew.rb +9 -0
- data/lib/nominet-epp/requests/domain/unrenew.rb +33 -0
- data/lib/nominet-epp/requests/domain/update.rb +134 -0
- data/lib/nominet-epp/requests/host/check.rb +9 -0
- data/lib/nominet-epp/requests/host/create.rb +9 -0
- data/lib/nominet-epp/requests/host/delete.rb +9 -0
- data/lib/nominet-epp/requests/host/info.rb +9 -0
- data/lib/nominet-epp/requests/host/update.rb +9 -0
- data/lib/nominet-epp/responses/contact/check_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/create_response.rb +14 -0
- data/lib/nominet-epp/responses/contact/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/info_response.rb +89 -0
- data/lib/nominet-epp/responses/contact/release_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/update_response.rb +10 -0
- data/lib/nominet-epp/responses/custom/handshake_response.rb +33 -0
- data/lib/nominet-epp/responses/custom/list_response.rb +29 -0
- data/lib/nominet-epp/responses/custom/tag_list_response.rb +37 -0
- data/lib/nominet-epp/responses/domain/check_response.rb +40 -0
- data/lib/nominet-epp/responses/domain/create_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/info_response.rb +128 -0
- data/lib/nominet-epp/responses/domain/release_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/renew_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/unrenew_response.rb +26 -0
- data/lib/nominet-epp/responses/domain/update_response.rb +10 -0
- data/lib/nominet-epp/responses/host/check_response.rb +10 -0
- data/lib/nominet-epp/responses/host/create_response.rb +14 -0
- data/lib/nominet-epp/responses/host/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/host/info_response.rb +14 -0
- data/lib/nominet-epp/responses/host/update_response.rb +10 -0
- data/lib/nominet-epp/responses/response.rb +27 -0
- data/lib/nominet-epp/version.rb +4 -0
- data/lib/nominet-epp.rb +60 -161
- data/nominet-epp.gemspec +15 -65
- data/test/helper.rb +57 -0
- data/test/notifications/test_contact_deleted_notification.rb +23 -0
- data/test/notifications/test_domain_cancelled_notification.rb +23 -0
- data/test/notifications/test_domains_released_notification.rb +34 -0
- data/test/notifications/test_domains_suspended_notification.rb +30 -0
- data/test/notifications/test_handshake_rejected_notification.rb +34 -0
- data/test/notifications/test_registrant_transfer_notification.rb +78 -0
- data/test/notifications/test_registrar_change_notification.rb +119 -0
- data/test/requests/contact/test_contact_check_request.rb +25 -0
- data/test/requests/contact/test_contact_create_request.rb +104 -0
- data/test/requests/contact/test_contact_delete_request.rb +20 -0
- data/test/requests/contact/test_contact_info_request.rb +20 -0
- data/test/requests/contact/test_contact_release_request.rb +29 -0
- data/test/requests/contact/test_contact_update_request.rb +111 -0
- data/test/requests/custom/test_custom_handshake_request.rb +42 -0
- data/test/requests/custom/test_custom_list_request.rb +44 -0
- data/test/requests/custom/test_custom_tag_list_request.rb +21 -0
- data/test/requests/domain/test_domain_check_request.rb +140 -0
- data/test/requests/domain/test_domain_create_request.rb +136 -0
- data/test/requests/domain/test_domain_delete_request.rb +20 -0
- data/test/requests/domain/test_domain_info_request.rb +20 -0
- data/test/requests/domain/test_domain_release_request.rb +29 -0
- data/test/requests/domain/test_domain_renew_request.rb +15 -0
- data/test/requests/domain/test_domain_unrenew_request.rb +32 -0
- data/test/requests/domain/test_domain_update_request.rb +163 -0
- data/test/requests/host/test_host_check_request.rb +25 -0
- data/test/requests/host/test_host_create_request.rb +33 -0
- data/test/requests/host/test_host_delete_request.rb +20 -0
- data/test/requests/host/test_host_info_request.rb +20 -0
- data/test/requests/host/test_host_update_request.rb +55 -0
- data/test/responses/contact/test_contact_check_response.rb +28 -0
- data/test/responses/contact/test_contact_create_response.rb +28 -0
- data/test/responses/contact/test_contact_delete_response.rb +18 -0
- data/test/responses/contact/test_contact_info_response.rb +79 -0
- data/test/responses/contact/test_contact_release_response.rb +18 -0
- data/test/responses/contact/test_contact_update_response.rb +18 -0
- data/test/responses/custom/test_custom_handshake_response.rb +27 -0
- data/test/responses/custom/test_custom_list_response.rb +44 -0
- data/test/responses/custom/test_custom_tag_list_response.rb +43 -0
- data/test/responses/domain/test_domain_check_response.rb +56 -0
- data/test/responses/domain/test_domain_create_response.rb +34 -0
- data/test/responses/domain/test_domain_delete_response.rb +18 -0
- data/test/responses/domain/test_domain_info_response.rb +76 -0
- data/test/responses/domain/test_domain_release_response.rb +18 -0
- data/test/responses/domain/test_domain_renew_response.rb +27 -0
- data/test/responses/domain/test_domain_unrenew_response.rb +32 -0
- data/test/responses/domain/test_domain_update_response.rb +18 -0
- data/test/responses/host/test_host_check_response.rb +28 -0
- data/test/responses/host/test_host_create_response.rb +28 -0
- data/test/responses/host/test_host_delete_response.rb +18 -0
- data/test/responses/host/test_host_info_response.rb +28 -0
- data/test/responses/host/test_host_update_response.rb +18 -0
- data/test/support/responses/contact/check.xml +23 -0
- data/test/support/responses/contact/create.xml +23 -0
- data/test/support/responses/contact/delete.xml +12 -0
- data/test/support/responses/contact/info.xml +46 -0
- data/test/support/responses/contact/release.xml +12 -0
- data/test/support/responses/contact/update.xml +12 -0
- data/test/support/responses/custom/handshake.xml +24 -0
- data/test/support/responses/custom/list.xml +28 -0
- data/test/support/responses/custom/list_empty.xml +21 -0
- data/test/support/responses/custom/tag_list.xml +28 -0
- data/test/support/responses/domain/check-direct-rights.xml +1 -0
- data/test/support/responses/domain/check.xml +25 -0
- data/test/support/responses/domain/create.xml +24 -0
- data/test/support/responses/domain/delete.xml +12 -0
- data/test/support/responses/domain/info.xml +45 -0
- data/test/support/responses/domain/release.xml +12 -0
- data/test/support/responses/domain/renew.xml +24 -0
- data/test/support/responses/domain/unrenew.xml +26 -0
- data/test/support/responses/domain/update.xml +12 -0
- data/test/support/responses/host/check.xml +23 -0
- data/test/support/responses/host/create.xml +18 -0
- data/test/support/responses/host/delete.xml +12 -0
- data/test/support/responses/host/info.xml +25 -0
- data/test/support/responses/host/update.xml +12 -0
- data/test/support/responses/notifications/abuse-feed.xml +31 -0
- data/test/support/responses/notifications/account-change.xml +39 -0
- data/test/support/responses/notifications/contact-deleted.xml +22 -0
- data/test/support/responses/notifications/data-quality.xml +53 -0
- data/test/support/responses/notifications/domain-cancelled.xml +22 -0
- data/test/support/responses/notifications/domains-released.xml +31 -0
- data/test/support/responses/notifications/domains-suspended.xml +26 -0
- data/test/support/responses/notifications/handshake-rejected.xml +31 -0
- data/test/support/responses/notifications/handshake-request.xml +65 -0
- data/test/support/responses/notifications/hosts-cancelled.xml +28 -0
- data/test/support/responses/notifications/referral-accepted.xml +23 -0
- data/test/support/responses/notifications/referral-rejected.xml +22 -0
- data/test/support/responses/notifications/registrant-transfer.xml +54 -0
- data/test/support/responses/notifications/registrar-change.xml +67 -0
- data/test/support/schemas/README +12 -0
- data/test/support/schemas/RELEASENOTES +54 -0
- data/test/support/schemas/contact-1.0.xsd +387 -0
- data/test/support/schemas/contact-nom-ext-1.0.xsd +144 -0
- data/test/support/schemas/domain-1.0.xsd +432 -0
- data/test/support/schemas/domain-nom-ext-1.2.xsd +215 -0
- data/test/support/schemas/epp-1.0.xsd +403 -0
- data/test/support/schemas/eppcom-1.0.xsd +93 -0
- data/test/support/schemas/host-1.0.xsd +240 -0
- data/test/support/schemas/nom-abuse-feed-1.0.xsd +46 -0
- data/test/support/schemas/nom-direct-rights-1.0.xsd +48 -0
- data/test/support/schemas/nom-root-std-1.0.7.xsd +47 -0
- data/test/support/schemas/nom-root-tag-1.0.xsd +31 -0
- data/test/support/schemas/nom-tag-1.0.xsd +71 -0
- data/test/support/schemas/secDNS-1.1.xsd +127 -0
- data/test/support/schemas/std-contact-id-1.0.xsd +35 -0
- data/test/support/schemas/std-fork-1.0.xsd +31 -0
- data/test/support/schemas/std-handshake-1.0.xsd +61 -0
- data/test/support/schemas/std-list-1.0.xsd +55 -0
- data/test/support/schemas/std-locks-1.0.xsd +53 -0
- data/test/support/schemas/std-notifications-1.2.xsd +197 -0
- data/test/support/schemas/std-release-1.0.xsd +39 -0
- data/test/support/schemas/std-unrenew-1.0.xsd +26 -0
- data/test/support/schemas/std-warning-1.1.xsd +145 -0
- data/test/test_nominet-epp.rb +3 -3
- metadata +324 -104
- data/History.rdoc +0 -78
- data/README.rdoc +0 -23
- data/VERSION +0 -1
- data/lib/nominet-epp/operations/check.rb +0 -39
- data/lib/nominet-epp/operations/create.rb +0 -138
- data/lib/nominet-epp/operations/delete.rb +0 -20
- data/lib/nominet-epp/operations/fork.rb +0 -53
- data/lib/nominet-epp/operations/hello.rb +0 -11
- data/lib/nominet-epp/operations/info.rb +0 -93
- data/lib/nominet-epp/operations/list.rb +0 -83
- data/lib/nominet-epp/operations/lock.rb +0 -56
- data/lib/nominet-epp/operations/merge.rb +0 -41
- data/lib/nominet-epp/operations/poll.rb +0 -64
- data/lib/nominet-epp/operations/renew.rb +0 -40
- data/lib/nominet-epp/operations/transfer.rb +0 -84
- data/lib/nominet-epp/operations/unlock.rb +0 -56
- data/lib/nominet-epp/operations/unrenew.rb +0 -36
- data/lib/nominet-epp/operations/update.rb +0 -176
data/lib/nominet-epp.rb
CHANGED
@@ -1,172 +1,71 @@
|
|
1
1
|
require 'epp-client'
|
2
2
|
require 'time'
|
3
3
|
|
4
|
+
require File.dirname(__FILE__) + '/nominet-epp/version'
|
4
5
|
require File.dirname(__FILE__) + '/nominet-epp/operations'
|
5
6
|
require File.dirname(__FILE__) + '/nominet-epp/helpers'
|
6
7
|
|
8
|
+
require File.dirname(__FILE__) + '/nominet-epp/client'
|
9
|
+
require File.dirname(__FILE__) + '/nominet-epp/request'
|
10
|
+
require File.dirname(__FILE__) + '/nominet-epp/notification'
|
11
|
+
|
12
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/custom/list'
|
13
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/custom/handshake'
|
14
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/custom/tag_list'
|
15
|
+
|
16
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/check'
|
17
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/create'
|
18
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/delete'
|
19
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/info'
|
20
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/release'
|
21
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/renew'
|
22
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/unrenew'
|
23
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/update'
|
24
|
+
|
25
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/check'
|
26
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/create'
|
27
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/delete'
|
28
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/info'
|
29
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/release'
|
30
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/contact/update'
|
31
|
+
|
32
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/host/check'
|
33
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/host/create'
|
34
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/host/delete'
|
35
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/host/info'
|
36
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/host/update'
|
37
|
+
|
38
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/response'
|
39
|
+
|
40
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/custom/list_response'
|
41
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/custom/handshake_response'
|
42
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/custom/tag_list_response'
|
43
|
+
|
44
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/check_response'
|
45
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/create_response'
|
46
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/delete_response'
|
47
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/info_response'
|
48
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/release_response'
|
49
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/renew_response'
|
50
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/unrenew_response'
|
51
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/domain/update_response'
|
52
|
+
|
53
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/check_response'
|
54
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/create_response'
|
55
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/delete_response'
|
56
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/info_response'
|
57
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/release_response'
|
58
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/contact/update_response'
|
59
|
+
|
60
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/host/check_response'
|
61
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/host/create_response'
|
62
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/host/delete_response'
|
63
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/host/info_response'
|
64
|
+
require File.dirname(__FILE__) + '/nominet-epp/responses/host/update_response'
|
65
|
+
|
7
66
|
# Nominet EPP Module
|
8
67
|
module NominetEPP
|
9
|
-
# Front end interface Client to the NominetEPP Service
|
10
|
-
class Client
|
11
|
-
# Default Nominet Service URNs
|
12
|
-
DEFAULT_SERVICES = %w(http://www.nominet.org.uk/epp/xml/nom-domain-2.0
|
13
|
-
http://www.nominet.org.uk/epp/xml/nom-notifications-2.0
|
14
|
-
urn:ietf:params:xml:ns:host-1.0)
|
15
|
-
|
16
|
-
# Create a new instance of NominetEPP::Client
|
17
|
-
#
|
18
|
-
# @param [String] tag Nominet TAG
|
19
|
-
# @param [String] passwd Nominet TAG EPP Password
|
20
|
-
# @param [String] server Nominet EPP Server address
|
21
|
-
def initialize(tag, passwd, server = 'epp.nominet.org.uk')
|
22
|
-
@tag, @server = tag, server
|
23
|
-
@client = EPP::Client.new(tag, passwd, server, :services => DEFAULT_SERVICES)
|
24
|
-
end
|
25
|
-
|
26
|
-
# @see Object#inspect
|
27
|
-
def inspect
|
28
|
-
"#<#{self.class} #{@tag}@#{@server}>"
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns the last EPP::Response received
|
32
|
-
#
|
33
|
-
# @return [EPP::Response] last received response
|
34
|
-
def last_response
|
35
|
-
@resp
|
36
|
-
end
|
37
|
-
|
38
|
-
# Returns the last EPP message received
|
39
|
-
#
|
40
|
-
# @return [String] last EPP message
|
41
|
-
# @see #last_response
|
42
|
-
def last_message
|
43
|
-
last_response.message
|
44
|
-
end
|
45
|
-
|
46
|
-
# Returns the last Nominet failData response found
|
47
|
-
#
|
48
|
-
# @note This is presently only set by certain method calls,
|
49
|
-
# so it may not always be present.
|
50
|
-
# @return [Hash] last failData found
|
51
|
-
def last_error_info
|
52
|
-
@error_info
|
53
|
-
end
|
54
|
-
|
55
|
-
# @return [Hash] Nominet Namespaces by prefixes
|
56
|
-
def namespaces
|
57
|
-
{ :domain => 'http://www.nominet.org.uk/epp/xml/nom-domain-2.0',
|
58
|
-
:account => 'http://www.nominet.org.uk/epp/xml/nom-account-2.0',
|
59
|
-
:contact => 'http://www.nominet.org.uk/epp/xml/nom-contact-2.0',
|
60
|
-
:tag => 'http://www.nominet.org.uk/epp/xml/nom-tag-1.0',
|
61
|
-
:n => 'http://www.nominet.org.uk/epp/xml/nom-notifications-2.0',
|
62
|
-
:host => 'urn:ietf:params:xml:ns:host-1.0' }
|
63
|
-
end
|
64
|
-
|
65
|
-
# @return [Hash] Nominet Schema Locations by prefix
|
66
|
-
def schemaLocations
|
67
|
-
{ :domain => 'http://www.nominet.org.uk/epp/xml/nom-domain-2.0 nom-domain-2.0.xsd',
|
68
|
-
:account => 'http://www.nominet.org.uk/epp/xml/nom-account-2.0 nom-account-2.0.xsd',
|
69
|
-
:contact => 'http://www.nominet.org.uk/epp/xml/nom-contact-2.0 nom-contact-1.0.xsd',
|
70
|
-
:tag => 'http://www.nominet.org.uk/epp/xml/nom-tag-1.0 nom-tag-1.0.xsd',
|
71
|
-
:n => 'http://www.nominet.org.uk/epp/xml/nom-notifications-2.0 nom-notifications-2.0.xsd' }
|
72
|
-
end
|
73
|
-
|
74
|
-
include Helpers
|
75
|
-
|
76
|
-
include Operations::Check
|
77
|
-
include Operations::Create
|
78
|
-
include Operations::Delete
|
79
|
-
include Operations::Fork
|
80
|
-
include Operations::Hello
|
81
|
-
include Operations::Info
|
82
|
-
include Operations::List
|
83
|
-
include Operations::Lock
|
84
|
-
include Operations::Merge
|
85
|
-
include Operations::Poll
|
86
|
-
include Operations::Renew
|
87
|
-
include Operations::Transfer
|
88
|
-
include Operations::Unlock
|
89
|
-
include Operations::Unrenew
|
90
|
-
include Operations::Update
|
91
|
-
|
92
|
-
private
|
93
|
-
# @param [XML::Node] node XML Node to find the value from
|
94
|
-
# @param [String] xpath XPath Expression for the value
|
95
|
-
# @return [String] node value
|
96
|
-
def node_value(node, xpath)
|
97
|
-
n = node.find(xpath, namespaces).first
|
98
|
-
n && n.content.strip
|
99
|
-
end
|
100
|
-
|
101
|
-
# @param [String] name XML Element name
|
102
|
-
# @param [Symbol] ns_prefix Namespace Prefix
|
103
|
-
# @yield [node, ns] block to populate node
|
104
|
-
# @yieldparam [XML::Node] node XML Node to populate
|
105
|
-
# @yieldparam [XML::Namespace] ns XML Namespace of the node
|
106
|
-
# @return [XML::Node] newly created node
|
107
|
-
def new_node(name, ns_prefix, &block)
|
108
|
-
node = XML::Node.new(name)
|
109
|
-
node.namespaces.namespace = ns = XML::Namespace.new(node, ns_prefix.to_s, namespaces[ns_prefix])
|
110
|
-
node['xsi:schemaLocation'] = schemaLocations[ns_prefix] if schemaLocations.has_key?(ns_prefix)
|
111
|
-
|
112
|
-
case block.arity
|
113
|
-
when 0
|
114
|
-
yield
|
115
|
-
when 1
|
116
|
-
yield node
|
117
|
-
when 2
|
118
|
-
yield node, ns
|
119
|
-
end
|
120
|
-
|
121
|
-
node
|
122
|
-
end
|
123
|
-
|
124
|
-
# @param [String] node_name XML Element name
|
125
|
-
# @yield [node, ns] block to populate node
|
126
|
-
# @return [XML::Node] new node in :domain namespace
|
127
|
-
# @see new_node
|
128
|
-
def domain(node_name, &block)
|
129
|
-
new_node(node_name, :domain, &block)
|
130
|
-
end
|
131
|
-
|
132
|
-
# @param [String] node_name XML Element name
|
133
|
-
# @yield [node, ns] block to populate node
|
134
|
-
# @return [XML::Node] new node in :account namespace
|
135
|
-
# @see new_node
|
136
|
-
def account(node_name, &block)
|
137
|
-
new_node(node_name, :account, &block)
|
138
|
-
end
|
139
|
-
|
140
|
-
# @param [String] node_name XML Element name
|
141
|
-
# @yield [node, ns] block to populate node
|
142
|
-
# @return [XML::Node] new node in :contact namespace
|
143
|
-
# @see new_node
|
144
|
-
def contact(node_name, &block)
|
145
|
-
new_node(node_name, :contact, &block)
|
146
|
-
end
|
147
|
-
|
148
|
-
# @param [String] node_name XML Element name
|
149
|
-
# @yield [node, ns] block to populate node
|
150
|
-
# @return [XML::Node] new node in :tag namespace
|
151
|
-
# @see new_node
|
152
|
-
def tag(node_name, &block)
|
153
|
-
new_node(node_name, :tag, &block)
|
154
|
-
end
|
155
68
|
|
156
|
-
|
157
|
-
# @yield [node, ns] block to populate node
|
158
|
-
# @return [XML::Node] new node in :notification namespace
|
159
|
-
# @see new_node
|
160
|
-
def notification(node_name, &block)
|
161
|
-
new_node(node_name, :n, &block)
|
162
|
-
end
|
69
|
+
autoload :LogSubscriber, File.expand_path('../nominet-epp/log_subscriber.rb', __FILE__)
|
163
70
|
|
164
|
-
# @param [String] node_name XML Element name
|
165
|
-
# @yield [node, ns] block to populate node
|
166
|
-
# @return [XML::Node] new node in :host namespace
|
167
|
-
# @see new_node
|
168
|
-
def host(node_name, &block)
|
169
|
-
new_node(node_name, :host, &block)
|
170
|
-
end
|
171
|
-
end
|
172
71
|
end
|
data/nominet-epp.gemspec
CHANGED
@@ -1,71 +1,21 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/nominet-epp/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Geoff Garside"]
|
6
|
+
gem.email = ["geoff@geoffgarside.co.uk"]
|
7
|
+
gem.description = %q{Client for communicating with the Nominet EPP}
|
8
|
+
gem.summary = %q{Nominet EPP (Extensible Provisioning Protocol) Client}
|
9
|
+
gem.homepage = "https://github.com/m247/nominet-epp"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".yardopts",
|
21
|
-
"History.rdoc",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/nominet-epp.rb",
|
27
|
-
"lib/nominet-epp/helpers.rb",
|
28
|
-
"lib/nominet-epp/operations.rb",
|
29
|
-
"lib/nominet-epp/operations/check.rb",
|
30
|
-
"lib/nominet-epp/operations/create.rb",
|
31
|
-
"lib/nominet-epp/operations/delete.rb",
|
32
|
-
"lib/nominet-epp/operations/fork.rb",
|
33
|
-
"lib/nominet-epp/operations/hello.rb",
|
34
|
-
"lib/nominet-epp/operations/info.rb",
|
35
|
-
"lib/nominet-epp/operations/list.rb",
|
36
|
-
"lib/nominet-epp/operations/lock.rb",
|
37
|
-
"lib/nominet-epp/operations/merge.rb",
|
38
|
-
"lib/nominet-epp/operations/poll.rb",
|
39
|
-
"lib/nominet-epp/operations/renew.rb",
|
40
|
-
"lib/nominet-epp/operations/transfer.rb",
|
41
|
-
"lib/nominet-epp/operations/unlock.rb",
|
42
|
-
"lib/nominet-epp/operations/unrenew.rb",
|
43
|
-
"lib/nominet-epp/operations/update.rb",
|
44
|
-
"nominet-epp.gemspec",
|
45
|
-
"test/helper.rb",
|
46
|
-
"test/test_nominet-epp.rb"
|
47
|
-
]
|
48
|
-
s.homepage = %q{http://github.com/geoffgarside/nominet-epp}
|
49
|
-
s.require_paths = ["lib"]
|
50
|
-
s.rubygems_version = %q{1.7.2}
|
51
|
-
s.summary = %q{Nominet EPP (Extensible Provisioning Protocol) Client}
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "nominet-epp"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = NominetEPP::VERSION
|
52
17
|
|
53
|
-
|
54
|
-
s.specification_version = 3
|
18
|
+
gem.extra_rdoc_files = %w(LICENSE README.md HISTORY.md)
|
55
19
|
|
56
|
-
|
57
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
58
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
59
|
-
s.add_runtime_dependency(%q<epp-client>, [">= 0"])
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
62
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
63
|
-
s.add_dependency(%q<epp-client>, [">= 0"])
|
64
|
-
end
|
65
|
-
else
|
66
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
67
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
68
|
-
s.add_dependency(%q<epp-client>, [">= 0"])
|
69
|
-
end
|
20
|
+
gem.add_dependency 'epp-client', '~> 1.0.0'
|
70
21
|
end
|
71
|
-
|
data/test/helper.rb
CHANGED
@@ -5,6 +5,63 @@ require 'shoulda'
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
7
|
require 'nominet-epp'
|
8
|
+
require 'epp-client/testing'
|
9
|
+
|
10
|
+
module NominetEPP
|
11
|
+
class Client
|
12
|
+
def prepare_request(type, request, extension = nil)
|
13
|
+
@client.__send__(:"#{type}_prepare", request, extension)
|
14
|
+
end
|
15
|
+
def load_response(xml)
|
16
|
+
@client.__send__(:load_response, xml)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
8
20
|
|
9
21
|
class Test::Unit::TestCase
|
22
|
+
def load_xml(name)
|
23
|
+
xml_path = File.expand_path("../support/responses/#{name}.xml", __FILE__)
|
24
|
+
File.read(xml_path)
|
25
|
+
end
|
26
|
+
def load_response(name)
|
27
|
+
xml = load_xml(name)
|
28
|
+
test_client.load_response(xml)
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_schema(name)
|
32
|
+
xsd_path = File.expand_path("../support/schemas/#{name}.xsd", __FILE__)
|
33
|
+
xsd_doc = XML::Document.file(xsd_path)
|
34
|
+
XML::Schema.document(xsd_doc)
|
35
|
+
end
|
36
|
+
def schema
|
37
|
+
@schema ||= load_schema('nom-root-std-1.0.7')
|
38
|
+
end
|
39
|
+
def xpath_find(query)
|
40
|
+
n = @xml.find(query, @namespaces).first
|
41
|
+
case n
|
42
|
+
when XML::Node
|
43
|
+
n.content.strip
|
44
|
+
when XML::Attr
|
45
|
+
n.value.strip
|
46
|
+
end
|
47
|
+
end
|
48
|
+
def xpath_each(query)
|
49
|
+
@xml.find(query, @namespaces).each do |node|
|
50
|
+
yield node
|
51
|
+
end
|
52
|
+
end
|
53
|
+
def xpath_exists?(query)
|
54
|
+
!@xml.find(query, @namespaces).empty?
|
55
|
+
end
|
56
|
+
def namespaces_from_request(request = @request)
|
57
|
+
@namespaces = Hash[*request.namespaces.map { |k,ns| [k, ns.href] }.flatten]
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_client
|
61
|
+
@test_client ||= NominetEPP::Client.new('TEST', 'testing')
|
62
|
+
end
|
63
|
+
|
64
|
+
def prepare_request(name = @request.command_name, request = @request)
|
65
|
+
test_client.prepare_request(name, request.command, request.extension)
|
66
|
+
end
|
10
67
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetContactDeletedNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::ContactDeleted' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/contact-deleted'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :contact_deleted, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have contact id' do
|
17
|
+
assert_equal 'EPPID0003', subject.id
|
18
|
+
end
|
19
|
+
should 'have roid' do
|
20
|
+
assert_equal '1002703-UK', subject.roid
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetDomainCancelledNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::DomainCancelled' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/domain-cancelled'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :domain_cancelled, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have domain name' do
|
17
|
+
assert_equal 'epp-example1.co.uk', subject.name
|
18
|
+
end
|
19
|
+
should 'have originator' do
|
20
|
+
assert_equal 'example@nominet', subject.originator
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetDomainsReleasedNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::DomainsReleased' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/domains-released'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :domains_released, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have account ID' do
|
17
|
+
assert_equal '12345', subject.account_id
|
18
|
+
end
|
19
|
+
should 'flag account ID as moved' do
|
20
|
+
assert_equal true, subject.account_moved?
|
21
|
+
end
|
22
|
+
should 'have EXAMPLE1-TAG as sender' do
|
23
|
+
assert_equal 'EXAMPLE1-TAG', subject.from
|
24
|
+
end
|
25
|
+
should 'have EXAMPLE2-TAG as receiver' do
|
26
|
+
assert_equal 'EXAMPLE2-TAG', subject.registrar_tag
|
27
|
+
end
|
28
|
+
should 'have domains' do
|
29
|
+
expected = %w(epp-example1.co.uk epp-example2.co.uk epp-example3.co.uk
|
30
|
+
epp-example4.co.uk epp-example5.co.uk epp-example6.co.uk)
|
31
|
+
assert_equal expected, subject.domains
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetDomainsSuspendedNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::DomainsSuspended' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/domains-suspended'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :domains_suspended, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have reason' do
|
17
|
+
assert_equal 'Data Quality', subject.reason
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'have cancellation date' do
|
21
|
+
expected = Time.gm(2009,12,12,0,0,13)
|
22
|
+
assert_equal expected, subject.cancellation_date
|
23
|
+
end
|
24
|
+
|
25
|
+
should 'have domains' do
|
26
|
+
expected = %w(epp-example1.co.uk epp-example2.co.uk)
|
27
|
+
assert_equal expected, subject.domains
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetHandshakeRejectedNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::HandshakeRejected' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/handshake-rejected'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :handshake_rejected, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have account ID' do
|
17
|
+
assert_equal '1243654', subject.account_id
|
18
|
+
end
|
19
|
+
should 'flag account ID as moved' do
|
20
|
+
assert_equal false, subject.account_moved?
|
21
|
+
end
|
22
|
+
should 'have EXAMPLE1-TAG as sender' do
|
23
|
+
assert_equal 'EXAMPLE1-TAG', subject.from
|
24
|
+
end
|
25
|
+
should 'have EXAMPLE2-TAG as receiver' do
|
26
|
+
assert_equal 'EXAMPLE2-TAG', subject.registrar_tag
|
27
|
+
end
|
28
|
+
should 'have domains' do
|
29
|
+
expected = %w(epp-example1.co.uk epp-example2.co.uk epp-example3.co.uk
|
30
|
+
epp-example4.co.uk epp-example5.co.uk epp-example6.co.uk)
|
31
|
+
assert_equal expected, subject.domains
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetRegistrantTransferNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::RegistrantTransfer' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/registrant-transfer'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :registrant_transfer, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have originator' do
|
17
|
+
assert_equal 'p@automaton-example.org.uk', subject.originator
|
18
|
+
end
|
19
|
+
should 'have account Id' do
|
20
|
+
assert_equal '58658458', subject.account_id
|
21
|
+
end
|
22
|
+
should 'have old account Id' do
|
23
|
+
assert_equal '596859', subject.old_account_id
|
24
|
+
end
|
25
|
+
should 'have domains' do
|
26
|
+
expected = %w(epp-example1.co.uk epp-example2.co.uk)
|
27
|
+
assert_equal expected, subject.domains
|
28
|
+
end
|
29
|
+
should 'have contact type' do
|
30
|
+
assert_equal 'IND', subject.contact.type
|
31
|
+
end
|
32
|
+
should 'have contact id' do
|
33
|
+
assert_equal 'ST68956589R4', subject.contact.id
|
34
|
+
end
|
35
|
+
should 'have contact roid' do
|
36
|
+
assert_equal '123456-UK', subject.contact.roid
|
37
|
+
end
|
38
|
+
should 'have contact postal info' do
|
39
|
+
expected = { :name => "Mr R. Strant",
|
40
|
+
:addr => {
|
41
|
+
:street => "2102 High Street",
|
42
|
+
:city => "Oxford",
|
43
|
+
:sp => "Oxon",
|
44
|
+
:pc => "OX1 1QQ",
|
45
|
+
:cc => "GB" }}
|
46
|
+
assert_equal expected, subject.contact.postal_info
|
47
|
+
end
|
48
|
+
should 'have contact email' do
|
49
|
+
assert_equal 'example@epp-example1.co.uk', subject.contact.email
|
50
|
+
end
|
51
|
+
should 'have nil voice' do
|
52
|
+
assert_equal nil, subject.contact.voice
|
53
|
+
end
|
54
|
+
should 'have nil fax' do
|
55
|
+
assert_equal nil, subject.contact.fax
|
56
|
+
end
|
57
|
+
should 'have opt out' do
|
58
|
+
assert_equal true, subject.contact.opt_out
|
59
|
+
end
|
60
|
+
should 'have contact client id' do
|
61
|
+
assert_equal 'TEST', subject.contact.client_id
|
62
|
+
end
|
63
|
+
should 'have contact creator id' do
|
64
|
+
assert_equal 'TEST', subject.contact.creator_id
|
65
|
+
end
|
66
|
+
should 'have contact created date' do
|
67
|
+
expected = Time.gm(1999,4,3,22,0,0)
|
68
|
+
assert_equal expected, subject.contact.created_date
|
69
|
+
end
|
70
|
+
should 'have contact updator id' do
|
71
|
+
assert_equal 'domains@isp.com', subject.contact.updator_id
|
72
|
+
end
|
73
|
+
should 'have contact updated date' do
|
74
|
+
expected = Time.gm(1999,12,3,9,0,0)
|
75
|
+
assert_equal expected, subject.contact.updated_date
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|