nominet-epp 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/nominet-epp.rb +1 -1
- data/lib/nominet-epp/client.rb +13 -9
- data/lib/nominet-epp/notification.rb +5 -0
- data/lib/nominet-epp/requests/domain/check.rb +2 -1
- data/lib/nominet-epp/requests/domain/create.rb +2 -0
- data/lib/nominet-epp/requests/domain/renew.rb +1 -0
- data/lib/nominet-epp/requests/domain/request.rb +14 -0
- data/lib/nominet-epp/responses/domain/check_response.rb +1 -0
- data/lib/nominet-epp/version.rb +1 -1
- data/nominet-epp.gemspec +1 -1
- data/test/notifications/test_account_change_notification.rb +23 -0
- data/test/requests/contact/test_contact_create_request.rb +52 -0
- data/test/requests/contact/test_contact_update_request.rb +59 -0
- data/test/requests/domain/test_domain_create_request.rb +53 -0
- data/test/requests/domain/test_domain_renew_request.rb +40 -6
- data/test/responses/contact/test_contact_info_response.rb +22 -0
- data/test/responses/domain/test_domain_check_response.rb +4 -0
- data/test/support/responses/contact/info-streets.xml +47 -0
- data/test/support/responses/domain/check.xml +3 -0
- data/test/support/responses/notifications/account-change.xml +6 -0
- metadata +9 -5
- data/lib/nominet-epp/helpers.rb +0 -184
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 300941743173cdc312f08bec2768411870fae78c
|
4
|
+
data.tar.gz: 395332be613671a74c0cd4cc8a8c1107be838e63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d246a794a3e732fcc7f4133986d0a4afe041338913531feb8b533489be2cfe40e2762cf9cea5a8c2ef623e15614edae5d765eed6e2e9134ef75a6515b9c8c17f
|
7
|
+
data.tar.gz: b13cb52ba650884feec239b41f75db1158911798b3541944afc566c7ce15faa5dbf4078dd7b3f8cfd0908ebdfe8c5b99256ec01154c4075c1f11ce62cf37a843
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/m247/epp-client.git
|
3
|
-
revision:
|
3
|
+
revision: 0fe39d1765c28f728f3a63adad6eb7de49c0f049
|
4
4
|
specs:
|
5
|
-
epp-client (1.0
|
5
|
+
epp-client (2.1.0)
|
6
6
|
libxml-ruby
|
7
7
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
nominet-epp (
|
12
|
-
epp-client (~> 1.0
|
11
|
+
nominet-epp (2.0.0)
|
12
|
+
epp-client (~> 2.1.0)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
data/lib/nominet-epp.rb
CHANGED
@@ -3,7 +3,6 @@ require 'time'
|
|
3
3
|
|
4
4
|
require File.dirname(__FILE__) + '/nominet-epp/version'
|
5
5
|
require File.dirname(__FILE__) + '/nominet-epp/operations'
|
6
|
-
require File.dirname(__FILE__) + '/nominet-epp/helpers'
|
7
6
|
|
8
7
|
require File.dirname(__FILE__) + '/nominet-epp/client'
|
9
8
|
require File.dirname(__FILE__) + '/nominet-epp/request'
|
@@ -13,6 +12,7 @@ require File.dirname(__FILE__) + '/nominet-epp/requests/custom/list'
|
|
13
12
|
require File.dirname(__FILE__) + '/nominet-epp/requests/custom/handshake'
|
14
13
|
require File.dirname(__FILE__) + '/nominet-epp/requests/custom/tag_list'
|
15
14
|
|
15
|
+
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/request'
|
16
16
|
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/check'
|
17
17
|
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/create'
|
18
18
|
require File.dirname(__FILE__) + '/nominet-epp/requests/domain/delete'
|
data/lib/nominet-epp/client.rb
CHANGED
@@ -22,13 +22,17 @@ module NominetEPP
|
|
22
22
|
# @param [String] tag Nominet TAG
|
23
23
|
# @param [String] passwd Nominet TAG EPP Password
|
24
24
|
# @param [String] server Nominet EPP Server address (nil forces default)
|
25
|
-
# @param [
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
25
|
+
# @param [Hash] options Options
|
26
|
+
# @option options [String] :address_family 'AF_INET' or 'AF_INET6' or either of the
|
27
|
+
# appropriate socket constants. Will cause connections to be
|
28
|
+
# limited to this address family. Default try all addresses.
|
29
|
+
# @option options [OpenSSL::SSL::SSLContext] :ssl_context For client certificate auth
|
30
|
+
def initialize(tag, passwd, server = 'epp.nominet.org.uk', options = {})
|
31
|
+
options = {:address_family => options} unless options.kind_of?(Hash) # maintain backwards compatibility with old method signature
|
32
|
+
options = options.merge(:services => SERVICE_URNS, :extensions => SERVICE_EXTENSION_URNS)
|
33
|
+
|
29
34
|
@tag, @server = tag, (server || 'epp.nominet.org.uk')
|
30
|
-
@client = EPP::Client.new(@tag, passwd, @server,
|
31
|
-
:extensions => SERVICE_EXTENSION_URNS, :address_family => address_family)
|
35
|
+
@client = EPP::Client.new(@tag, passwd, @server, options)
|
32
36
|
end
|
33
37
|
|
34
38
|
# @see Object#inspect
|
@@ -241,17 +245,17 @@ module NominetEPP
|
|
241
245
|
def create(entity, name, attributes = {})
|
242
246
|
res = new_create(entity, name, attributes)
|
243
247
|
|
244
|
-
if res.success?
|
248
|
+
if res.success? || res.pending?
|
245
249
|
case entity
|
246
250
|
when :domain, 'domain'
|
247
251
|
{ :name => res.name,
|
248
252
|
:crDate => res.creation_date,
|
249
253
|
:exDate => res.expiration_date }
|
250
254
|
when :contact, 'contact'
|
251
|
-
{ :name => res.
|
255
|
+
{ :name => res.name,
|
252
256
|
:crDate => res.creation_date }
|
253
257
|
when :host, 'host'
|
254
|
-
{ :name => res.
|
258
|
+
{ :name => res.name,
|
255
259
|
:crDate => res.creation_date }
|
256
260
|
end
|
257
261
|
else
|
@@ -3,10 +3,11 @@ module NominetEPP
|
|
3
3
|
class Check < Request
|
4
4
|
def initialize(*names)
|
5
5
|
rights = names.last.is_a?(Hash) ? names.pop : nil
|
6
|
+
names = names.compact # handle nil being passed for rights
|
6
7
|
|
7
8
|
@command = EPP::Domain::Check.new(*names)
|
8
9
|
|
9
|
-
if rights
|
10
|
+
if rights && !rights.empty?
|
10
11
|
raise ArgumentError, "cannot check direct rights on more than one name" if names.count > 1
|
11
12
|
@rights_ext = DirectRightsExtension.new(rights)
|
12
13
|
@extension = EPP::Requests::Extension.new(@rights_ext) rescue nil
|
@@ -15,6 +15,8 @@ module NominetEPP
|
|
15
15
|
@domain_ext = CreateExtension.new(@extensions) rescue nil
|
16
16
|
@secdns_ext = CreateSecDNSExtension.new(@options.delete(:ds)) rescue nil
|
17
17
|
|
18
|
+
validate_period(options[:period])
|
19
|
+
|
18
20
|
@command = EPP::Domain::Create.new(@name, @options)
|
19
21
|
@extension = EPP::Requests::Extension.new(@domain_ext, @secdns_ext) rescue nil
|
20
22
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module NominetEPP
|
2
|
+
module Domain
|
3
|
+
class Request < ::NominetEPP::Request
|
4
|
+
def validate_period(period)
|
5
|
+
unit = period[-1,1]
|
6
|
+
val = period.to_i
|
7
|
+
|
8
|
+
if unit == 'y' && val > 10
|
9
|
+
raise ArgumentError, "maximum period accepted by Nominet is 10 years"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -32,6 +32,7 @@ module NominetEPP
|
|
32
32
|
|
33
33
|
node.find('//nom-direct-rights:chkData', namespaces).each do |chkData|
|
34
34
|
@right_of_registration = chkData.find('nom-direct-rights:ror').first.content.strip
|
35
|
+
@right_of_registration = nil if @right_of_registration == ""
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
data/lib/nominet-epp/version.rb
CHANGED
data/nominet-epp.gemspec
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestNominetAccountChangeNotification < Test::Unit::TestCase
|
4
|
+
context 'NominetEPP::Notifications::AccountChange' do
|
5
|
+
setup do
|
6
|
+
@notification =
|
7
|
+
NominetEPP::Notification.new(
|
8
|
+
load_response('notifications/account-change'))
|
9
|
+
end
|
10
|
+
subject { @notification }
|
11
|
+
|
12
|
+
should 'have type' do
|
13
|
+
assert_equal :account_change, subject.type
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'have contact id' do
|
17
|
+
assert_equal 'CMyContactID', subject.id
|
18
|
+
end
|
19
|
+
should 'have roid' do
|
20
|
+
assert_equal '548965487-UK', subject.roid
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -53,6 +53,58 @@ class TestNominetContactCreateRequest < Test::Unit::TestCase
|
|
53
53
|
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
54
54
|
end
|
55
55
|
end
|
56
|
+
context 'multiple streets' do
|
57
|
+
setup do
|
58
|
+
@request = NominetEPP::Contact::Create.new('UK-4398495',
|
59
|
+
:voice => "+44.1234567890",
|
60
|
+
:email => "enoch.root@test.host",
|
61
|
+
:postal_info => {
|
62
|
+
:org => "Epiphyte",
|
63
|
+
:name => "Enoch Root",
|
64
|
+
:addr => {
|
65
|
+
:street => "Test Suite\n1 Test Avenue",
|
66
|
+
:city => "Testington",
|
67
|
+
:sp => "Testshire",
|
68
|
+
:pc => "TE57 1NG",
|
69
|
+
:cc => "GB" } })
|
70
|
+
@xml = prepare_request.to_xml
|
71
|
+
|
72
|
+
namespaces_from_request
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'validate against schema' do
|
76
|
+
assert @xml.validate_schema(schema)
|
77
|
+
end
|
78
|
+
|
79
|
+
should 'set id' do
|
80
|
+
assert_equal 'UK-4398495', xpath_find('//contact:id')
|
81
|
+
end
|
82
|
+
|
83
|
+
should 'set voice' do
|
84
|
+
assert_equal "+44.1234567890", xpath_find('//contact:voice')
|
85
|
+
end
|
86
|
+
should 'set email' do
|
87
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:email')
|
88
|
+
end
|
89
|
+
should 'set organisation' do
|
90
|
+
assert_equal "Epiphyte", xpath_find('//contact:postalInfo[@type="loc"]/contact:org')
|
91
|
+
end
|
92
|
+
should 'set name' do
|
93
|
+
assert_equal "Enoch Root", xpath_find('//contact:postalInfo[@type="loc"]/contact:name')
|
94
|
+
end
|
95
|
+
should 'set address' do
|
96
|
+
assert_equal "Test Suite", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:street[1]')
|
97
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:street[2]')
|
98
|
+
assert_equal "Testington", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
99
|
+
assert_equal "Testshire", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
100
|
+
assert_equal "TE57 1NG", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
101
|
+
assert_equal "GB", xpath_find('//contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
102
|
+
end
|
103
|
+
|
104
|
+
should 'not have extension element' do
|
105
|
+
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
106
|
+
end
|
107
|
+
end
|
56
108
|
context 'nominet extensions' do
|
57
109
|
setup do
|
58
110
|
@request = NominetEPP::Contact::Create.new('UK-4398495',
|
@@ -60,6 +60,65 @@ class TestNominetContactUpdateRequest < Test::Unit::TestCase
|
|
60
60
|
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
61
61
|
end
|
62
62
|
end
|
63
|
+
context 'multiple streets' do
|
64
|
+
setup do
|
65
|
+
@time = Time.now.utc
|
66
|
+
@request = NominetEPP::Contact::Update.new('sh8013',
|
67
|
+
:chg => {
|
68
|
+
:voice => "+44.1234567890",
|
69
|
+
:email => "enoch.root@test.host",
|
70
|
+
:postal_info => {
|
71
|
+
:org => "Epiphyte",
|
72
|
+
:name => "Enoch Root",
|
73
|
+
:addr => {
|
74
|
+
:street => "Test Suite\n1 Test Avenue",
|
75
|
+
:city => "Testington",
|
76
|
+
:sp => "Testshire",
|
77
|
+
:pc => "TE57 1NG",
|
78
|
+
:cc => "GB" }}})
|
79
|
+
@xml = prepare_request.to_xml
|
80
|
+
|
81
|
+
namespaces_from_request
|
82
|
+
end
|
83
|
+
|
84
|
+
should 'validate against schema' do
|
85
|
+
assert @xml.validate_schema(schema)
|
86
|
+
end
|
87
|
+
|
88
|
+
should 'have update element' do
|
89
|
+
assert xpath_exists?('//contact:update'), "should have update element"
|
90
|
+
end
|
91
|
+
|
92
|
+
should 'have name element' do
|
93
|
+
assert_equal 'sh8013', xpath_find('//contact:id')
|
94
|
+
end
|
95
|
+
|
96
|
+
should 'set voice for change' do
|
97
|
+
assert_equal "+44.1234567890", xpath_find('//contact:chg/contact:voice')
|
98
|
+
end
|
99
|
+
should 'set email for change' do
|
100
|
+
assert_equal "enoch.root@test.host", xpath_find('//contact:chg/contact:email')
|
101
|
+
end
|
102
|
+
should 'not set organisation for change' do
|
103
|
+
# assert_equal "Epiphyte", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:org')
|
104
|
+
assert !xpath_exists?('//contact:chg/contact:postalInfo[@type="loc"]/contact:org')
|
105
|
+
end
|
106
|
+
should 'set name for change' do
|
107
|
+
assert_equal "Enoch Root", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:name')
|
108
|
+
end
|
109
|
+
should 'set address for change' do
|
110
|
+
assert_equal "Test Suite", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:street[1]')
|
111
|
+
assert_equal "1 Test Avenue", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:street[2]')
|
112
|
+
assert_equal "Testington", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:city')
|
113
|
+
assert_equal "Testshire", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:sp')
|
114
|
+
assert_equal "TE57 1NG", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:pc')
|
115
|
+
assert_equal "GB", xpath_find('//contact:chg/contact:postalInfo[@type="loc"]/contact:addr/contact:cc')
|
116
|
+
end
|
117
|
+
|
118
|
+
should 'not have extension element' do
|
119
|
+
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
120
|
+
end
|
121
|
+
end
|
63
122
|
context 'nominet extensions' do
|
64
123
|
setup do
|
65
124
|
@time = Time.now.utc
|
@@ -132,5 +132,58 @@ class TestNominetDomainCreateRequest < Test::Unit::TestCase
|
|
132
132
|
assert xpath_exists?('//secDNS:create'), "should have DNSSEC extension element"
|
133
133
|
end
|
134
134
|
end
|
135
|
+
context 'period = 10y' do
|
136
|
+
setup do
|
137
|
+
@time = Time.now.utc
|
138
|
+
@request = NominetEPP::Domain::Create.new('example.co.uk',
|
139
|
+
:period => '10y', :registrant => 'UK-2349723',
|
140
|
+
:nameservers => %w(ns1.test.host ns2.test.host),
|
141
|
+
:auth_info => {:pw => '2381728348'})
|
142
|
+
@xml = prepare_request.to_xml
|
143
|
+
|
144
|
+
namespaces_from_request
|
145
|
+
end
|
146
|
+
|
147
|
+
should 'validate against schema' do
|
148
|
+
assert @xml.validate_schema(schema)
|
149
|
+
end
|
150
|
+
|
151
|
+
should 'have create element' do
|
152
|
+
assert xpath_exists?('//domain:create'), "should have create element"
|
153
|
+
end
|
154
|
+
|
155
|
+
should 'have name element' do
|
156
|
+
assert_equal 'example.co.uk', xpath_find('//domain:name')
|
157
|
+
end
|
158
|
+
|
159
|
+
should 'have period elemement of 10y' do
|
160
|
+
assert_equal '10', xpath_find('//domain:period')
|
161
|
+
assert_equal 'y', xpath_find('//domain:period/@unit')
|
162
|
+
end
|
163
|
+
|
164
|
+
should 'not have extension element' do
|
165
|
+
assert !xpath_exists?('//epp:extension'), "should not have extension element"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
context 'period = 120m' do
|
169
|
+
should 'raise argument error' do
|
170
|
+
assert_raises ArgumentError do
|
171
|
+
NominetEPP::Domain::Create.new('example.co.uk',
|
172
|
+
:period => '120m', :registrant => 'UK-2349723',
|
173
|
+
:nameservers => %w(ns1.test.host ns2.test.host),
|
174
|
+
:auth_info => {:pw => '2381728348'})
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
context 'period = 11y' do
|
179
|
+
should 'raise argument error' do
|
180
|
+
assert_raises ArgumentError do
|
181
|
+
NominetEPP::Domain::Create.new('example.co.uk',
|
182
|
+
:period => '11y', :registrant => 'UK-2349723',
|
183
|
+
:nameservers => %w(ns1.test.host ns2.test.host),
|
184
|
+
:auth_info => {:pw => '2381728348'})
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
135
188
|
end
|
136
189
|
end
|
@@ -2,14 +2,48 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class TestNominetDomainRenewRequest < Test::Unit::TestCase
|
4
4
|
context 'NominetEPP::Domain::Renew' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
context 'normal renewal' do
|
6
|
+
setup do
|
7
|
+
@time = Time.now.utc
|
8
|
+
@request = NominetEPP::Domain::Renew.new('example.co.uk', @time, '2y')
|
9
|
+
@xml = prepare_request.to_xml
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'validate against schema' do
|
13
|
+
assert @xml.validate_schema(schema)
|
14
|
+
end
|
9
15
|
end
|
16
|
+
context 'period = 10y' do
|
17
|
+
setup do
|
18
|
+
@time = Time.now.utc
|
19
|
+
@request = NominetEPP::Domain::Renew.new('example.co.uk', @time, '10y')
|
20
|
+
@xml = prepare_request.to_xml
|
21
|
+
|
22
|
+
namespaces_from_request
|
23
|
+
end
|
10
24
|
|
11
|
-
|
12
|
-
|
25
|
+
should 'validate against schema' do
|
26
|
+
assert @xml.validate_schema(schema)
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'have period elemement of 10y' do
|
30
|
+
assert_equal '10', xpath_find('//domain:period')
|
31
|
+
assert_equal 'y', xpath_find('//domain:period/@unit')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
context 'period = 120m' do
|
35
|
+
should 'raise ArgumentError' do
|
36
|
+
assert_raises ArgumentError do
|
37
|
+
NominetEPP::Domain::Renew.new('example.co.uk', Time.now, '120m')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
context 'period = 11y' do
|
42
|
+
should 'raise argument error' do
|
43
|
+
assert_raises ArgumentError do
|
44
|
+
NominetEPP::Domain::Renew.new('example.co.uk', Time.now, '11y')
|
45
|
+
end
|
46
|
+
end
|
13
47
|
end
|
14
48
|
end
|
15
49
|
end
|
@@ -76,4 +76,26 @@ class TestNominetContactInfoResponse < Test::Unit::TestCase
|
|
76
76
|
assert_equal false, @info_response.opt_out
|
77
77
|
end
|
78
78
|
end
|
79
|
+
context 'NominetEPP::Contact::Info' do
|
80
|
+
setup do
|
81
|
+
@info_response = NominetEPP::Contact::InfoResponse.new(load_response('contact/info-streets'))
|
82
|
+
end
|
83
|
+
|
84
|
+
should 'be successful' do
|
85
|
+
assert @info_response.success?
|
86
|
+
assert_equal 1000, @info_response.code
|
87
|
+
end
|
88
|
+
|
89
|
+
should 'have postal info' do
|
90
|
+
expected = { :name => "Mary Smith",
|
91
|
+
:org => "Simple Registrant-TESTING",
|
92
|
+
:addr => {
|
93
|
+
:street => "Test Suite\n2 Test Street",
|
94
|
+
:city => "Test City",
|
95
|
+
:sp => "Testshire",
|
96
|
+
:pc => "TE57 1NG",
|
97
|
+
:cc => "GB" }}
|
98
|
+
assert_equal expected, @info_response.postal_info
|
99
|
+
end
|
100
|
+
end
|
79
101
|
end
|
@@ -28,6 +28,10 @@ class TestNominetDomainCheckResponse < Test::Unit::TestCase
|
|
28
28
|
should 'have an abuse limit' do
|
29
29
|
assert_equal 49997, @check_response.abuse_limit
|
30
30
|
end
|
31
|
+
|
32
|
+
should 'have nil right of registration' do
|
33
|
+
assert_nil @check_response.right_of_registration
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
context 'NominetEPP::Domain::Check with Domain Rights' do
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/epp-1.0 epp-1.0.xsd">
|
3
|
+
<response>
|
4
|
+
<result code="1000">
|
5
|
+
<msg>Command completed successfully</msg>
|
6
|
+
</result>
|
7
|
+
<resData>
|
8
|
+
<contact:infData xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd">
|
9
|
+
<contact:id>EAXXMK1FW0YZTABD</contact:id>
|
10
|
+
<contact:roid>50643904-UK</contact:roid>
|
11
|
+
<contact:status s="ok"/>
|
12
|
+
<contact:postalInfo type="loc">
|
13
|
+
<contact:name>Mary Smith</contact:name>
|
14
|
+
<contact:org>Simple Registrant-TESTING</contact:org>
|
15
|
+
<contact:addr>
|
16
|
+
<contact:street>Test Suite</contact:street>
|
17
|
+
<contact:street>2 Test Street</contact:street>
|
18
|
+
<contact:city>Test City</contact:city>
|
19
|
+
<contact:sp>Testshire</contact:sp>
|
20
|
+
<contact:pc>TE57 1NG</contact:pc>
|
21
|
+
<contact:cc>GB</contact:cc>
|
22
|
+
</contact:addr>
|
23
|
+
</contact:postalInfo>
|
24
|
+
<contact:voice>+44.1234567890</contact:voice>
|
25
|
+
<contact:email>mary.smith@ariel-testing.co.uk</contact:email>
|
26
|
+
<contact:clID>TESTING</contact:clID>
|
27
|
+
<contact:crID>psamathe@nominet</contact:crID>
|
28
|
+
<contact:crDate>2013-09-13T00:09:32</contact:crDate>
|
29
|
+
</contact:infData>
|
30
|
+
</resData>
|
31
|
+
<extension>
|
32
|
+
<contact-nom-ext:infData xmlns:contact-nom-ext="http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0 contact-nom-ext-1.0.xsd">
|
33
|
+
<contact-nom-ext:trad-name>Simple Registrant Trading Ltd</contact-nom-ext:trad-name>
|
34
|
+
<contact-nom-ext:type>LTD</contact-nom-ext:type>
|
35
|
+
<contact-nom-ext:co-no>12345678</contact-nom-ext:co-no>
|
36
|
+
<contact-nom-ext:opt-out>N</contact-nom-ext:opt-out>
|
37
|
+
</contact-nom-ext:infData>
|
38
|
+
<warning:truncated-field xmlns:warning="http://www.nominet.org.uk/epp/xml/std-warning-1.1" field-name="contact:crID" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/std-warning-1.1 std-warning-1.1.xsd">
|
39
|
+
Full entry is 'psamathe@nominet.org.uk'.
|
40
|
+
</warning:truncated-field>
|
41
|
+
</extension>
|
42
|
+
<trID>
|
43
|
+
<clTRID>TESTING-000008</clTRID>
|
44
|
+
<svTRID>231790</svTRID>
|
45
|
+
</trID>
|
46
|
+
</response>
|
47
|
+
</epp>
|
@@ -16,6 +16,9 @@
|
|
16
16
|
</resData>
|
17
17
|
<extension>
|
18
18
|
<domain-nom-ext:chkData xmlns:domain-nom-ext="http://www.nominet.org.uk/epp/xml/domain-nom-ext-1.2" abuse-limit="49997" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/domain-nom-ext-1.2 domain-nom-ext-1.2.xsd"/>
|
19
|
+
<nom-direct-rights:chkData xmlns:nom-direct-rights="http://www.nominet.org.uk/epp/xml/nom-direct-rights-1.0" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/nom-direct-rights-1.0 nom-direct-rights-1.0.xsd">
|
20
|
+
<nom-direct-rights:ror/>
|
21
|
+
</nom-direct-rights:chkData>
|
19
22
|
</extension>
|
20
23
|
<trID>
|
21
24
|
<clTRID>NOMINETEPP-000004</clTRID>
|
@@ -31,6 +31,12 @@
|
|
31
31
|
<contact:upDate>2008-06-12T06:46:00Z</contact:upDate>
|
32
32
|
</contact:infData>
|
33
33
|
</resData>
|
34
|
+
<extension>
|
35
|
+
<contact-nom-ext:infData xmlns:contact-nom-ext="http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0" xsi:schemaLocation="http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0 contact-nom-ext-1.0.xsd">
|
36
|
+
<contact-nom-ext:type>IND</contact-nom-ext:type>
|
37
|
+
<contact-nom-ext:opt-out>N</contact-nom-ext:opt-out>
|
38
|
+
</contact-nom-ext:infData>
|
39
|
+
</extension>
|
34
40
|
<trID>
|
35
41
|
<clTRID>ABC-12345</clTRID>
|
36
42
|
<svTRID>123456</svTRID>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nominet-epp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Garside
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: epp-client
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: 2.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: 2.1.0
|
27
27
|
description: Client for communicating with the Nominet EPP
|
28
28
|
email:
|
29
29
|
- geoff@geoffgarside.co.uk
|
@@ -46,7 +46,6 @@ files:
|
|
46
46
|
- gemfiles/Gemfile.ruby18
|
47
47
|
- lib/nominet-epp.rb
|
48
48
|
- lib/nominet-epp/client.rb
|
49
|
-
- lib/nominet-epp/helpers.rb
|
50
49
|
- lib/nominet-epp/notification.rb
|
51
50
|
- lib/nominet-epp/operations.rb
|
52
51
|
- lib/nominet-epp/request.rb
|
@@ -65,6 +64,7 @@ files:
|
|
65
64
|
- lib/nominet-epp/requests/domain/info.rb
|
66
65
|
- lib/nominet-epp/requests/domain/release.rb
|
67
66
|
- lib/nominet-epp/requests/domain/renew.rb
|
67
|
+
- lib/nominet-epp/requests/domain/request.rb
|
68
68
|
- lib/nominet-epp/requests/domain/unrenew.rb
|
69
69
|
- lib/nominet-epp/requests/domain/update.rb
|
70
70
|
- lib/nominet-epp/requests/host/check.rb
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/nominet-epp/version.rb
|
99
99
|
- nominet-epp.gemspec
|
100
100
|
- test/helper.rb
|
101
|
+
- test/notifications/test_account_change_notification.rb
|
101
102
|
- test/notifications/test_contact_deleted_notification.rb
|
102
103
|
- test/notifications/test_domain_cancelled_notification.rb
|
103
104
|
- test/notifications/test_domains_released_notification.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- test/support/responses/contact/check.xml
|
153
154
|
- test/support/responses/contact/create.xml
|
154
155
|
- test/support/responses/contact/delete.xml
|
156
|
+
- test/support/responses/contact/info-streets.xml
|
155
157
|
- test/support/responses/contact/info.xml
|
156
158
|
- test/support/responses/contact/release.xml
|
157
159
|
- test/support/responses/contact/update.xml
|
@@ -237,6 +239,7 @@ specification_version: 4
|
|
237
239
|
summary: Nominet EPP (Extensible Provisioning Protocol) Client
|
238
240
|
test_files:
|
239
241
|
- test/helper.rb
|
242
|
+
- test/notifications/test_account_change_notification.rb
|
240
243
|
- test/notifications/test_contact_deleted_notification.rb
|
241
244
|
- test/notifications/test_domain_cancelled_notification.rb
|
242
245
|
- test/notifications/test_domains_released_notification.rb
|
@@ -291,6 +294,7 @@ test_files:
|
|
291
294
|
- test/support/responses/contact/check.xml
|
292
295
|
- test/support/responses/contact/create.xml
|
293
296
|
- test/support/responses/contact/delete.xml
|
297
|
+
- test/support/responses/contact/info-streets.xml
|
294
298
|
- test/support/responses/contact/info.xml
|
295
299
|
- test/support/responses/contact/release.xml
|
296
300
|
- test/support/responses/contact/update.xml
|
data/lib/nominet-epp/helpers.rb
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
# Helper methods
|
3
|
-
module Helpers
|
4
|
-
# @param [String, Array] nameservers Nameserver host name or array of host names or hashes
|
5
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements with
|
6
|
-
# @return [XML::Node] +ns+ element of +host+ elements
|
7
|
-
# @see domain_host_xml
|
8
|
-
def domain_ns_xml(nameservers, ns)
|
9
|
-
ns_el = XML::Node.new('ns', nil, ns)
|
10
|
-
|
11
|
-
case nameservers
|
12
|
-
when String
|
13
|
-
ns_el << domain_host_xml(nameservers, ns)
|
14
|
-
when Array
|
15
|
-
nameservers.each do |nameserver|
|
16
|
-
ns_el << domain_host_xml(nameserver, ns)
|
17
|
-
end
|
18
|
-
else
|
19
|
-
raise ArgumentError, "nameservers must either be a string or array"
|
20
|
-
end
|
21
|
-
|
22
|
-
ns_el
|
23
|
-
end
|
24
|
-
|
25
|
-
# @param [String, Hash] nameserver Nameserver host name or hash of +:name+ and +:v4+ or +:v6+ address
|
26
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements with
|
27
|
-
# @return [XML::Node] +host+ element with +hostName+ and optionally +ip+ subelements
|
28
|
-
def domain_host_xml(nameserver, ns)
|
29
|
-
host = XML::Node.new('host', nil, ns)
|
30
|
-
|
31
|
-
case nameserver
|
32
|
-
when String
|
33
|
-
host << XML::Node.new('hostName', nameserver, ns)
|
34
|
-
when Hash
|
35
|
-
host << XML::Node.new('hostName', nameserver[:name], ns)
|
36
|
-
if nameserver[:v4]
|
37
|
-
host << XML::Node.new('hostAddr', nameserver[:v4], ns).tap do |n|
|
38
|
-
n['ip'] = 'v4'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
if nameserver[:v6]
|
42
|
-
host << XML::Node.new('hostAddr', nameserver[:v6], ns).tap do |n|
|
43
|
-
n['ip'] = 'v6'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
host
|
49
|
-
end
|
50
|
-
|
51
|
-
# Adds the attributes from the fields to the +node+.
|
52
|
-
#
|
53
|
-
# @param [Hash] fields Account attributes to marshal
|
54
|
-
# @param [XML::Node] node XML Node to add the attributes to
|
55
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements under
|
56
|
-
def account_fields_xml(fields, node, ns)
|
57
|
-
[:trad_name, :type, :co_no, :opt_out, :addr, :contacts].each do |k|
|
58
|
-
next if fields[k].nil?
|
59
|
-
case k
|
60
|
-
when :contacts
|
61
|
-
account_contacts_to_xml(fields[k], ns) do |n|
|
62
|
-
node << n
|
63
|
-
end
|
64
|
-
when :addr # Limitation, can only handle one addr at a time
|
65
|
-
node << addr_to_xml(fields[k], ns)
|
66
|
-
else
|
67
|
-
node << generic_field_to_xml(k, fields[k], ns) unless fields[k] == ''
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Creates an XML node with the dashed form of the +name+.
|
73
|
-
#
|
74
|
-
# @param [String] name Element name, underscores will be converted to hyphens
|
75
|
-
# @param [String] value Element value
|
76
|
-
# @param [XML::Namespace] ns XML Namespace to create the element under
|
77
|
-
# @return [XML::Node]
|
78
|
-
def generic_field_to_xml(name, value, ns)
|
79
|
-
XML::Node.new(name.to_s.gsub('_', '-'), value, ns)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Massage the contacts to ensure they have an :order parameter
|
83
|
-
#
|
84
|
-
# @param [Array<Hash>] contacts Array of contact attributes
|
85
|
-
# @return [Array<Hash>] Fixed array of contact attributes
|
86
|
-
def fixup_account_contacts(contacts)
|
87
|
-
if contacts.all? { |c| c.has_key? :order }
|
88
|
-
return contacts.sort { |a,b| a[:order].to_i <=> b[:order].to_i }
|
89
|
-
elsif contacts.any? { |c| c.has_key? :order }
|
90
|
-
unordered = contacts.map {|c| c if c[:order].nil? }.compact
|
91
|
-
ordered = Array.new
|
92
|
-
contacts.each do |c|
|
93
|
-
next if c[:order].nil?
|
94
|
-
ordered[c[:order].to_i - 1] = c
|
95
|
-
end
|
96
|
-
|
97
|
-
contacts = ordered.map do |i|
|
98
|
-
unless i.nil? then i
|
99
|
-
else unordered.shift
|
100
|
-
end
|
101
|
-
end + unordered
|
102
|
-
end
|
103
|
-
|
104
|
-
contacts.each_with_index { |c,i| c[:order] = (i+1).to_s }
|
105
|
-
end
|
106
|
-
|
107
|
-
# Creates and array of XML::Node objects for each contact passed.
|
108
|
-
#
|
109
|
-
# @param [Array] contacts Array of contacts
|
110
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements under
|
111
|
-
# @yield [node]
|
112
|
-
# @yieldparam [XML::Node] node XML contact element
|
113
|
-
# @return [Array] array of XML contact nodes
|
114
|
-
def account_contacts_to_xml(contacts, ns)
|
115
|
-
raise ArgumentError, "contacts must be an Array" unless contacts.is_a?(Array)
|
116
|
-
raise ArgumentError, "ns must be an xml namespace" unless ns.is_a?(XML::Namespace)
|
117
|
-
|
118
|
-
contacts = fixup_account_contacts(contacts)
|
119
|
-
|
120
|
-
contacts[0,3].map do |contact|
|
121
|
-
account_contact_to_xml(contact, ns).tap do |n|
|
122
|
-
yield n if block_given?
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
# Creates an XML contact element
|
128
|
-
#
|
129
|
-
# @param [Hash] contact Contact attributes
|
130
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements under
|
131
|
-
# @return [XML::Node] XML contact element
|
132
|
-
def account_contact_to_xml(contact, ns)
|
133
|
-
raise ArgumentError, "contact must be a hash" unless contact.is_a?(Hash)
|
134
|
-
raise ArgumentError, "ns must be an xml namespace" unless ns.is_a?(XML::Namespace)
|
135
|
-
|
136
|
-
XML::Node.new('contact', nil, ns).tap do |node|
|
137
|
-
node['order'] = contact.delete(:order).to_s if contact.has_key?(:order)
|
138
|
-
|
139
|
-
node << contact_to_xml(contact)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
# Creates an XML +contact:create+ or +contact:update+ element.
|
144
|
-
#
|
145
|
-
# The choice to create a +create+ or +update+ element is determined by the presence of
|
146
|
-
# a +:roid+ key in the list of attributes.
|
147
|
-
#
|
148
|
-
# @param [Hash] contact Contact attributes
|
149
|
-
# @return [XML::Node] XML contact:+action+ element with the attributes
|
150
|
-
def contact_to_xml(contact)
|
151
|
-
keys = [:roid, :name, :phone, :mobile, :email]
|
152
|
-
raise ArgumentError, "contact must be a hash" unless contact.is_a?(Hash)
|
153
|
-
raise ArgumentError, "Contact allowed keys are #{keys.join(', ')}" unless (contact.keys - keys).empty?
|
154
|
-
raise ArgumentError, "Contact requires name and email keys" unless contact.has_key?(:name) && contact.has_key?(:email)
|
155
|
-
|
156
|
-
action = contact[:roid].nil? || contact[:roid] == '' ? 'create' : 'update'
|
157
|
-
contact(action) do |node, ns|
|
158
|
-
keys.each do |key|
|
159
|
-
next if contact[key].nil? || contact[key] == ''
|
160
|
-
node << XML::Node.new(key, contact[key], ns)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# Creates an XML addr element
|
166
|
-
#
|
167
|
-
# @param [Hash] addr Address attributes
|
168
|
-
# @param [XML::Namespace] ns XML Namespace to create the elements in
|
169
|
-
# @return [XML::Node] XML addr element
|
170
|
-
def addr_to_xml(addr, ns)
|
171
|
-
keys = [:street, :locality, :city, :county, :postcode, :country]
|
172
|
-
raise ArgumentError, "addr must be a hash" unless addr.is_a?(Hash)
|
173
|
-
raise ArgumentError, "ns must be an xml namespace" unless ns.is_a?(XML::Namespace)
|
174
|
-
raise ArgumentError, "Address allowed keys are #{keys.join(', ')}" unless (addr.keys - keys).empty?
|
175
|
-
|
176
|
-
XML::Node.new('addr', nil, ns).tap do |a|
|
177
|
-
keys.each do |key|
|
178
|
-
next if addr[key].nil? || addr[key] == ''
|
179
|
-
a << XML::Node.new(key, addr[key], ns)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|