kono_epp_client 0.0.3 → 0.1.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 +5 -5
- data/lib/epp/epp_command/check_contacts.rb +17 -0
- data/lib/epp/epp_command/create_domain.rb +4 -2
- data/lib/epp/epp_command/kono_epp_check_domains.rb +18 -0
- data/lib/epp/epp_command/transfer_domain.rb +22 -5
- data/lib/epp/epp_command/update_domain.rb +60 -44
- data/lib/epp/exceptions.rb +10 -0
- data/lib/epp/server.rb +44 -20
- data/lib/epp/transport/http.rb +10 -5
- data/lib/kono_epp_client.rb +5 -14
- data/spec/epp/epp_command/kono_epp_check_contacts_spec.rb +25 -0
- data/spec/epp/epp_command/kono_epp_check_domains_spec.rb +16 -0
- data/spec/epp/epp_command/kono_epp_create_domain_spec.rb +37 -0
- data/spec/epp/epp_command/kono_epp_transfer_domain_spec.rb +33 -0
- data/spec/epp/epp_command/kono_epp_update_domain_spec.rb +125 -0
- data/spec/epp/kono_epp_command_spec.rb +16 -0
- data/spec/fixtures/snapshots/kono_epp_check_contacts/_construct.xml.snap +13 -0
- data/spec/fixtures/snapshots/kono_epp_check_domains/_construct.xml.snap +11 -0
- data/spec/fixtures/snapshots/kono_epp_create_domain/_create.xml.snap +29 -0
- data/spec/fixtures/snapshots/kono_epp_transfer_domain/_con_extension_construct.xml.snap +23 -0
- data/spec/fixtures/snapshots/kono_epp_transfer_domain/_construct.xml.snap +13 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap +15 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap +15 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap +16 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap +18 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap +28 -0
- data/spec/fixtures/snapshots/kono_epp_update_domain/_update_status_cambia_status.xml.snap +16 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/support/context.rb +15 -0
- data/spec/support/matchers.rb +6 -0
- data/spec/support/snapshot.rb +20 -0
- metadata +136 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8a4bd5d2aace0903e87fdb0dfa0e5c0b6d6c5252bc174536eeae420c07334197
|
4
|
+
data.tar.gz: e40f8a2a045e31022ab9dcf011e9a5b6eb03f89f798054e9b6d096263583cce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c13b257e76b8e742e42f6636e00c9b138ccedabedb26f96dfadcc68ab9b3b7f535258c27789aaa5a803e2265dec08ace2ad9bd4abf2791dbfb4080207c4fd393
|
7
|
+
data.tar.gz: e782dd2e967c202cc9e85c37e0ecc7befc605d4a77f3b83c86878dc3a002433c99cb70441a5cf81e15b631fa8433bf9e534f60a86f4c06bacb7679b14a57ce66
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class KonoEppCheckContacts < KonoEppCommand
|
2
|
+
def initialize(ids)
|
3
|
+
super(nil, nil)
|
4
|
+
|
5
|
+
command = root.elements['command']
|
6
|
+
|
7
|
+
info = command.add_element "check"
|
8
|
+
|
9
|
+
contact_check = info.add_element("contact:check", {"xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0"})
|
10
|
+
|
11
|
+
ids.each do |t|
|
12
|
+
contact_id = contact_check.add_element "contact:id"
|
13
|
+
contact_id.text = t
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -21,8 +21,10 @@ class KonoEppCreateDomain < KonoEppCommand
|
|
21
21
|
host_name.text = ns[0]
|
22
22
|
|
23
23
|
# FIXME IPv6
|
24
|
-
|
25
|
-
|
24
|
+
if ns[1]
|
25
|
+
host_addr = host_attr.add_element "domain:hostAddr", {"ip" => "v4"}
|
26
|
+
host_addr.text = ns[1]
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
30
|
domain_registrant = domain_create.add_element "domain:registrant"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class KonoEppCheckDomains < KonoEppCommand
|
4
|
+
def initialize( *domains )
|
5
|
+
super( nil, nil )
|
6
|
+
|
7
|
+
command = root.elements['command']
|
8
|
+
check = command.add_element( "check" )
|
9
|
+
|
10
|
+
domain_check = check.add_element( "domain:check", { "xmlns:domain" => "urn:ietf:params:xml:ns:domain-1.0",
|
11
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd" } )
|
12
|
+
|
13
|
+
domains.each do |d|
|
14
|
+
domain_name = domain_check.add_element "domain:name"
|
15
|
+
domain_name.text = d
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
class KonoEppTransferDomain < KonoEppCommand
|
2
|
-
def initialize(
|
3
|
-
super(
|
2
|
+
def initialize(name, authinfo, op, extension: nil)
|
3
|
+
super(nil, nil)
|
4
4
|
|
5
5
|
command = root.elements['command']
|
6
|
-
transfer = command.add_element(
|
6
|
+
transfer = command.add_element("transfer", {"op" => op})
|
7
|
+
# FIXME dovremmo controllare che le possibili opzioni di OP sono 'request', 'cancel', 'approve', 'reject', 'query'
|
7
8
|
|
8
|
-
domain_transfer = transfer.add_element(
|
9
|
-
|
9
|
+
domain_transfer = transfer.add_element("domain:transfer", {"xmlns:domain" => "urn:ietf:params:xml:ns:domain-1.0",
|
10
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"})
|
10
11
|
|
11
12
|
domain_name = domain_transfer.add_element "domain:name"
|
12
13
|
domain_name.text = name
|
@@ -15,5 +16,21 @@ class KonoEppTransferDomain < KonoEppCommand
|
|
15
16
|
domain_pw = domain_authinfo.add_element "domain:pw"
|
16
17
|
|
17
18
|
domain_pw.text = authinfo
|
19
|
+
|
20
|
+
## Questa estensione è per Modifica del Registrar con contestuale modifica del Registrante
|
21
|
+
if extension
|
22
|
+
|
23
|
+
ext_elm = command.add_element "extension"
|
24
|
+
ext_trade = ext_elm.add_element "extdom:trade", {"xmlns:extdom"=>"http://www.nic.it/ITNIC-EPP/extdom-2.0",
|
25
|
+
"xsi:schemaLocation" => "http://www.nic.it/ITNIC-EPP/extdom-2.0 extdom-2.0.xsd"}
|
26
|
+
|
27
|
+
transfer_trade = ext_trade.add_element "extdom:transferTrade"
|
28
|
+
transfer_trade.add_element("extdom:newRegistrant").text = extension[:new_registrant] if extension[:new_registrant]
|
29
|
+
if extension[:new_auth_info]
|
30
|
+
transfer_trade.add_element("extdom:newAuthInfo").add_element("extdom:pw").tap{|x|x.text=extension[:new_auth_info]}
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
18
35
|
end
|
19
36
|
end
|
@@ -1,71 +1,80 @@
|
|
1
1
|
class KonoEppUpdateDomain < KonoEppCommand
|
2
|
-
def initialize(
|
3
|
-
super(
|
2
|
+
def initialize(options)
|
3
|
+
super(nil, nil)
|
4
4
|
|
5
5
|
command = root.elements['command']
|
6
|
-
update = command.add_element(
|
6
|
+
update = command.add_element("update")
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd" } )
|
8
|
+
domain_update = update.add_element("domain:update", {"xmlns:domain" => "urn:ietf:params:xml:ns:domain-1.0",
|
9
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"})
|
11
10
|
|
12
11
|
name = domain_update.add_element "domain:name"
|
13
12
|
name.text = options[:name]
|
14
13
|
|
15
|
-
if not options[:add_nameservers].blank? or options[:add_admin] or options[:add_tech]
|
14
|
+
if not options[:add_nameservers].blank? or options[:add_admin] or options[:add_tech] or options[:add_status]
|
15
|
+
# <domain:add>
|
16
16
|
domain_add = domain_update.add_element "domain:add"
|
17
|
-
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
end
|
18
|
+
unless options[:add_nameservers].blank?
|
19
|
+
domain_add_ns = domain_add.add_element "domain:ns"
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
options[:add_nameservers].each do |ns|
|
22
|
+
host_attr = domain_add_ns.add_element "domain:hostAttr"
|
23
|
+
host_name = host_attr.add_element "domain:hostName"
|
26
24
|
|
27
|
-
|
28
|
-
host_attr = domain_add_ns.add_element "domain:hostAttr"
|
29
|
-
host_name = host_attr.add_element "domain:hostName"
|
25
|
+
host_name.text = ns[0]
|
30
26
|
|
31
|
-
|
27
|
+
# FIXME IPv6
|
28
|
+
if ns[1]
|
29
|
+
host_addr = host_attr.add_element "domain:hostAddr", {"ip" => "v4"}
|
30
|
+
host_addr.text = ns[1]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
if options[:add_admin]
|
36
|
+
domain_contact = domain_add.add_element "domain:contact", {"type" => "admin"}
|
37
|
+
domain_contact.text = options[:add_admin]
|
36
38
|
end
|
37
|
-
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
40
|
+
if options[:add_status]
|
41
|
+
domain_add.add_element "domain:status", {"s" => options[:add_status]}
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
if options[:add_tech]
|
45
|
+
domain_contact = domain_add.add_element "domain:contact", {"type" => "tech"}
|
46
|
+
domain_contact.text = options[:add_tech]
|
47
|
+
end
|
47
48
|
end
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
if not options[:remove_nameservers].blank? or options[:remove_admin] or options[:remove_tech] or options[:remove_status]
|
51
|
+
# <domain:rem>
|
52
|
+
domain_remove = domain_update.add_element "domain:rem"
|
52
53
|
|
53
|
-
options[:remove_nameservers].
|
54
|
-
|
55
|
-
host_name = host_attr.add_element "domain:hostName"
|
54
|
+
unless options[:remove_nameservers].blank?
|
55
|
+
domain_remove_ns = domain_remove.add_element "domain:ns"
|
56
56
|
|
57
|
-
|
57
|
+
options[:remove_nameservers].each do |ns_name|
|
58
|
+
host_attr = domain_remove_ns.add_element "domain:hostAttr"
|
59
|
+
host_name = host_attr.add_element "domain:hostName"
|
60
|
+
|
61
|
+
host_name.text = ns_name
|
62
|
+
end
|
58
63
|
end
|
59
|
-
end
|
60
64
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
+
if options[:remove_admin]
|
66
|
+
domain_contact = domain_remove.add_element "domain:contact", {"type" => "admin"}
|
67
|
+
domain_contact.text = options[:remove_admin]
|
68
|
+
end
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
if options[:remove_status]
|
71
|
+
domain_remove.add_element "domain:status", {"s" => options[:remove_status]}
|
72
|
+
end
|
73
|
+
|
74
|
+
if options[:remove_tech]
|
75
|
+
domain_contact = domain_remove.add_element "domain:contact", {"type" => "tech"}
|
76
|
+
domain_contact.text = options[:remove_tech]
|
77
|
+
end
|
69
78
|
end
|
70
79
|
|
71
80
|
# <domain:chg>
|
@@ -83,6 +92,13 @@ class KonoEppUpdateDomain < KonoEppCommand
|
|
83
92
|
domain_pw.text = options[:auth_info]
|
84
93
|
end
|
85
94
|
|
95
|
+
if options[:restore]
|
96
|
+
command.add_element("extension").tap do |ext|
|
97
|
+
ext.add_element("rgp:update", {"xmlns:rgp"=>"urn:ietf:params:xml:ns:rgp-1.0",
|
98
|
+
"xsi:schemaLocation"=>"urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"}).
|
99
|
+
add_element("rgp:restore", {"op"=> "request"})
|
100
|
+
end
|
101
|
+
end
|
86
102
|
# TODO: Registrant
|
87
103
|
end
|
88
104
|
end
|
data/lib/epp/exceptions.rb
CHANGED
@@ -16,3 +16,13 @@ end
|
|
16
16
|
|
17
17
|
class KonoEppAuthenticationPasswordExpired < KonoEppErrorResponse ; end
|
18
18
|
class KonoEppLoginNeeded < KonoEppErrorResponse ; end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Errore NIC:
|
22
|
+
# 2304=Object status prohibits operation 9022=Domain has status clientTransferProhibited
|
23
|
+
class KonoEppDomainHasStatusCliTransProhibited < KonoEppErrorResponse; end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Errore NIC:
|
27
|
+
# 2304=Object status prohibits operation 9026=Domain has status clientUpdateProhibited
|
28
|
+
class KonoEppDomainHasStatusClientUpdateProhibited < KonoEppErrorResponse; end
|
data/lib/epp/server.rb
CHANGED
@@ -5,7 +5,7 @@ module KonoEppClient #:nodoc:
|
|
5
5
|
|
6
6
|
require 'nokogiri'
|
7
7
|
|
8
|
-
attr_accessor :tag, :password, :server, :port, :old_server, :services, :lang, :extensions, :version, :credit, :timeout
|
8
|
+
attr_accessor :tag, :password, :server, :port, :ssl_version, :old_server, :services, :lang, :extensions, :version, :credit, :timeout
|
9
9
|
|
10
10
|
# ==== Required Attrbiutes
|
11
11
|
#
|
@@ -22,20 +22,26 @@ module KonoEppClient #:nodoc:
|
|
22
22
|
# * <tt>:services</tt> - Use custom EPP services in the <login> frame. The defaults use the EPP standard domain, contact and host 1.0 services.
|
23
23
|
# * <tt>:extensions</tt> - URLs to custom extensions to standard EPP. Use these to extend the standard EPP (e.g., Nominet uses extensions). Defaults to none.
|
24
24
|
# * <tt>:version</tt> - Set the EPP version. Defaults to "1.0".
|
25
|
+
# * <tt>:transport</tt> - Type of connection (http or tcp). Default to "tcp"
|
26
|
+
# * <tt>:timeout</tt> - Timeou for connections in seconds. Default to "30"
|
27
|
+
# * <tt>:ssl_version</tt> - Version of the ssl protocol versione. Default to TLSv1
|
28
|
+
# * <tt>:ssl_version</tt> - Version of the ssl protocol versione. Default to TLSv1
|
29
|
+
#
|
25
30
|
def initialize(attributes = {})
|
26
31
|
requires!(attributes, :tag, :password, :server)
|
27
32
|
|
28
|
-
@tag
|
29
|
-
@password
|
30
|
-
@server
|
31
|
-
@port
|
32
|
-
@old_server
|
33
|
-
@lang
|
34
|
-
@services
|
35
|
-
@extensions
|
36
|
-
@version
|
37
|
-
@transport
|
38
|
-
@timeout
|
33
|
+
@tag = attributes[:tag]
|
34
|
+
@password = attributes[:password]
|
35
|
+
@server = attributes[:server]
|
36
|
+
@port = attributes[:port] || 700
|
37
|
+
@old_server = attributes[:old_server] || false
|
38
|
+
@lang = attributes[:lang] || "en"
|
39
|
+
@services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"]
|
40
|
+
@extensions = attributes[:extensions] || []
|
41
|
+
@version = attributes[:version] || "1.0"
|
42
|
+
@transport = attributes[:transport] || :tcp
|
43
|
+
@timeout = attributes[:timeout] || 30
|
44
|
+
@ssl_version = attributes[:ssl_version] || :TLSv1
|
39
45
|
|
40
46
|
@logged_in = false
|
41
47
|
end
|
@@ -112,7 +118,7 @@ module KonoEppClient #:nodoc:
|
|
112
118
|
|
113
119
|
# FIXME: Remove command wrappers?
|
114
120
|
def hello
|
115
|
-
|
121
|
+
send_request( KonoEppHello.new.to_s )
|
116
122
|
end
|
117
123
|
|
118
124
|
def poll( id = nil )
|
@@ -128,6 +134,10 @@ module KonoEppClient #:nodoc:
|
|
128
134
|
send_command( contact )
|
129
135
|
end
|
130
136
|
|
137
|
+
def check_contacts(ids)
|
138
|
+
send_command( KonoEppCheckContacts.new(ids) )
|
139
|
+
end
|
140
|
+
|
131
141
|
def delete_contact( id )
|
132
142
|
contact = KonoEppDeleteContact.new id
|
133
143
|
send_command( contact )
|
@@ -143,6 +153,10 @@ module KonoEppClient #:nodoc:
|
|
143
153
|
send_command( domain )
|
144
154
|
end
|
145
155
|
|
156
|
+
def check_domains( *domains )
|
157
|
+
send_command( KonoEppCheckDomains.new *domains )
|
158
|
+
end
|
159
|
+
|
146
160
|
def update_domain( options )
|
147
161
|
domain = KonoEppUpdateDomain.new options
|
148
162
|
send_command( domain )
|
@@ -163,9 +177,8 @@ module KonoEppClient #:nodoc:
|
|
163
177
|
send_command( info )
|
164
178
|
end
|
165
179
|
|
166
|
-
def transfer_domain(
|
167
|
-
|
168
|
-
send_command( transfer )
|
180
|
+
def transfer_domain(name, authinfo, op, extension: nil)
|
181
|
+
send_command(KonoEppTransferDomain.new( name, authinfo, op, extension: extension))
|
169
182
|
end
|
170
183
|
|
171
184
|
# Sends a standard logout request to the EPP server.
|
@@ -231,6 +244,10 @@ module KonoEppClient #:nodoc:
|
|
231
244
|
raise KonoEppAuthenticationPasswordExpired.new( args )
|
232
245
|
when [2002, 4015]
|
233
246
|
raise KonoEppLoginNeeded.new( args )
|
247
|
+
when [2304, 9022]
|
248
|
+
raise KonoEppDomainHasStatusCliTransProhibited.new(args)
|
249
|
+
when [2304, 9026]
|
250
|
+
raise KonoEppDomainHasStatusClientUpdateProhibited.new(args)
|
234
251
|
else
|
235
252
|
raise KonoEppErrorResponse.new( args )
|
236
253
|
end
|
@@ -241,15 +258,22 @@ module KonoEppClient #:nodoc:
|
|
241
258
|
# the EPP <tt><greeting></tt> which is sent by the
|
242
259
|
# server upon connection.
|
243
260
|
def open_connection
|
261
|
+
# FIXME il timeout serve solamente nella versione tcp
|
262
|
+
# FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport
|
263
|
+
# e successivamente viene utilizzato sempre quello?
|
244
264
|
Timeout.timeout @timeout do
|
245
|
-
|
246
|
-
|
247
|
-
|
265
|
+
case @transport
|
266
|
+
when :tcp
|
267
|
+
@connection = KonoEppClient::Transport::TcpTransport.new(server, port)
|
268
|
+
when :http
|
269
|
+
@connection = KonoEppClient::Transport::HttpTransport.new(server, port,
|
270
|
+
ssl_version: ssl_version,
|
271
|
+
cookie_file: "#{@tag.downcase}.cookies.pstore"
|
272
|
+
)
|
248
273
|
end
|
249
274
|
end
|
250
275
|
end
|
251
276
|
|
252
|
-
|
253
277
|
# Receive an EPP response from the server. Since the connection is blocking,
|
254
278
|
# this method will wait until the connection becomes available for use. If
|
255
279
|
# the connection is broken, a SocketError will be raised. Otherwise,
|
data/lib/epp/transport/http.rb
CHANGED
@@ -6,20 +6,24 @@ module KonoEppClient::Transport
|
|
6
6
|
|
7
7
|
require 'pstore'
|
8
8
|
|
9
|
-
|
9
|
+
# @param [String] server
|
10
|
+
# @param [Integer] port
|
11
|
+
# @param [Symbol] ssl_version -> Versione ssl
|
12
|
+
# @param [String] cookie_file -> identifica il nome del file del cookie-store
|
13
|
+
def initialize(server, port, ssl_version: :TLSv1, cookie_file: "cookies.pstore")
|
10
14
|
@net_http = Net::HTTP.new( server, port )
|
11
15
|
|
12
16
|
@net_http.use_ssl = true
|
13
|
-
@net_http.ssl_version =
|
17
|
+
@net_http.ssl_version = ssl_version
|
14
18
|
@net_http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
15
|
-
|
19
|
+
|
16
20
|
#FIXME: Commented because not work on MacOS (dev machine), is necessary for Linux machine?
|
17
21
|
#@net_http.ca_path = '/etc/ssl/certs'
|
18
|
-
|
22
|
+
|
19
23
|
# @net_http.set_debug_output $stderr
|
20
24
|
#@net_http.set_debug_output File.open( "/tmp/net.log", "a")
|
21
25
|
|
22
|
-
@store = PStore.new(
|
26
|
+
@store = PStore.new( cookie_file )
|
23
27
|
end
|
24
28
|
|
25
29
|
def read
|
@@ -43,6 +47,7 @@ module KonoEppClient::Transport
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def close
|
50
|
+
FileUtils.rm_rf(@store.path)
|
46
51
|
end
|
47
52
|
|
48
53
|
private
|
data/lib/kono_epp_client.rb
CHANGED
@@ -4,7 +4,6 @@ require 'openssl'
|
|
4
4
|
require 'socket'
|
5
5
|
require 'active_support'
|
6
6
|
require 'rexml/document'
|
7
|
-
require 'hpricot'
|
8
7
|
|
9
8
|
# Package files
|
10
9
|
require File.dirname(__FILE__) + '/require_parameters.rb'
|
@@ -16,19 +15,11 @@ require File.dirname(__FILE__) + '/epp/transport/tcp.rb'
|
|
16
15
|
require File.dirname(__FILE__) + '/epp/transport/http.rb'
|
17
16
|
|
18
17
|
require File.dirname(__FILE__) + '/epp/epp_command.rb'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
require
|
23
|
-
|
24
|
-
require File.dirname(__FILE__) + '/epp/epp_command/create_domain.rb'
|
25
|
-
require File.dirname(__FILE__) + '/epp/epp_command/info_contact.rb'
|
26
|
-
require File.dirname(__FILE__) + '/epp/epp_command/info_domain.rb'
|
27
|
-
require File.dirname(__FILE__) + '/epp/epp_command/delete_contact.rb'
|
28
|
-
require File.dirname(__FILE__) + '/epp/epp_command/delete_domain.rb'
|
29
|
-
require File.dirname(__FILE__) + '/epp/epp_command/transfer_domain.rb'
|
30
|
-
require File.dirname(__FILE__) + '/epp/epp_command/update_contact.rb'
|
31
|
-
require File.dirname(__FILE__) + '/epp/epp_command/update_domain.rb'
|
18
|
+
|
19
|
+
# load di tutti i comandi presenti in epp_command
|
20
|
+
Dir.glob(File.dirname(__FILE__) + '/epp/epp_command/*.rb').each do |f|
|
21
|
+
require f
|
22
|
+
end
|
32
23
|
|
33
24
|
module KonoEppClient #:nodoc:
|
34
25
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
RSpec.describe KonoEppCheckContacts do
|
3
|
+
|
4
|
+
let(:ids){
|
5
|
+
["mm001",
|
6
|
+
"mb001",
|
7
|
+
"cl001",
|
8
|
+
"bb001"]
|
9
|
+
}
|
10
|
+
|
11
|
+
include_context "like epp command"
|
12
|
+
|
13
|
+
let(:instance) {
|
14
|
+
described_class.new(ids)
|
15
|
+
}
|
16
|
+
|
17
|
+
it "construct", snapshot: 'xml' do
|
18
|
+
expect(rendered.to_s).to have_tag("epp>command>check>check") do
|
19
|
+
ids.each do |t|
|
20
|
+
with_tag("id", text: t)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppCheckDomains do
|
4
|
+
include_context "like epp command"
|
5
|
+
|
6
|
+
let(:instance) do
|
7
|
+
described_class.new("test.it","wow.it")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "construct", snapshot: "xml" do
|
11
|
+
expect(rendered.to_s).to have_tag("epp>command>check>check") do
|
12
|
+
with_tag("name", text: "test.it")
|
13
|
+
with_tag("name", text: "wow.it")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppCreateDomain do
|
4
|
+
include_context "like epp command"
|
5
|
+
|
6
|
+
let(:instance) {
|
7
|
+
KonoEppCreateDomain.new(
|
8
|
+
{name: 'architest.it',
|
9
|
+
period: 1,
|
10
|
+
nameservers:
|
11
|
+
[["ns.test.it", "192.168.100.10"],
|
12
|
+
["ns2.test.it", "192.168.100.20"],
|
13
|
+
["ns3.foo.com"]],
|
14
|
+
# contacts
|
15
|
+
registrant: "RRR12",
|
16
|
+
admin: "AAAA12",
|
17
|
+
tech: "TTT12",
|
18
|
+
authinfo: "WWW-test-it"
|
19
|
+
}
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
it "create", snapshot: "xml" do
|
24
|
+
expect(rendered.to_s).to have_tag("ns")
|
25
|
+
expect(rendered.to_s.downcase).to have_tag("hostattr")
|
26
|
+
expect(rendered.to_s.downcase).to have_tag("ns hostattr" ) do
|
27
|
+
with_tag("hostname",text:"ns2.test.it")
|
28
|
+
with_tag("hostaddr",text:"192.168.100.20",with:{ip:"v4"})
|
29
|
+
end
|
30
|
+
expect(rendered.to_s.downcase).to have_tag("ns hostattr" ) do
|
31
|
+
with_tag("hostname",text:"ns.test.it")
|
32
|
+
with_tag("hostaddr",text:"192.168.100.10",with:{ip:"v4"})
|
33
|
+
end
|
34
|
+
expect(rendered.to_s.downcase).not_to have_tag("ns hostaddr", with: {ip: 'v4'},text:"" )
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppTransferDomain do
|
4
|
+
|
5
|
+
include_context "like epp command"
|
6
|
+
|
7
|
+
let(:instance) do
|
8
|
+
described_class.new("test.it", "wee-12-sd", 'request')
|
9
|
+
end
|
10
|
+
|
11
|
+
it "construct", snapshot: 'xml' do
|
12
|
+
expect(rendered.to_s).to have_tag("epp>command>transfer", with: {op: "request"}, count: 1) do
|
13
|
+
with_tag("transfer>name", text: "test.it")
|
14
|
+
with_tag("transfer>authinfo>pw", text: "wee-12-sd")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "con extension" do
|
19
|
+
|
20
|
+
let(:instance) do
|
21
|
+
described_class.new("test.it", "wee-12-sd", 'request',
|
22
|
+
extension: {new_registrant: "xx123fd", new_auth_info: "abc-sd934-sd"})
|
23
|
+
end
|
24
|
+
|
25
|
+
it "construct", snapshot: 'xml' do
|
26
|
+
expect(rendered.to_s).to have_tag("epp>command>extension>trade>transfertrade") do
|
27
|
+
with_tag("newregistrant", text: "xx123fd")
|
28
|
+
with_tag("newauthinfo>pw", text: "abc-sd934-sd")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppUpdateDomain do
|
4
|
+
|
5
|
+
let(:options) do
|
6
|
+
{
|
7
|
+
name: 'example.com',
|
8
|
+
# add_nameservers: [['ns1.example.com', '192.168.1.1']],
|
9
|
+
# add_admin: 'admin_contact',
|
10
|
+
# add_tech: 'tech_contact',
|
11
|
+
# remove_nameservers: ['ns2.example.com'],
|
12
|
+
# remove_admin: 'admin_contact_to_remove',
|
13
|
+
# remove_tech: 'tech_contact_to_remove',
|
14
|
+
# auth_info: 'my_auth_info',
|
15
|
+
# registrant: 'new_registrant'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
include_context "like epp command"
|
20
|
+
|
21
|
+
let(:instance) {
|
22
|
+
KonoEppUpdateDomain.new(options)
|
23
|
+
}
|
24
|
+
|
25
|
+
it "contiene il nome del dominio" do
|
26
|
+
expect(rendered.to_s).to have_tag("update>name", text: options[:name])
|
27
|
+
end
|
28
|
+
|
29
|
+
context "update nameservers" do
|
30
|
+
let(:options) {
|
31
|
+
super().merge({
|
32
|
+
add_nameservers: [
|
33
|
+
['ns1.example.com', '192.168.1.1'],
|
34
|
+
['ns3.example.com']
|
35
|
+
],
|
36
|
+
remove_nameservers: ['ns2.example.com'],
|
37
|
+
})
|
38
|
+
}
|
39
|
+
it "aggiunge e rimuove ns", snapshot: 'xml' do
|
40
|
+
expect(rendered.to_s.downcase).to have_tag("update>add>ns") do
|
41
|
+
with_tag("hostattr") do
|
42
|
+
with_tag("hostname", text: 'ns1.example.com')
|
43
|
+
with_tag("hostaddr", text: '192.168.1.1')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
expect(rendered.to_s.downcase).to have_tag("update>add>ns") do
|
47
|
+
with_tag("hostattr") do
|
48
|
+
with_tag("hostname", text: 'ns3.example.com')
|
49
|
+
without_tag("hostaddr",text:"")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
expect(rendered.to_s.downcase).to have_tag("update>rem>ns") do
|
53
|
+
with_tag("hostattr") do
|
54
|
+
with_tag("hostname", text: 'ns2.example.com')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "update contacts", snapshot: 'xml' do
|
61
|
+
let(:options) {
|
62
|
+
super().merge({
|
63
|
+
add_admin: "AAA1",
|
64
|
+
add_tech: "TTT1",
|
65
|
+
remove_admin: "AAA2",
|
66
|
+
remove_tech: "TTT2"
|
67
|
+
})
|
68
|
+
}
|
69
|
+
it "cambia ADMIN_TECH", snapshot: 'xml' do
|
70
|
+
expect(rendered.to_s.downcase).to have_tag("update>add>contact", with: {type: "admin"}, text: options[:add_admin].downcase)
|
71
|
+
expect(rendered.to_s.downcase).to have_tag("update>rem>contact", with: {type: "admin"}, text: options[:remove_admin].downcase)
|
72
|
+
expect(rendered.to_s.downcase).to have_tag("update>add>contact", with: {type: "tech"}, text: options[:add_tech].downcase)
|
73
|
+
expect(rendered.to_s.downcase).to have_tag("update>rem>contact", with: {type: "tech"}, text: options[:remove_tech].downcase)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
context "update status" do
|
77
|
+
let(:options) {
|
78
|
+
super().merge({
|
79
|
+
add_status: "clientTransferProhibited",
|
80
|
+
remove_status: "clientHold",
|
81
|
+
})
|
82
|
+
}
|
83
|
+
it "cambia status", snapshot: 'xml' do
|
84
|
+
expect(rendered.to_s.downcase).to have_tag("update>add>status", with: {s: options[:add_status].downcase})
|
85
|
+
expect(rendered.to_s.downcase).to have_tag("update>rem>status", with: {s: options[:remove_status].downcase})
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context "restore" do
|
90
|
+
let(:options) {
|
91
|
+
super().merge({
|
92
|
+
restore: true
|
93
|
+
})
|
94
|
+
}
|
95
|
+
it "esiste l'estensione di restore",snapshot: 'xml' do
|
96
|
+
expect(rendered.to_s.downcase).to have_tag("extension>update>restore", with: {op: "request"})
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "update auth_info" do
|
101
|
+
let(:options) {
|
102
|
+
super().merge({
|
103
|
+
auth_info: "AUTH12-!DSRTG"
|
104
|
+
})
|
105
|
+
}
|
106
|
+
it "cambia AUTH_INFO", snapshot: "xml" do
|
107
|
+
expect(rendered.to_s.downcase).to have_tag("update>chg") do
|
108
|
+
with_tag("authinfo>pw", text: options[:auth_info].downcase)
|
109
|
+
without_tag("registrant")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "con nuovo registrant" do
|
114
|
+
let(:options) {
|
115
|
+
super().merge({
|
116
|
+
registrant: "R0001"
|
117
|
+
})
|
118
|
+
}
|
119
|
+
it "cambia REGISTRANT", snapshot: "xml" do
|
120
|
+
expect(rendered.to_s.downcase).to have_tag("update>chg>registrant", text: options[:registrant].downcase)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rexml/document'
|
3
|
+
|
4
|
+
RSpec.describe KonoEppCommand do
|
5
|
+
it 'generates a valid XML document with the expected structure' do
|
6
|
+
xml_document = KonoEppCommand.new
|
7
|
+
expect(xml_document).to be_a(REXML::Document)
|
8
|
+
expect(xml_document.to_s).to include("xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd'")
|
9
|
+
expect(xml_document.to_s).to include("xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'")
|
10
|
+
expect(xml_document.to_s).to have_tag("epp",with:{
|
11
|
+
xmlns:"urn:ietf:params:xml:ns:epp-1.0"
|
12
|
+
}) do
|
13
|
+
have_tag("command",count:1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<check>
|
5
|
+
<contact:check xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
6
|
+
<contact:id>mm001</contact:id>
|
7
|
+
<contact:id>mb001</contact:id>
|
8
|
+
<contact:id>cl001</contact:id>
|
9
|
+
<contact:id>bb001</contact:id>
|
10
|
+
</contact:check>
|
11
|
+
</check>
|
12
|
+
</command>
|
13
|
+
</epp>
|
@@ -0,0 +1,11 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<check>
|
5
|
+
<domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:name>wow.it</domain:name>
|
8
|
+
</domain:check>
|
9
|
+
</check>
|
10
|
+
</command>
|
11
|
+
</epp>
|
@@ -0,0 +1,29 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<create>
|
5
|
+
<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>architest.it</domain:name>
|
7
|
+
<domain:ns>
|
8
|
+
<domain:hostAttr>
|
9
|
+
<domain:hostName>ns.test.it</domain:hostName>
|
10
|
+
<domain:hostAddr ip="v4">192.168.100.10</domain:hostAddr>
|
11
|
+
</domain:hostAttr>
|
12
|
+
<domain:hostAttr>
|
13
|
+
<domain:hostName>ns2.test.it</domain:hostName>
|
14
|
+
<domain:hostAddr ip="v4">192.168.100.20</domain:hostAddr>
|
15
|
+
</domain:hostAttr>
|
16
|
+
<domain:hostAttr>
|
17
|
+
<domain:hostName>ns3.foo.com</domain:hostName>
|
18
|
+
</domain:hostAttr>
|
19
|
+
</domain:ns>
|
20
|
+
<domain:registrant>RRR12</domain:registrant>
|
21
|
+
<domain:contact type="admin">AAAA12</domain:contact>
|
22
|
+
<domain:contact type="tech">TTT12</domain:contact>
|
23
|
+
<domain:authInfo>
|
24
|
+
<domain:pw>WWW-test-it</domain:pw>
|
25
|
+
</domain:authInfo>
|
26
|
+
</domain:create>
|
27
|
+
</create>
|
28
|
+
</command>
|
29
|
+
</epp>
|
@@ -0,0 +1,23 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<transfer op="request">
|
5
|
+
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:authInfo>
|
8
|
+
<domain:pw>wee-12-sd</domain:pw>
|
9
|
+
</domain:authInfo>
|
10
|
+
</domain:transfer>
|
11
|
+
</transfer>
|
12
|
+
<extension>
|
13
|
+
<extdom:trade xmlns:extdom="http://www.nic.it/ITNIC-EPP/extdom-2.0" xsi:schemaLocation="http://www.nic.it/ITNIC-EPP/extdom-2.0 extdom-2.0.xsd">
|
14
|
+
<extdom:transferTrade>
|
15
|
+
<extdom:newRegistrant>xx123fd</extdom:newRegistrant>
|
16
|
+
<extdom:newAuthInfo>
|
17
|
+
<extdom:pw>abc-sd934-sd</extdom:pw>
|
18
|
+
</extdom:newAuthInfo>
|
19
|
+
</extdom:transferTrade>
|
20
|
+
</extdom:trade>
|
21
|
+
</extension>
|
22
|
+
</command>
|
23
|
+
</epp>
|
@@ -0,0 +1,13 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<transfer op="request">
|
5
|
+
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>test.it</domain:name>
|
7
|
+
<domain:authInfo>
|
8
|
+
<domain:pw>wee-12-sd</domain:pw>
|
9
|
+
</domain:authInfo>
|
10
|
+
</domain:transfer>
|
11
|
+
</transfer>
|
12
|
+
</command>
|
13
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap
ADDED
@@ -0,0 +1,15 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
</domain:update>
|
8
|
+
</update>
|
9
|
+
<extension>
|
10
|
+
<rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd">
|
11
|
+
<rgp:restore op="request"/>
|
12
|
+
</rgp:update>
|
13
|
+
</extension>
|
14
|
+
</command>
|
15
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap
ADDED
@@ -0,0 +1,15 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:chg>
|
8
|
+
<domain:authInfo>
|
9
|
+
<domain:pw>AUTH12-!DSRTG</domain:pw>
|
10
|
+
</domain:authInfo>
|
11
|
+
</domain:chg>
|
12
|
+
</domain:update>
|
13
|
+
</update>
|
14
|
+
</command>
|
15
|
+
</epp>
|
@@ -0,0 +1,16 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:chg>
|
8
|
+
<domain:registrant>R0001</domain:registrant>
|
9
|
+
<domain:authInfo>
|
10
|
+
<domain:pw>AUTH12-!DSRTG</domain:pw>
|
11
|
+
</domain:authInfo>
|
12
|
+
</domain:chg>
|
13
|
+
</domain:update>
|
14
|
+
</update>
|
15
|
+
</command>
|
16
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap
ADDED
@@ -0,0 +1,18 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:contact type="admin">AAA1</domain:contact>
|
9
|
+
<domain:contact type="tech">TTT1</domain:contact>
|
10
|
+
</domain:add>
|
11
|
+
<domain:rem>
|
12
|
+
<domain:contact type="admin">AAA2</domain:contact>
|
13
|
+
<domain:contact type="tech">TTT2</domain:contact>
|
14
|
+
</domain:rem>
|
15
|
+
</domain:update>
|
16
|
+
</update>
|
17
|
+
</command>
|
18
|
+
</epp>
|
@@ -0,0 +1,28 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:ns>
|
9
|
+
<domain:hostAttr>
|
10
|
+
<domain:hostName>ns1.example.com</domain:hostName>
|
11
|
+
<domain:hostAddr ip="v4">192.168.1.1</domain:hostAddr>
|
12
|
+
</domain:hostAttr>
|
13
|
+
<domain:hostAttr>
|
14
|
+
<domain:hostName>ns3.example.com</domain:hostName>
|
15
|
+
</domain:hostAttr>
|
16
|
+
</domain:ns>
|
17
|
+
</domain:add>
|
18
|
+
<domain:rem>
|
19
|
+
<domain:ns>
|
20
|
+
<domain:hostAttr>
|
21
|
+
<domain:hostName>ns2.example.com</domain:hostName>
|
22
|
+
</domain:hostAttr>
|
23
|
+
</domain:ns>
|
24
|
+
</domain:rem>
|
25
|
+
</domain:update>
|
26
|
+
</update>
|
27
|
+
</command>
|
28
|
+
</epp>
|
@@ -0,0 +1,16 @@
|
|
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="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
3
|
+
<command>
|
4
|
+
<update>
|
5
|
+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
|
6
|
+
<domain:name>example.com</domain:name>
|
7
|
+
<domain:add>
|
8
|
+
<domain:status s="clientTransferProhibited"/>
|
9
|
+
</domain:add>
|
10
|
+
<domain:rem>
|
11
|
+
<domain:status s="clientHold"/>
|
12
|
+
</domain:rem>
|
13
|
+
</domain:update>
|
14
|
+
</update>
|
15
|
+
</command>
|
16
|
+
</epp>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_group "Commands","lib/epp/epp_command"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'kono_epp_client' # and any other gems you need
|
10
|
+
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
14
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
15
|
+
# files.
|
16
|
+
#
|
17
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
18
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
19
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
20
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
21
|
+
# a separate helper file that requires the additional dependencies and performs
|
22
|
+
# the additional setup, and require it from the spec files that actually need
|
23
|
+
# it.
|
24
|
+
#
|
25
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
26
|
+
Dir[File.join(File.dirname(__FILE__),"support/*.rb")].each { |f| require f }
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
|
30
|
+
# rspec-expectations config goes here. You can use an alternate
|
31
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
32
|
+
# assertions if you prefer.
|
33
|
+
config.expect_with :rspec do |expectations|
|
34
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
35
|
+
# and `failure_message` of custom matchers include text for helper methods
|
36
|
+
# defined using `chain`, e.g.:
|
37
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
38
|
+
# # => "be bigger than 2 and smaller than 4"
|
39
|
+
# ...rather than:
|
40
|
+
# # => "be bigger than 2"
|
41
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
42
|
+
end
|
43
|
+
|
44
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
45
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
46
|
+
config.mock_with :rspec do |mocks|
|
47
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
48
|
+
# a real object. This is generally recommended, and will default to
|
49
|
+
# `true` in RSpec 4.
|
50
|
+
mocks.verify_partial_doubles = true
|
51
|
+
end
|
52
|
+
|
53
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
54
|
+
# have no way to turn it off -- the option exists only for backwards
|
55
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
56
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
57
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
58
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
59
|
+
|
60
|
+
# The settings below are suggested to provide a good initial experience
|
61
|
+
# with RSpec, but feel free to customize to your heart's content.
|
62
|
+
=begin
|
63
|
+
# This allows you to limit a spec run to individual examples or groups
|
64
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
65
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
66
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
67
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
68
|
+
config.filter_run_when_matching :focus
|
69
|
+
|
70
|
+
# Allows RSpec to persist some state between runs in order to support
|
71
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
72
|
+
# you configure your source control system to ignore this file.
|
73
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
74
|
+
|
75
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
76
|
+
# recommended. For more details, see:
|
77
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
78
|
+
config.disable_monkey_patching!
|
79
|
+
|
80
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
81
|
+
# be too noisy due to issues in dependencies.
|
82
|
+
config.warnings = true
|
83
|
+
|
84
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
85
|
+
# file, and it's useful to allow more verbose output when running an
|
86
|
+
# individual spec file.
|
87
|
+
if config.files_to_run.one?
|
88
|
+
# Use the documentation formatter for detailed output,
|
89
|
+
# unless a formatter has already been configured
|
90
|
+
# (e.g. via a command-line flag).
|
91
|
+
config.default_formatter = "doc"
|
92
|
+
end
|
93
|
+
|
94
|
+
# Print the 10 slowest examples and example groups at the
|
95
|
+
# end of the spec run, to help surface which specs are running
|
96
|
+
# particularly slow.
|
97
|
+
config.profile_examples = 10
|
98
|
+
|
99
|
+
# Run specs in random order to surface order dependencies. If you find an
|
100
|
+
# order dependency and want to debug it, you can fix the order by providing
|
101
|
+
# the seed, which is printed after each run.
|
102
|
+
# --seed 1234
|
103
|
+
config.order = :random
|
104
|
+
|
105
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
106
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
107
|
+
# test failures related to randomization by passing the same `--seed` value
|
108
|
+
# as the one that triggered the failure.
|
109
|
+
Kernel.srand config.seed
|
110
|
+
=end
|
111
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.shared_context "like epp command" do
|
2
|
+
|
3
|
+
let(:instance) {
|
4
|
+
described_class.new
|
5
|
+
}
|
6
|
+
|
7
|
+
let(:raw_rendered_content) {
|
8
|
+
instance.to_s
|
9
|
+
}
|
10
|
+
let(:rendered) {
|
11
|
+
x = Nokogiri::XML(raw_rendered_content)
|
12
|
+
x.remove_namespaces! # FIXME non capisco come funzioni la ricerca con namespace
|
13
|
+
x
|
14
|
+
}
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rspec/snapshot"
|
2
|
+
require "active_support/core_ext/string"
|
3
|
+
RSpec.configure do |config|
|
4
|
+
|
5
|
+
config.snapshot_dir = "spec/fixtures/snapshots"
|
6
|
+
|
7
|
+
config.after(:each, snapshot: true) do |example|
|
8
|
+
extension=nil
|
9
|
+
extension = ".#{example.metadata[:snapshot]}" unless example.metadata[:snapshot] === true
|
10
|
+
class_name = example.metadata[:described_class].name.underscore
|
11
|
+
test_name = example.metadata[:full_description].gsub(example.metadata[:described_class].name, "").tr(" ", "_")
|
12
|
+
raise "component snapshot has no content" if raw_rendered_content.blank?
|
13
|
+
str_content = raw_rendered_content
|
14
|
+
if extension == ".xml"
|
15
|
+
str_content = Nokogiri.XML(str_content).to_xml
|
16
|
+
end
|
17
|
+
expect(str_content).to match_snapshot("#{class_name}/#{test_name}#{extension}")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
CHANGED
@@ -1,24 +1,112 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kono_epp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Bonelli
|
8
8
|
- Jury Ghidinelli
|
9
|
+
- Marino Bonetti
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
13
|
date: 2019-10-08 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '5.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '5.2'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rexml
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: nokogiri
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.10'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.10'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rspec-html-matchers
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rspec-snapshot
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
14
99
|
description: A simple EPP Client
|
15
|
-
email:
|
100
|
+
email:
|
101
|
+
- jury@archimedianet.it
|
102
|
+
- marinobonetti@gmail.com
|
16
103
|
executables: []
|
17
104
|
extensions: []
|
18
105
|
extra_rdoc_files: []
|
19
106
|
files:
|
20
107
|
- README.md
|
21
108
|
- lib/epp/epp_command.rb
|
109
|
+
- lib/epp/epp_command/check_contacts.rb
|
22
110
|
- lib/epp/epp_command/create_contact.rb
|
23
111
|
- lib/epp/epp_command/create_domain.rb
|
24
112
|
- lib/epp/epp_command/delete_contact.rb
|
@@ -26,6 +114,7 @@ files:
|
|
26
114
|
- lib/epp/epp_command/hello.rb
|
27
115
|
- lib/epp/epp_command/info_contact.rb
|
28
116
|
- lib/epp/epp_command/info_domain.rb
|
117
|
+
- lib/epp/epp_command/kono_epp_check_domains.rb
|
29
118
|
- lib/epp/epp_command/login.rb
|
30
119
|
- lib/epp/epp_command/logout.rb
|
31
120
|
- lib/epp/epp_command/poll.rb
|
@@ -39,6 +128,27 @@ files:
|
|
39
128
|
- lib/epp/transport/tcp.rb
|
40
129
|
- lib/kono_epp_client.rb
|
41
130
|
- lib/require_parameters.rb
|
131
|
+
- spec/epp/epp_command/kono_epp_check_contacts_spec.rb
|
132
|
+
- spec/epp/epp_command/kono_epp_check_domains_spec.rb
|
133
|
+
- spec/epp/epp_command/kono_epp_create_domain_spec.rb
|
134
|
+
- spec/epp/epp_command/kono_epp_transfer_domain_spec.rb
|
135
|
+
- spec/epp/epp_command/kono_epp_update_domain_spec.rb
|
136
|
+
- spec/epp/kono_epp_command_spec.rb
|
137
|
+
- spec/fixtures/snapshots/kono_epp_check_contacts/_construct.xml.snap
|
138
|
+
- spec/fixtures/snapshots/kono_epp_check_domains/_construct.xml.snap
|
139
|
+
- spec/fixtures/snapshots/kono_epp_create_domain/_create.xml.snap
|
140
|
+
- spec/fixtures/snapshots/kono_epp_transfer_domain/_con_extension_construct.xml.snap
|
141
|
+
- spec/fixtures/snapshots/kono_epp_transfer_domain/_construct.xml.snap
|
142
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap
|
143
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap
|
144
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap
|
145
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap
|
146
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap
|
147
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_status_cambia_status.xml.snap
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- spec/support/context.rb
|
150
|
+
- spec/support/matchers.rb
|
151
|
+
- spec/support/snapshot.rb
|
42
152
|
homepage: https://github.com/ArchimediaZerogroup/kono_epp_client
|
43
153
|
licenses:
|
44
154
|
- MIT
|
@@ -58,9 +168,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
168
|
- !ruby/object:Gem::Version
|
59
169
|
version: '0'
|
60
170
|
requirements: []
|
61
|
-
|
62
|
-
rubygems_version: 2.6.7
|
171
|
+
rubygems_version: 3.2.33
|
63
172
|
signing_key:
|
64
173
|
specification_version: 4
|
65
174
|
summary: Kono Epp client
|
66
|
-
test_files:
|
175
|
+
test_files:
|
176
|
+
- spec/epp/epp_command/kono_epp_check_contacts_spec.rb
|
177
|
+
- spec/epp/epp_command/kono_epp_check_domains_spec.rb
|
178
|
+
- spec/epp/epp_command/kono_epp_create_domain_spec.rb
|
179
|
+
- spec/epp/epp_command/kono_epp_transfer_domain_spec.rb
|
180
|
+
- spec/epp/epp_command/kono_epp_update_domain_spec.rb
|
181
|
+
- spec/epp/kono_epp_command_spec.rb
|
182
|
+
- spec/fixtures/snapshots/kono_epp_check_contacts/_construct.xml.snap
|
183
|
+
- spec/fixtures/snapshots/kono_epp_check_domains/_construct.xml.snap
|
184
|
+
- spec/fixtures/snapshots/kono_epp_create_domain/_create.xml.snap
|
185
|
+
- spec/fixtures/snapshots/kono_epp_transfer_domain/_con_extension_construct.xml.snap
|
186
|
+
- spec/fixtures/snapshots/kono_epp_transfer_domain/_construct.xml.snap
|
187
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_restore_esiste_l'estensione_di_restore.xml.snap
|
188
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_cambia_AUTH_INFO.xml.snap
|
189
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap
|
190
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_contacts_cambia_ADMIN_TECH.xml.snap
|
191
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap
|
192
|
+
- spec/fixtures/snapshots/kono_epp_update_domain/_update_status_cambia_status.xml.snap
|
193
|
+
- spec/spec_helper.rb
|
194
|
+
- spec/support/context.rb
|
195
|
+
- spec/support/matchers.rb
|
196
|
+
- spec/support/snapshot.rb
|