kono_epp_client 0.1.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/CHANGELOG.md +46 -0
- data/Makefile +13 -0
- data/README.md +33 -0
- data/Rakefile +6 -0
- data/kono_epp_client.gemspec +42 -0
- data/lib/kono_epp_client/VERSION +1 -0
- data/lib/kono_epp_client/commands/check_contacts.rb +19 -0
- data/lib/{epp/epp_command/kono_epp_check_domains.rb → kono_epp_client/commands/check_domains.rb} +3 -1
- data/lib/kono_epp_client/commands/command.rb +15 -0
- data/lib/kono_epp_client/commands/create_contact.rb +89 -0
- data/lib/kono_epp_client/commands/create_domain.rb +56 -0
- data/lib/kono_epp_client/commands/delete_contact.rb +17 -0
- data/lib/kono_epp_client/commands/delete_domain.rb +16 -0
- data/lib/kono_epp_client/commands/hello.rb +15 -0
- data/lib/kono_epp_client/commands/info_contact.rb +17 -0
- data/lib/kono_epp_client/commands/info_domain.rb +16 -0
- data/lib/kono_epp_client/commands/login.rb +84 -0
- data/lib/kono_epp_client/commands/logout.rb +12 -0
- data/lib/kono_epp_client/commands/poll.rb +18 -0
- data/lib/kono_epp_client/commands/transfer_domain.rb +38 -0
- data/lib/kono_epp_client/commands/update_contact.rb +116 -0
- data/lib/kono_epp_client/commands/update_domain.rb +117 -0
- data/lib/kono_epp_client/dns_sec/add.rb +13 -0
- data/lib/kono_epp_client/dns_sec/ds_data.rb +65 -0
- data/lib/kono_epp_client/dns_sec/rem.rb +14 -0
- data/lib/kono_epp_client/dns_sec/rem_all.rb +10 -0
- data/lib/kono_epp_client/exceptions/error_response.rb +19 -0
- data/lib/kono_epp_client/exceptions.rb +15 -0
- data/lib/kono_epp_client/requires_parameters.rb +16 -0
- data/lib/kono_epp_client/server.rb +311 -0
- data/lib/kono_epp_client/version.rb +3 -0
- data/lib/kono_epp_client.rb +4 -16
- data/spec/eager_load_spec.rb +6 -0
- data/spec/factories/ds_data.rb +12 -0
- data/spec/fixtures/dns_sec/add.xml +14 -0
- data/spec/fixtures/dns_sec/ds_data.xml +6 -0
- data/spec/fixtures/dns_sec/rem.xml +14 -0
- data/spec/fixtures/dns_sec/rem_all.xml +3 -0
- data/spec/fixtures/login_response.xml +23 -0
- data/spec/fixtures/login_response_for_dnssec.xml +25 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/create_domain/_create_with_ds_data_build_extensions.xml.snap +39 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_login.xml.snap +7 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_extensions_with_value_xml.xml.snap +14 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_lang_with_value_xml.xml.snap +11 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_new_password_with_value_xml.xml.snap +9 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_services_with_value_xml.xml.snap +12 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_version_with_value_xml.xml.snap +11 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/login/_with_id_and_password_login.xml.snap +10 -0
- data/spec/fixtures/snapshots/kono_epp_client/commands/update_domain/_update_DnsSec_build_extensions.xml.snap +30 -0
- data/spec/{epp/epp_command/kono_epp_check_contacts_spec.rb → lib/commands/check_contacts_spec.rb} +1 -1
- data/spec/{epp/epp_command/kono_epp_check_domains_spec.rb → lib/commands/check_domains_spec.rb} +1 -1
- data/spec/{epp/kono_epp_command_spec.rb → lib/commands/command_spec.rb} +2 -2
- data/spec/lib/commands/create_domain_spec.rb +50 -0
- data/spec/lib/commands/login_spec.rb +87 -0
- data/spec/{epp/epp_command/kono_epp_transfer_domain_spec.rb → lib/commands/transfer_domain_spec.rb} +1 -1
- data/spec/{epp/epp_command/kono_epp_update_domain_spec.rb → lib/commands/update_domain_spec.rb} +20 -4
- data/spec/lib/dns_sec/add_spec.rb +14 -0
- data/spec/lib/dns_sec/ds_data_spec.rb +43 -0
- data/spec/lib/dns_sec/rem_all_spec.rb +11 -0
- data/spec/lib/dns_sec/rem_spec.rb +14 -0
- data/spec/lib/server_spec.rb +304 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/support/context.rb +1 -1
- data/spec/support/factory_bot.rb +8 -0
- data/spec/support/fixtures.rb +16 -0
- data/spec/support/matchers.rb +14 -0
- data/spec/support/parametric.rb +1 -0
- data/spec/support/snapshot.rb +13 -3
- data/spec/support/superdiff.rb +1 -0
- metadata +178 -58
- data/lib/epp/epp_command/check_contacts.rb +0 -17
- data/lib/epp/epp_command/create_contact.rb +0 -87
- data/lib/epp/epp_command/create_domain.rb +0 -44
- data/lib/epp/epp_command/delete_contact.rb +0 -15
- data/lib/epp/epp_command/delete_domain.rb +0 -14
- data/lib/epp/epp_command/hello.rb +0 -13
- data/lib/epp/epp_command/info_contact.rb +0 -15
- data/lib/epp/epp_command/info_domain.rb +0 -14
- data/lib/epp/epp_command/login.rb +0 -79
- data/lib/epp/epp_command/logout.rb +0 -10
- data/lib/epp/epp_command/poll.rb +0 -16
- data/lib/epp/epp_command/transfer_domain.rb +0 -36
- data/lib/epp/epp_command/update_contact.rb +0 -115
- data/lib/epp/epp_command/update_domain.rb +0 -104
- data/lib/epp/epp_command.rb +0 -15
- data/lib/epp/exceptions.rb +0 -28
- data/lib/epp/server.rb +0 -295
- data/lib/epp/transport/tcp.rb +0 -93
- data/lib/require_parameters.rb +0 -14
- data/spec/epp/epp_command/kono_epp_create_domain_spec.rb +0 -37
- /data/lib/{epp/transport/http.rb → kono_epp_client/transport/http_transport.rb} +0 -0
- /data/lib/{epp → kono_epp_client}/transport.rb +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_check_contacts → kono_epp_client/commands/check_contacts}/_construct.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_check_domains → kono_epp_client/commands/check_domains}/_construct.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_create_domain → kono_epp_client/commands/create_domain}/_create.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_transfer_domain → kono_epp_client/commands/transfer_domain}/_con_extension_construct.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_transfer_domain → kono_epp_client/commands/transfer_domain}/_construct.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_restore_esiste_l'estensione_di_restore.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_auth_info_cambia_AUTH_INFO.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_auth_info_con_nuovo_registrant_cambia_REGISTRANT.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_contacts_cambia_ADMIN_TECH.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_nameservers_aggiunge_e_rimuove_ns.xml.snap +0 -0
- /data/spec/fixtures/snapshots/{kono_epp_update_domain → kono_epp_client/commands/update_domain}/_update_status_cambia_status.xml.snap +0 -0
@@ -0,0 +1,311 @@
|
|
1
|
+
module KonoEppClient #:nodoc:
|
2
|
+
class Server
|
3
|
+
include REXML
|
4
|
+
include RequiresParameters
|
5
|
+
|
6
|
+
##
|
7
|
+
# Se la risposta al login contiene questo tipo di chiave-valore, allora la comunicazione può avvenire con
|
8
|
+
# comandi aggiuntivi DNSSEC
|
9
|
+
DNS_CHECK_NS_SET = Set.new([["xmlns:secDNS", "urn:ietf:params:xml:ns:secDNS-1.1"],
|
10
|
+
["xmlns:extsecDNS", "http://www.nic.it/ITNIC-EPP/extsecDNS-1.0"]],
|
11
|
+
)
|
12
|
+
|
13
|
+
require 'nokogiri'
|
14
|
+
|
15
|
+
attr_accessor :tag, :password, :server, :port, :ssl_version, :old_server,
|
16
|
+
:services, :lang, :extensions, :version, :credit, :timeout,
|
17
|
+
:transport, :transport_options
|
18
|
+
|
19
|
+
attr_reader :dns_sec_enabled
|
20
|
+
alias_method :dns_sec_enabled?, :dns_sec_enabled
|
21
|
+
|
22
|
+
# ==== Required Attrbiutes
|
23
|
+
#
|
24
|
+
# * <tt>:server</tt> - The EPP server to connect to
|
25
|
+
# * <tt>:tag</tt> - The tag or username used with <tt><login></tt> requests.
|
26
|
+
# * <tt>:password</tt> - The password used with <tt><login></tt> requests.
|
27
|
+
#
|
28
|
+
# ==== Optional Attributes
|
29
|
+
#
|
30
|
+
# * <tt>:port</tt> - The EPP standard port is 700. However, you can choose a different port to use.
|
31
|
+
# * <tt>:clTRID</tt> - The client transaction identifier is an element that EPP specifies MAY be used to uniquely identify the command to the server. You are responsible for maintaining your own transaction identifier space to ensure uniqueness. Defaults to "ABC-12345"
|
32
|
+
# * <tt>:lang</tt> - Set custom language attribute. Default is 'en'.
|
33
|
+
# * <tt>:services</tt> - Use custom EPP services in the <login> frame. The defaults use the EPP standard domain, contact and host 1.0 services.
|
34
|
+
# * <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.
|
35
|
+
# * <tt>:version</tt> - Set the EPP version. Defaults to "1.0".
|
36
|
+
# * <tt>:transport</tt> - Type of connection (http). Default to "html"
|
37
|
+
# * <tt>:transport_options</tt> - Overrides for transport configurations. Default to {}
|
38
|
+
# * <tt>:timeout</tt> - Timeout for connections in seconds. Default to "30"
|
39
|
+
# * <tt>:ssl_version</tt> - Version of the ssl protocol versione. Default to TLSv1
|
40
|
+
# * <tt>:ssl_version</tt> - Version of the ssl protocol versione. Default to TLSv1
|
41
|
+
# * <tt>:enable_dns_sec</tt> - Try to enable DNSSEC, the response from login command will say it. default false
|
42
|
+
#
|
43
|
+
def initialize(attributes = {})
|
44
|
+
requires!(attributes, :tag, :password, :server)
|
45
|
+
|
46
|
+
@tag = attributes[:tag]
|
47
|
+
@password = attributes[:password]
|
48
|
+
@server = attributes[:server]
|
49
|
+
@port = attributes[:port] || 700
|
50
|
+
@lang = attributes[:lang] || "en"
|
51
|
+
@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"]
|
52
|
+
@extensions = attributes[:extensions] || []
|
53
|
+
@version = attributes[:version] || "1.0"
|
54
|
+
@transport = attributes[:transport] || :http
|
55
|
+
@transport_options = attributes[:transport_options] || {}
|
56
|
+
@timeout = attributes[:timeout] || 30
|
57
|
+
@ssl_version = attributes[:ssl_version] || :TLSv1
|
58
|
+
|
59
|
+
if attributes[:enable_dns_sec]
|
60
|
+
@extensions << "urn:ietf:params:xml:ns:secDNS-1.1"
|
61
|
+
@extensions << "http://www.nic.it/ITNIC-EPP/extsecDNS-1.0"
|
62
|
+
end
|
63
|
+
|
64
|
+
@logged_in = false
|
65
|
+
@dns_sec_enabled = false
|
66
|
+
end
|
67
|
+
|
68
|
+
def connect_and_hello
|
69
|
+
open_connection
|
70
|
+
|
71
|
+
hello
|
72
|
+
end
|
73
|
+
|
74
|
+
# Closes the connection to the EPP server.
|
75
|
+
def close_connection
|
76
|
+
@connection.close
|
77
|
+
end
|
78
|
+
|
79
|
+
# Sends a standard login request to the EPP server.
|
80
|
+
def login
|
81
|
+
login = Commands::Login.new(tag, password)
|
82
|
+
|
83
|
+
# FIXME: Order matters
|
84
|
+
login.version = version
|
85
|
+
login.lang = lang
|
86
|
+
|
87
|
+
login.services = services
|
88
|
+
login.extensions = extensions
|
89
|
+
|
90
|
+
response = send_command(login)
|
91
|
+
|
92
|
+
response_set = Set.new(response.namespaces.to_a)
|
93
|
+
if response_set.superset?(DNS_CHECK_NS_SET)
|
94
|
+
@dns_sec_enabled = true
|
95
|
+
end
|
96
|
+
|
97
|
+
response
|
98
|
+
end
|
99
|
+
|
100
|
+
def change_password(new_password)
|
101
|
+
login = Commands::Login.new(tag, password)
|
102
|
+
|
103
|
+
# FIXME: Order matters
|
104
|
+
login.new_password = new_password
|
105
|
+
|
106
|
+
login.version = version
|
107
|
+
login.lang = lang
|
108
|
+
|
109
|
+
login.services = services
|
110
|
+
login.extensions = extensions
|
111
|
+
|
112
|
+
send_command(login)
|
113
|
+
end
|
114
|
+
|
115
|
+
def logged_in?
|
116
|
+
begin
|
117
|
+
poll
|
118
|
+
rescue
|
119
|
+
return false
|
120
|
+
end
|
121
|
+
|
122
|
+
return true
|
123
|
+
end
|
124
|
+
|
125
|
+
# FIXME: Remove command wrappers?
|
126
|
+
def hello
|
127
|
+
send_request(Commands::Hello.new.to_s)
|
128
|
+
end
|
129
|
+
|
130
|
+
def poll(id = nil)
|
131
|
+
poll = Commands::Poll.new(id ? :ack : :req)
|
132
|
+
|
133
|
+
poll.ack_id = id if id
|
134
|
+
|
135
|
+
send_command(poll)
|
136
|
+
end
|
137
|
+
|
138
|
+
def create_contact(options)
|
139
|
+
contact = Commands::CreateContact.new options
|
140
|
+
send_command(contact)
|
141
|
+
end
|
142
|
+
|
143
|
+
def check_contacts(ids)
|
144
|
+
send_command(Commands::CheckContacts.new(ids))
|
145
|
+
end
|
146
|
+
|
147
|
+
def delete_contact(id)
|
148
|
+
contact = Commands::DeleteContact.new id
|
149
|
+
send_command(contact)
|
150
|
+
end
|
151
|
+
|
152
|
+
def update_contact(options)
|
153
|
+
contact = Commands::UpdateContact.new options
|
154
|
+
send_command(contact)
|
155
|
+
end
|
156
|
+
|
157
|
+
def create_domain(options)
|
158
|
+
dns_sec_data = options.delete(:dns_sec_data)||[]
|
159
|
+
if dns_sec_enabled?
|
160
|
+
options[:dns_sec_data] = dns_sec_data
|
161
|
+
end
|
162
|
+
domain = Commands::CreateDomain.new options
|
163
|
+
send_command(domain)
|
164
|
+
end
|
165
|
+
|
166
|
+
def check_domains(*domains)
|
167
|
+
send_command(Commands::CheckDomains.new *domains)
|
168
|
+
end
|
169
|
+
|
170
|
+
def update_domain(options)
|
171
|
+
dns_sec_data = options.delete(:dns_sec_data)||[]
|
172
|
+
if dns_sec_enabled?
|
173
|
+
options[:dns_sec_data] = dns_sec_data
|
174
|
+
end
|
175
|
+
domain = Commands::UpdateDomain.new options
|
176
|
+
send_command(domain)
|
177
|
+
end
|
178
|
+
|
179
|
+
def delete_domain(name)
|
180
|
+
domain = Commands::DeleteDomain.new name
|
181
|
+
send_command(domain)
|
182
|
+
end
|
183
|
+
|
184
|
+
def info_contact(id)
|
185
|
+
contact = Commands::InfoContact.new id
|
186
|
+
send_command(contact)
|
187
|
+
end
|
188
|
+
|
189
|
+
def info_domain(name)
|
190
|
+
info = Commands::InfoDomain.new name
|
191
|
+
send_command(info)
|
192
|
+
end
|
193
|
+
|
194
|
+
def transfer_domain(name, authinfo, op, extension: nil)
|
195
|
+
send_command(Commands::TransferDomain.new(name, authinfo, op, extension: extension))
|
196
|
+
end
|
197
|
+
|
198
|
+
# Sends a standard logout request to the EPP server.
|
199
|
+
def logout
|
200
|
+
send_command(Commands::Logout.new, 1500)
|
201
|
+
end
|
202
|
+
|
203
|
+
# private
|
204
|
+
# Wrapper which sends XML to the server, and receives
|
205
|
+
# the response in return.
|
206
|
+
def send_request(xml)
|
207
|
+
write(xml)
|
208
|
+
read
|
209
|
+
end
|
210
|
+
|
211
|
+
def send_command(command, expected_result = 1000..1999)
|
212
|
+
namespaces = {'extepp' => 'http://www.nic.it/ITNIC-EPP/extepp-2.0',
|
213
|
+
'xmlns' => "urn:ietf:params:xml:ns:epp-1.0"}
|
214
|
+
|
215
|
+
xml = Nokogiri.XML(send_request(command.to_s))
|
216
|
+
|
217
|
+
# TODO: multiple <response> RFC 3730 §2.6
|
218
|
+
result = xml.at_xpath("/xmlns:epp/xmlns:response[1]/xmlns:result",
|
219
|
+
namespaces)
|
220
|
+
raise Exceptions::ErrorResponse.new(:message => 'Malformed response') if result.nil?
|
221
|
+
|
222
|
+
xmlns_code = result.at_xpath("@code")
|
223
|
+
raise Exceptions::ErrorResponse.new(:message => 'Malformed response') if xmlns_code.nil?
|
224
|
+
|
225
|
+
response_code = xmlns_code.value.to_i
|
226
|
+
|
227
|
+
xmlns_msg = result.xpath("xmlns:msg/text ()",
|
228
|
+
namespaces)
|
229
|
+
raise Exceptions::ErrorResponse.new(:message => 'Malformed response') if xmlns_msg.empty?
|
230
|
+
|
231
|
+
result_message = xmlns_msg.text.strip
|
232
|
+
|
233
|
+
# TODO: value
|
234
|
+
|
235
|
+
xmlns_ext_reason = result.xpath("xmlns:extValue/xmlns:reason",
|
236
|
+
namespaces)
|
237
|
+
result_message += ": #{xmlns_ext_reason.text.strip}" unless xmlns_ext_reason.empty?
|
238
|
+
|
239
|
+
xmlns_reason_code = result.xpath("xmlns:extValue/xmlns:value/extepp:reasonCode",
|
240
|
+
namespaces)
|
241
|
+
reason_code = xmlns_reason_code.text.strip.to_i unless xmlns_reason_code.empty?
|
242
|
+
|
243
|
+
credit_msg = xml.xpath("//extepp:credit/text ()", namespaces)
|
244
|
+
@credit = credit_msg.text.to_f unless credit_msg.empty?
|
245
|
+
|
246
|
+
if expected_result === response_code
|
247
|
+
return xml
|
248
|
+
end
|
249
|
+
|
250
|
+
args = {:xml => xml,
|
251
|
+
:response_code => response_code,
|
252
|
+
:reason_code => reason_code,
|
253
|
+
:message => result_message}
|
254
|
+
|
255
|
+
case [response_code, reason_code]
|
256
|
+
when [2200, 6004]
|
257
|
+
raise Exceptions::AuthenticationPasswordExpired.new(args)
|
258
|
+
when [2002, 4015]
|
259
|
+
raise Exceptions::LoginNeeded.new(args)
|
260
|
+
when [2304, 9022]
|
261
|
+
raise Exceptions::DomainHasStatusCliTransProhibited.new(args)
|
262
|
+
when [2304, 9026]
|
263
|
+
raise Exceptions::DomainHasStatusClientUpdateProhibited.new(args)
|
264
|
+
else
|
265
|
+
raise Exceptions::ErrorResponse.new(args)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
# Establishes the connection to the server. If the connection is
|
270
|
+
# established, then this method will call read and return
|
271
|
+
# the EPP <tt><greeting></tt> which is sent by the
|
272
|
+
# server upon connection.
|
273
|
+
def open_connection
|
274
|
+
# FIXME il timeout serve solamente nella versione tcp
|
275
|
+
# FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport
|
276
|
+
# e successivamente viene utilizzato sempre quello?
|
277
|
+
Timeout.timeout @timeout do
|
278
|
+
case @transport
|
279
|
+
when :http
|
280
|
+
|
281
|
+
options = {
|
282
|
+
ssl_version: ssl_version,
|
283
|
+
cookie_file: "#{@tag.downcase}.cookies.pstore"
|
284
|
+
}.merge(@transport_options)
|
285
|
+
|
286
|
+
@connection = KonoEppClient::Transport::HttpTransport.new(server, port, **options)
|
287
|
+
else
|
288
|
+
raise "Not Implemented #{@transport}"
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# Receive an EPP response from the server. Since the connection is blocking,
|
294
|
+
# this method will wait until the connection becomes available for use. If
|
295
|
+
# the connection is broken, a SocketError will be raised. Otherwise,
|
296
|
+
# it will return a string containing the XML from the server.
|
297
|
+
def read
|
298
|
+
Timeout.timeout @timeout do
|
299
|
+
@connection.read
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
# Send XML to the server. If the socket returns EOF,
|
304
|
+
# the connection has closed and a SocketError is raised.
|
305
|
+
def write(xml)
|
306
|
+
Timeout.timeout @timeout do
|
307
|
+
@connection.write(xml)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
data/lib/kono_epp_client.rb
CHANGED
@@ -2,24 +2,12 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'openssl'
|
4
4
|
require 'socket'
|
5
|
-
require 'active_support'
|
5
|
+
require 'active_support/all'
|
6
6
|
require 'rexml/document'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/epp/exceptions.rb'
|
12
|
-
|
13
|
-
require File.dirname(__FILE__) + '/epp/transport.rb'
|
14
|
-
require File.dirname(__FILE__) + '/epp/transport/tcp.rb'
|
15
|
-
require File.dirname(__FILE__) + '/epp/transport/http.rb'
|
16
|
-
|
17
|
-
require File.dirname(__FILE__) + '/epp/epp_command.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
|
8
|
+
require "zeitwerk"
|
9
|
+
loader = Zeitwerk::Loader.for_gem
|
10
|
+
loader.setup
|
23
11
|
|
24
12
|
module KonoEppClient #:nodoc:
|
25
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :ds_data, class: "KonoEppClient::DnsSec::DsData" do
|
3
|
+
skip_create
|
4
|
+
|
5
|
+
key_tag { 123 }
|
6
|
+
alg { :dsa_sha_1 }
|
7
|
+
digest_type { :sha_1 }
|
8
|
+
digest { "4347d0f8ba661234a8eadc005e2e1d1b646c9682" }
|
9
|
+
|
10
|
+
initialize_with { new(key_tag, alg, digest_type, digest) }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<secDNS:add>
|
2
|
+
<secDNS:dsData>
|
3
|
+
<secDNS:keyTag>1234</secDNS:keyTag>
|
4
|
+
<secDNS:alg>3</secDNS:alg>
|
5
|
+
<secDNS:digestType>1</secDNS:digestType>
|
6
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
7
|
+
</secDNS:dsData>
|
8
|
+
<secDNS:dsData>
|
9
|
+
<secDNS:keyTag>4321</secDNS:keyTag>
|
10
|
+
<secDNS:alg>3</secDNS:alg>
|
11
|
+
<secDNS:digestType>1</secDNS:digestType>
|
12
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
13
|
+
</secDNS:dsData>
|
14
|
+
</secDNS:add>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<secDNS:rem>
|
2
|
+
<secDNS:dsData>
|
3
|
+
<secDNS:keyTag>1234</secDNS:keyTag>
|
4
|
+
<secDNS:alg>3</secDNS:alg>
|
5
|
+
<secDNS:digestType>1</secDNS:digestType>
|
6
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
7
|
+
</secDNS:dsData>
|
8
|
+
<secDNS:dsData>
|
9
|
+
<secDNS:keyTag>4321</secDNS:keyTag>
|
10
|
+
<secDNS:alg>3</secDNS:alg>
|
11
|
+
<secDNS:digestType>1</secDNS:digestType>
|
12
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
13
|
+
</secDNS:dsData>
|
14
|
+
</secDNS:rem>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<epp
|
3
|
+
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
|
4
|
+
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
|
5
|
+
xmlns:extepp="http://www.nic.it/ITNIC-EPP/extepp-2.0"
|
6
|
+
xmlns:extdom="http://www.nic.it/ITNIC-EPP/extdom-2.0"
|
7
|
+
xmlns:extcon="http://www.nic.it/ITNIC-EPP/extcon-1.0"
|
8
|
+
xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0"
|
9
|
+
xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
10
|
+
<response>
|
11
|
+
<result code="1000">
|
12
|
+
<msg lang="en">Command completed successfully</msg>
|
13
|
+
</result>
|
14
|
+
<extension>
|
15
|
+
<extepp:creditMsgData>
|
16
|
+
<extepp:credit>48739.112</extepp:credit>
|
17
|
+
</extepp:creditMsgData>
|
18
|
+
</extension>
|
19
|
+
<trID>
|
20
|
+
<svTRID>898b1da3-e544-4c47-9251-6f621d4ae37a</svTRID>
|
21
|
+
</trID>
|
22
|
+
</response>
|
23
|
+
</epp>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<epp
|
3
|
+
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
|
4
|
+
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
|
5
|
+
xmlns:extepp="http://www.nic.it/ITNIC-EPP/extepp-2.0"
|
6
|
+
xmlns:extdom="http://www.nic.it/ITNIC-EPP/extdom-2.0"
|
7
|
+
xmlns:extcon="http://www.nic.it/ITNIC-EPP/extcon-1.0"
|
8
|
+
xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0"
|
9
|
+
xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
|
10
|
+
xmlns:extsecDNS="http://www.nic.it/ITNIC-EPP/extsecDNS-1.0"
|
11
|
+
xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
12
|
+
<response>
|
13
|
+
<result code="1000">
|
14
|
+
<msg lang="en">Command completed successfully</msg>
|
15
|
+
</result>
|
16
|
+
<extension>
|
17
|
+
<extepp:creditMsgData>
|
18
|
+
<extepp:credit>48739.112</extepp:credit>
|
19
|
+
</extepp:creditMsgData>
|
20
|
+
</extension>
|
21
|
+
<trID>
|
22
|
+
<svTRID>898b1da3-e544-4c47-9251-6f621d4ae37a</svTRID>
|
23
|
+
</trID>
|
24
|
+
</response>
|
25
|
+
</epp>
|
@@ -0,0 +1,39 @@
|
|
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
|
+
<extension>
|
29
|
+
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
30
|
+
<secDNS:dsData>
|
31
|
+
<secDNS:keyTag>9657</secDNS:keyTag>
|
32
|
+
<secDNS:alg>3</secDNS:alg>
|
33
|
+
<secDNS:digestType>1</secDNS:digestType>
|
34
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
35
|
+
</secDNS:dsData>
|
36
|
+
</secDNS:create>
|
37
|
+
</extension>
|
38
|
+
</command>
|
39
|
+
</epp>
|
@@ -0,0 +1,7 @@
|
|
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
|
+
<login/>
|
5
|
+
<clTRID>ABC-12345</clTRID>
|
6
|
+
</command>
|
7
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_extensions_with_value_xml.xml.snap
ADDED
@@ -0,0 +1,14 @@
|
|
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
|
+
<login>
|
5
|
+
<svcs>
|
6
|
+
<svcExtension>
|
7
|
+
<extURI>http://uri1.com/valore1</extURI>
|
8
|
+
<extURI>http://uri2.com/valore2</extURI>
|
9
|
+
</svcExtension>
|
10
|
+
</svcs>
|
11
|
+
</login>
|
12
|
+
<clTRID>ABC-12345</clTRID>
|
13
|
+
</command>
|
14
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_lang_with_value_xml.xml.snap
ADDED
@@ -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
|
+
<login>
|
5
|
+
<options>
|
6
|
+
<lang>en</lang>
|
7
|
+
</options>
|
8
|
+
</login>
|
9
|
+
<clTRID>ABC-12345</clTRID>
|
10
|
+
</command>
|
11
|
+
</epp>
|
@@ -0,0 +1,9 @@
|
|
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
|
+
<login>
|
5
|
+
<newPW>password</newPW>
|
6
|
+
</login>
|
7
|
+
<clTRID>ABC-12345</clTRID>
|
8
|
+
</command>
|
9
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_services_with_value_xml.xml.snap
ADDED
@@ -0,0 +1,12 @@
|
|
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
|
+
<login>
|
5
|
+
<svcs>
|
6
|
+
<objURI>valore1</objURI>
|
7
|
+
<objURI>valore2</objURI>
|
8
|
+
</svcs>
|
9
|
+
</login>
|
10
|
+
<clTRID>ABC-12345</clTRID>
|
11
|
+
</command>
|
12
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_client/commands/login/_tags_version_with_value_xml.xml.snap
ADDED
@@ -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
|
+
<login>
|
5
|
+
<options>
|
6
|
+
<version>1.0</version>
|
7
|
+
</options>
|
8
|
+
</login>
|
9
|
+
<clTRID>ABC-12345</clTRID>
|
10
|
+
</command>
|
11
|
+
</epp>
|
data/spec/fixtures/snapshots/kono_epp_client/commands/login/_with_id_and_password_login.xml.snap
ADDED
@@ -0,0 +1,10 @@
|
|
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
|
+
<login>
|
5
|
+
<clID>12</clID>
|
6
|
+
<pw>password</pw>
|
7
|
+
</login>
|
8
|
+
<clTRID>ABC-12345</clTRID>
|
9
|
+
</command>
|
10
|
+
</epp>
|
@@ -0,0 +1,30 @@
|
|
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
|
+
<secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
11
|
+
<secDNS:add>
|
12
|
+
<secDNS:dsData>
|
13
|
+
<secDNS:keyTag>9657</secDNS:keyTag>
|
14
|
+
<secDNS:alg>3</secDNS:alg>
|
15
|
+
<secDNS:digestType>1</secDNS:digestType>
|
16
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
17
|
+
</secDNS:dsData>
|
18
|
+
</secDNS:add>
|
19
|
+
<secDNS:rem>
|
20
|
+
<secDNS:dsData>
|
21
|
+
<secDNS:keyTag>1685</secDNS:keyTag>
|
22
|
+
<secDNS:alg>3</secDNS:alg>
|
23
|
+
<secDNS:digestType>1</secDNS:digestType>
|
24
|
+
<secDNS:digest>4347d0f8ba661234a8eadc005e2e1d1b646c9682</secDNS:digest>
|
25
|
+
</secDNS:dsData>
|
26
|
+
</secDNS:rem>
|
27
|
+
</secDNS:update>
|
28
|
+
</extension>
|
29
|
+
</command>
|
30
|
+
</epp>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rexml/document'
|
3
3
|
|
4
|
-
RSpec.describe
|
4
|
+
RSpec.describe KonoEppClient::Commands::Command do
|
5
5
|
it 'generates a valid XML document with the expected structure' do
|
6
|
-
xml_document =
|
6
|
+
xml_document = KonoEppClient::Commands::Command.new
|
7
7
|
expect(xml_document).to be_a(REXML::Document)
|
8
8
|
expect(xml_document.to_s).to include("xsi:schemaLocation='urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd'")
|
9
9
|
expect(xml_document.to_s).to include("xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'")
|