kono_epp_client 0.1.1 → 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 +29 -0
- data/Makefile +13 -0
- data/README.md +20 -3
- data/kono_epp_client.gemspec +4 -1
- data/lib/kono_epp_client/VERSION +1 -1
- 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/{epp → kono_epp_client}/server.rb +63 -55
- 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 +12 -2
- metadata +157 -60
- 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/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/spec/epp/server_spec.rb +0 -69
- /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
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'")
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppClient::Commands::CreateDomain do
|
4
|
+
include_context "like epp command"
|
5
|
+
|
6
|
+
let(:opts) {
|
7
|
+
{
|
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
|
+
let(:instance) { KonoEppClient::Commands::CreateDomain.new(opts) }
|
23
|
+
|
24
|
+
it "create", snapshot: "xml" do
|
25
|
+
expect(rendered.to_s).to have_tag("ns")
|
26
|
+
expect(rendered.to_s.downcase).to have_tag("hostattr")
|
27
|
+
expect(rendered.to_s.downcase).to have_tag("ns hostattr") do
|
28
|
+
with_tag("hostname", text: "ns2.test.it")
|
29
|
+
with_tag("hostaddr", text: "192.168.100.20", with: {ip: "v4"})
|
30
|
+
end
|
31
|
+
expect(rendered.to_s.downcase).to have_tag("ns hostattr") do
|
32
|
+
with_tag("hostname", text: "ns.test.it")
|
33
|
+
with_tag("hostaddr", text: "192.168.100.10", with: {ip: "v4"})
|
34
|
+
end
|
35
|
+
expect(rendered.to_s.downcase).not_to have_tag("ns hostaddr", with: {ip: 'v4'}, text: "")
|
36
|
+
end
|
37
|
+
|
38
|
+
context "create with ds_data" do
|
39
|
+
|
40
|
+
let(:opts) {
|
41
|
+
super().merge(dns_sec_data: [create(:ds_data, key_tag: 9657)])
|
42
|
+
}
|
43
|
+
|
44
|
+
it "build extensions", snapshot: "xml" do
|
45
|
+
expect(rendered.to_s).to have_tag("extension>create>dsdata>keytag", text: 9657)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe KonoEppClient::Commands::Login do
|
4
|
+
include_context "like epp command"
|
5
|
+
|
6
|
+
let(:args) { [] }
|
7
|
+
|
8
|
+
let(:instance) {
|
9
|
+
KonoEppClient::Commands::Login.new(*args)
|
10
|
+
}
|
11
|
+
subject(:xml) { rendered.to_s }
|
12
|
+
|
13
|
+
it "login", snapshot: "xml" do
|
14
|
+
is_expected.to have_tag("command") do
|
15
|
+
with_tag(:login)
|
16
|
+
with_tag("cltrid", text: "ABC-12345")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with id and password" do
|
21
|
+
let(:args) { ["12", "password"] }
|
22
|
+
it "login", snapshot: "xml" do
|
23
|
+
is_expected.to have_tag("command") do
|
24
|
+
with_tag(:login) do
|
25
|
+
with_tag("clid", text: "12")
|
26
|
+
with_tag("pw", text: "password")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "tags" do
|
33
|
+
where(:case_name, :method, :tag_matcher, :value, :no_value, :getter) do
|
34
|
+
[
|
35
|
+
[:lang, :lang, have_tag("command>login>options>lang", text: "en"), "en", nil, true],
|
36
|
+
[:version, :version, have_tag("command>login>options>version", text: "1.0"), "1.0", nil, true],
|
37
|
+
[:new_password, :new_password, have_tag("command>login>newpw", text: "password"), "password", nil, false],
|
38
|
+
|
39
|
+
[:services, :services,
|
40
|
+
lazy {
|
41
|
+
have_tag("command>login>svcs") do
|
42
|
+
with_tag("objuri", count: 2)
|
43
|
+
with_tag("objuri", text: "valore1")
|
44
|
+
end
|
45
|
+
}, ["valore1", "valore2"], [], true],
|
46
|
+
|
47
|
+
[
|
48
|
+
:extensions, :extensions,
|
49
|
+
lazy {
|
50
|
+
have_tag("command>login>svcs>svcextension") do
|
51
|
+
with_tag("exturi", count: 2)
|
52
|
+
with_tag("exturi", text: "http://uri1.com/valore1")
|
53
|
+
end
|
54
|
+
}, ["http://uri1.com/valore1", "http://uri2.com/valore2"],
|
55
|
+
[],
|
56
|
+
true
|
57
|
+
]
|
58
|
+
|
59
|
+
]
|
60
|
+
end
|
61
|
+
|
62
|
+
with_them do
|
63
|
+
|
64
|
+
subject { instance.send(method) }
|
65
|
+
it "getter" do
|
66
|
+
if getter
|
67
|
+
is_expected.to eq no_value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "with value" do
|
72
|
+
let(:instance) {
|
73
|
+
super().tap { |e| e.send("#{method}=", value) }
|
74
|
+
}
|
75
|
+
it "getter" do
|
76
|
+
if getter
|
77
|
+
is_expected.to be == value
|
78
|
+
end
|
79
|
+
end
|
80
|
+
it "xml", snapshot: "xml" do
|
81
|
+
expect(xml).to tag_matcher
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
data/spec/{epp/epp_command/kono_epp_update_domain_spec.rb → lib/commands/update_domain_spec.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe KonoEppClient::Commands::UpdateDomain do
|
4
4
|
|
5
5
|
let(:options) do
|
6
6
|
{
|
@@ -19,7 +19,7 @@ RSpec.describe KonoEppUpdateDomain do
|
|
19
19
|
include_context "like epp command"
|
20
20
|
|
21
21
|
let(:instance) {
|
22
|
-
|
22
|
+
KonoEppClient::Commands::UpdateDomain.new(options)
|
23
23
|
}
|
24
24
|
|
25
25
|
it "contiene il nome del dominio" do
|
@@ -46,7 +46,7 @@ RSpec.describe KonoEppUpdateDomain do
|
|
46
46
|
expect(rendered.to_s.downcase).to have_tag("update>add>ns") do
|
47
47
|
with_tag("hostattr") do
|
48
48
|
with_tag("hostname", text: 'ns3.example.com')
|
49
|
-
without_tag("hostaddr",text:"")
|
49
|
+
without_tag("hostaddr", text: "")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
expect(rendered.to_s.downcase).to have_tag("update>rem>ns") do
|
@@ -92,7 +92,7 @@ RSpec.describe KonoEppUpdateDomain do
|
|
92
92
|
restore: true
|
93
93
|
})
|
94
94
|
}
|
95
|
-
it "esiste l'estensione di restore",snapshot: 'xml' do
|
95
|
+
it "esiste l'estensione di restore", snapshot: 'xml' do
|
96
96
|
expect(rendered.to_s.downcase).to have_tag("extension>update>restore", with: {op: "request"})
|
97
97
|
end
|
98
98
|
end
|
@@ -122,4 +122,20 @@ RSpec.describe KonoEppUpdateDomain do
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
+
describe "update DnsSec" do
|
126
|
+
let(:options) {
|
127
|
+
super().merge(dns_sec_data: [
|
128
|
+
KonoEppClient::DnsSec::Add.new(create(:ds_data, key_tag: 9657)),
|
129
|
+
KonoEppClient::DnsSec::Rem.new(create(:ds_data, key_tag: 1685))
|
130
|
+
])
|
131
|
+
}
|
132
|
+
|
133
|
+
it "build extensions", snapshot: "xml" do
|
134
|
+
expect(rendered.to_s).to have_tag("extension>update>add>dsdata>keytag", text: 9657)
|
135
|
+
expect(rendered.to_s).to have_tag("extension>update>rem>dsdata>keytag", text: 1685)
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
end
|
140
|
+
|
125
141
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
RSpec.describe KonoEppClient::DnsSec::DsData do
|
2
|
+
|
3
|
+
let(:instance) {
|
4
|
+
KonoEppClient::DnsSec::Add.new(
|
5
|
+
create(:ds_data,key_tag:"1234"),
|
6
|
+
create(:ds_data,key_tag:"4321"),
|
7
|
+
)
|
8
|
+
}
|
9
|
+
|
10
|
+
it "#to_s" do
|
11
|
+
expect(instance.to_s).to match(xml_fixture("dns_sec/add.xml"))
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
RSpec.describe KonoEppClient::DnsSec::DsData do
|
2
|
+
|
3
|
+
let(:instance) {
|
4
|
+
KonoEppClient::DnsSec::DsData.new(123, :dsa_sha_1, :sha_1, "digest")
|
5
|
+
}
|
6
|
+
|
7
|
+
it "valid instance" do
|
8
|
+
expect(instance).to have_attributes(key_tag: 123, alg: 3, digest_type: 1, digest: "digest")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "instantiate" do
|
12
|
+
where(:case_name, :values, :expectation) do
|
13
|
+
[
|
14
|
+
[
|
15
|
+
:key_tag_to_low,
|
16
|
+
[-1, :dsa_sha_1, :sha_1, "digest"],
|
17
|
+
"Invalid key tag -1, should be 0<=key_tag<=65535"
|
18
|
+
], [
|
19
|
+
:key_tag_to_hight,
|
20
|
+
[1_000_000, :dsa_sha_1, :sha_1, "digest"],
|
21
|
+
"Invalid key tag 1000000, should be 0<=key_tag<=65535"
|
22
|
+
], [
|
23
|
+
:digest_type,
|
24
|
+
[123, :dsa_sha_1, :non_presente, "digest"],
|
25
|
+
"Invalid digest type non_presente"
|
26
|
+
], [
|
27
|
+
:alg,
|
28
|
+
[1_000_000, :non_presente, :sha_1, "digest"],
|
29
|
+
"Invalid alg non_presente"
|
30
|
+
],
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
with_them do
|
35
|
+
it { expect { KonoEppClient::DnsSec::DsData.new(*values) }.to raise_error(expectation) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "#to_s" do
|
40
|
+
expect(instance.to_s).to match(xml_fixture("dns_sec/ds_data.xml"))
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
RSpec.describe KonoEppClient::DnsSec::DsData do
|
2
|
+
|
3
|
+
let(:instance) {
|
4
|
+
KonoEppClient::DnsSec::Rem.new(
|
5
|
+
create(:ds_data, key_tag: "1234"),
|
6
|
+
create(:ds_data, key_tag: "4321"),
|
7
|
+
)
|
8
|
+
}
|
9
|
+
|
10
|
+
it "#to_s" do
|
11
|
+
expect(instance.to_s).to match(xml_fixture("dns_sec/rem.xml"))
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|