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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6587e5c8fc519199d40867dfa03a303ff43a922aad7c6cc0fd1c57e080b6adb5
|
4
|
+
data.tar.gz: 165768be12769b819d7f90bb3b0a5b8787138f112c53f3ff7c25fbf5d8e70a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398d9ae8bd100839ebaf86f3d8ba5defeffac49ebcd799133d37fdd72836f10be8554227ad3084b4465ba03d3684ee03cba5467646412dba9634ced6d6df90ea
|
7
|
+
data.tar.gz: 39be87b716840f4713cbd9bb1beb0f1eec93273c3d0cb42d85a174a0103972324b4fdca2bfba36ec32c3d3c6369d977409c3baefaf5fcffec919e95da22aaf09
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
3
|
+
|
4
|
+
- - -
|
5
|
+
## 2.0.0 - 2025-03-14
|
6
|
+
#### Documentation
|
7
|
+
- Aggiornamento documentazione deploy - (d97e28b) - Marino Bonetti
|
8
|
+
#### Features
|
9
|
+
- Dns sec enabler (#4) - (05fe060) - Marino Bonetti
|
10
|
+
- Complete remove old untrusted TCP connection - (25dc6b1) - Marino Bonetti
|
11
|
+
#### Miscellaneous Chores
|
12
|
+
- Add Makefile to simplify dev - (c00d3e7) - Marino Bonetti
|
13
|
+
- Installa parametric spec - (b858134) - Marino Bonetti
|
14
|
+
- Comandi server per update e create - (580461f) - Marino Bonetti
|
15
|
+
- Aggiunto debug - (c0f883b) - Marino Bonetti
|
16
|
+
- Mancanza Dockerfile - (1b250af) - Marino Bonetti
|
17
|
+
#### Tests
|
18
|
+
- Remove spec from converage - (11e0614) - Marino Bonetti
|
19
|
+
- Fix correct name generation - (83fa9a5) - Marino Bonetti
|
20
|
+
- Add test to login command - (a71a366) - Marino Bonetti
|
21
|
+
- Correct docs and add branch_coverage - (ab5104c) - Marino Bonetti
|
22
|
+
- Fix coverage and eager loading check - (9827181) - Marino Bonetti
|
23
|
+
- Matcher Xpath - (049c2db) - Marino Bonetti
|
24
|
+
- Add test for standard login - (1f9169a) - Marino Bonetti
|
25
|
+
|
26
|
+
- - -
|
27
|
+
|
28
|
+
## 1.0.0 - 2025-03-12
|
29
|
+
#### Refactoring
|
30
|
+
- Rewrite correct class names - (6df7a34) - Marino Bonetti
|
31
|
+
|
32
|
+
- - -
|
33
|
+
|
34
|
+
## 0.1.1 - 2024-05-23
|
35
|
+
#### Continuous Integration
|
36
|
+
- Cog typo - (f91c1b9) - Marino Bonetti
|
37
|
+
#### Features
|
38
|
+
- Add configuration options for transport - (d83d723) - Marino Bonetti
|
39
|
+
#### Miscellaneous Chores
|
40
|
+
- Configuration for development and deploy - (563edac) - Marino Bonetti
|
41
|
+
#### Tests
|
42
|
+
- Fix methods non present in std - (e0393ff) - Marino Bonetti
|
43
|
+
|
44
|
+
- - -
|
45
|
+
|
46
|
+
Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto).
|
data/Makefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
vpath %.touch ./tmp
|
2
|
+
|
3
|
+
test: install.touch
|
4
|
+
docker compose run --rm --remove-orphans app bundle exec rspec $(spec)
|
5
|
+
|
6
|
+
install.touch: Gemfile image_build.touch
|
7
|
+
docker compose run app bundle
|
8
|
+
touch tmp/install.touch
|
9
|
+
|
10
|
+
image_build.touch: Dockerfile
|
11
|
+
mkdir -p tmp
|
12
|
+
docker compose build
|
13
|
+
touch tmp/image_build.touch
|
data/README.md
CHANGED
@@ -1,2 +1,35 @@
|
|
1
1
|
# kono_epp_client
|
2
|
+
|
2
3
|
A simple EPP Client
|
4
|
+
|
5
|
+
## Development
|
6
|
+
|
7
|
+
Build dell'immagine di docker
|
8
|
+
|
9
|
+
```shell
|
10
|
+
docker compose build
|
11
|
+
```
|
12
|
+
|
13
|
+
Installazione dipendenze
|
14
|
+
|
15
|
+
```shell
|
16
|
+
docker compose run app bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Run rspec
|
20
|
+
|
21
|
+
```shell
|
22
|
+
docker compose run app bundle exec rspec
|
23
|
+
```
|
24
|
+
|
25
|
+
Oppure con Makefile:
|
26
|
+
|
27
|
+
```shell
|
28
|
+
make
|
29
|
+
```
|
30
|
+
|
31
|
+
## Release
|
32
|
+
Il processo è completamente automatizzato, preparare la chiave OTP per rubygems
|
33
|
+
```shell
|
34
|
+
cog bump --auto
|
35
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative "lib/kono_epp_client/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'kono_epp_client'
|
5
|
+
s.version = KonoEppClient::VERSION
|
6
|
+
s.date = '2019-10-08'
|
7
|
+
s.summary = "Kono Epp client"
|
8
|
+
s.description = "A simple EPP Client"
|
9
|
+
s.authors = ["Fabio Bonelli", "Jury Ghidinelli", "Marino Bonetti"]
|
10
|
+
s.email = ['jury@archimedianet.it', 'marinobonetti@gmail.com']
|
11
|
+
s.homepage = 'https://github.com/ArchimediaZerogroup/kono_epp_client'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.required_ruby_version = ">= 2.7"
|
14
|
+
|
15
|
+
s.files = Dir.chdir(__dir__) do
|
16
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
(File.expand_path(f) == __FILE__) ||
|
18
|
+
f.start_with?(*[
|
19
|
+
"bin/", "test/", "spec/", "features/",
|
20
|
+
".git", ".gitlab-ci.yml", "appveyor", "Gemfile",
|
21
|
+
"cog.toml", "docker-compose.yml", "Dockerfile",
|
22
|
+
".rspec", ".rubocop.yml"
|
23
|
+
])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
files = `git ls-files -z`.split("\x0")
|
28
|
+
s.test_files = files.grep(%r{^(spec)/})
|
29
|
+
|
30
|
+
s.add_dependency 'activesupport', '>= 5.2'
|
31
|
+
s.add_dependency 'rexml'
|
32
|
+
s.add_dependency 'nokogiri', '>= 1.10'
|
33
|
+
s.add_dependency 'zeitwerk'
|
34
|
+
|
35
|
+
s.add_development_dependency "rspec"
|
36
|
+
s.add_development_dependency "super_diff"
|
37
|
+
s.add_development_dependency "rspec-html-matchers"
|
38
|
+
s.add_development_dependency 'rspec-snapshot'
|
39
|
+
s.add_development_dependency 'debug'
|
40
|
+
s.add_development_dependency 'factory_bot'
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class CheckContacts < Command
|
3
|
+
def initialize(ids)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
|
8
|
+
info = command.add_element "check"
|
9
|
+
|
10
|
+
contact_check = info.add_element("contact:check", {"xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0"})
|
11
|
+
|
12
|
+
ids.each do |t|
|
13
|
+
contact_id = contact_check.add_element "contact:id"
|
14
|
+
contact_id.text = t
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/{epp/epp_command/kono_epp_check_domains.rb → kono_epp_client/commands/check_domains.rb}
RENAMED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
module KonoEppClient::Commands
|
2
3
|
|
3
|
-
class
|
4
|
+
class CheckDomains < Command
|
4
5
|
def initialize( *domains )
|
5
6
|
super( nil, nil )
|
6
7
|
|
@@ -16,3 +17,4 @@ class KonoEppCheckDomains < KonoEppCommand
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class Command < ::REXML::Document
|
3
|
+
def initialize(source = nil, context = nil)
|
4
|
+
super(source, context)
|
5
|
+
|
6
|
+
add(::REXML::XMLDecl.new("1.0", "UTF-8", "no"))
|
7
|
+
|
8
|
+
epp = add_element("epp", {"xmlns" => "urn:ietf:params:xml:ns:epp-1.0",
|
9
|
+
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
|
10
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"})
|
11
|
+
|
12
|
+
epp.add_element("command")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class CreateContact < Command
|
3
|
+
def initialize(options)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
|
8
|
+
create = command.add_element "create"
|
9
|
+
|
10
|
+
contact_create = create.add_element("contact:create", {"xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0",
|
11
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"})
|
12
|
+
|
13
|
+
puts options
|
14
|
+
id = contact_create.add_element "contact:id"
|
15
|
+
id.text = options[:id]
|
16
|
+
|
17
|
+
postal_info = contact_create.add_element "contact:postalInfo", {"type" => "loc"}
|
18
|
+
|
19
|
+
name = postal_info.add_element "contact:name"
|
20
|
+
name.text = options[:name]
|
21
|
+
|
22
|
+
unless options[:organization].blank?
|
23
|
+
organization = postal_info.add_element "contact:org"
|
24
|
+
organization.text = options[:organization]
|
25
|
+
end
|
26
|
+
|
27
|
+
addr = postal_info.add_element "contact:addr"
|
28
|
+
|
29
|
+
unless options[:street].blank?
|
30
|
+
street = addr.add_element "contact:street"
|
31
|
+
street.text = options[:street]
|
32
|
+
end
|
33
|
+
|
34
|
+
city = addr.add_element "contact:city"
|
35
|
+
city.text = options[:city]
|
36
|
+
|
37
|
+
unless options[:state].blank?
|
38
|
+
state = addr.add_element "contact:sp"
|
39
|
+
state.text = options[:state]
|
40
|
+
end
|
41
|
+
|
42
|
+
unless options[:postal_code].blank?
|
43
|
+
postal_code = addr.add_element "contact:pc"
|
44
|
+
postal_code.text = options[:postal_code]
|
45
|
+
end
|
46
|
+
|
47
|
+
country_code = addr.add_element "contact:cc"
|
48
|
+
country_code.text = options[:country_code]
|
49
|
+
|
50
|
+
if options[:voice]
|
51
|
+
voice = contact_create.add_element "contact:voice"
|
52
|
+
voice.text = options[:voice]
|
53
|
+
end
|
54
|
+
|
55
|
+
if options[:fax]
|
56
|
+
fax = contact_create.add_element "contact:fax"
|
57
|
+
fax.text = options[:fax]
|
58
|
+
end
|
59
|
+
|
60
|
+
email = contact_create.add_element "contact:email"
|
61
|
+
email.text = options[:email]
|
62
|
+
|
63
|
+
auth_info = contact_create.add_element "contact:authInfo"
|
64
|
+
pw = auth_info.add_element "contact:pw"
|
65
|
+
pw.text = options[:auth_info]
|
66
|
+
|
67
|
+
# FIXME
|
68
|
+
extension = command.add_element "extension"
|
69
|
+
extension_create = extension.add_element "extcon:create", {"xmlns:extcon" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0',
|
70
|
+
"xsi:schemaLocation" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd'}
|
71
|
+
|
72
|
+
publish = extension_create.add_element "extcon:consentForPublishing"
|
73
|
+
publish.text = options[:publish] == "1" ? "true" : "false"
|
74
|
+
|
75
|
+
if options[:is_registrant]
|
76
|
+
extcon_registrant = extension_create.add_element "extcon:registrant"
|
77
|
+
|
78
|
+
extcon_nationality = extcon_registrant.add_element "extcon:nationalityCode"
|
79
|
+
extcon_nationality.text = options[:nationality]
|
80
|
+
|
81
|
+
extcon_entity = extcon_registrant.add_element "extcon:entityType"
|
82
|
+
extcon_entity.text = options[:entity_type]
|
83
|
+
|
84
|
+
extcon_regcode = extcon_registrant.add_element "extcon:regCode"
|
85
|
+
extcon_regcode.text = options[:reg_code]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class CreateDomain < Command
|
3
|
+
def initialize(options)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
create = command.add_element("create")
|
8
|
+
|
9
|
+
domain_create = create.add_element("domain:create", {"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"})
|
11
|
+
|
12
|
+
name = domain_create.add_element "domain:name"
|
13
|
+
name.text = options[:name]
|
14
|
+
|
15
|
+
domain_ns = domain_create.add_element "domain:ns"
|
16
|
+
|
17
|
+
options[:nameservers].each do |ns|
|
18
|
+
host_attr = domain_ns.add_element "domain:hostAttr"
|
19
|
+
host_name = host_attr.add_element "domain:hostName"
|
20
|
+
|
21
|
+
host_name.text = ns[0]
|
22
|
+
|
23
|
+
# FIXME IPv6
|
24
|
+
if ns[1]
|
25
|
+
host_addr = host_attr.add_element "domain:hostAddr", {"ip" => "v4"}
|
26
|
+
host_addr.text = ns[1]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
domain_registrant = domain_create.add_element "domain:registrant"
|
31
|
+
domain_registrant.text = options[:registrant]
|
32
|
+
|
33
|
+
domain_contact = domain_create.add_element "domain:contact", {"type" => "admin"}
|
34
|
+
domain_contact.text = options[:admin]
|
35
|
+
|
36
|
+
domain_contact = domain_create.add_element "domain:contact", {"type" => "tech"}
|
37
|
+
domain_contact.text = options[:tech]
|
38
|
+
|
39
|
+
domain_authinfo = domain_create.add_element "domain:authInfo"
|
40
|
+
|
41
|
+
domain_pw = domain_authinfo.add_element "domain:pw"
|
42
|
+
domain_pw.text = options[:authinfo]
|
43
|
+
|
44
|
+
if options[:dns_sec_data] and options[:dns_sec_data].any?
|
45
|
+
extension = command.elements['extension'] || command.add_element("extension")
|
46
|
+
|
47
|
+
create_list = extension.add_element("secDNS:create", {"xmlns:secDNS"=> "urn:ietf:params:xml:ns:secDNS-1.1"})
|
48
|
+
|
49
|
+
options[:dns_sec_data].each do |d|
|
50
|
+
create_list.add_element(d)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class DeleteContact < Command
|
3
|
+
def initialize(id)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
|
8
|
+
delete = command.add_element "delete"
|
9
|
+
|
10
|
+
contact_delete = delete.add_element("contact:delete", {"xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0",
|
11
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"})
|
12
|
+
|
13
|
+
contact_id = contact_delete.add_element "contact:id"
|
14
|
+
contact_id.text = id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class DeleteDomain < Command
|
3
|
+
def initialize(name)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
delete = command.add_element("delete")
|
8
|
+
|
9
|
+
domain_delete = delete.add_element("domain:delete", {"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"})
|
11
|
+
|
12
|
+
domain_name = domain_delete.add_element "domain:name"
|
13
|
+
domain_name.text = name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class Hello < ::REXML::Document
|
3
|
+
def initialize
|
4
|
+
super
|
5
|
+
|
6
|
+
add(::REXML::XMLDecl.new("1.0", "UTF-8", "no"))
|
7
|
+
|
8
|
+
epp = add_element("epp", {"xmlns" => "urn:ietf:params:xml:ns:epp-1.0",
|
9
|
+
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
|
10
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"})
|
11
|
+
|
12
|
+
epp.add_element("hello")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class InfoContact < Command
|
3
|
+
def initialize(id)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
|
8
|
+
info = command.add_element "info"
|
9
|
+
|
10
|
+
contact_info = info.add_element("contact:info", {"xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0",
|
11
|
+
"xsi:schemaLocation" => "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"})
|
12
|
+
|
13
|
+
contact_id = contact_info.add_element "contact:id"
|
14
|
+
contact_id.text = id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class InfoDomain < Command
|
3
|
+
def initialize(name)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
info = command.add_element("info")
|
8
|
+
|
9
|
+
domain_info = info.add_element("domain:info", {"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"})
|
11
|
+
|
12
|
+
domain_name = domain_info.add_element "domain:name", {"hosts" => "all"}
|
13
|
+
domain_name.text = name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class Login < Command
|
3
|
+
def initialize(id = nil, password = nil)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
@command = root.elements['command']
|
7
|
+
@login = @command.add_element("login")
|
8
|
+
|
9
|
+
@login.add_element("clID").text = id if id
|
10
|
+
@login.add_element("pw").text = password if password
|
11
|
+
|
12
|
+
@command.add_element("clTRID").text = "ABC-12345"
|
13
|
+
end
|
14
|
+
|
15
|
+
def version=(value)
|
16
|
+
@options = @login.add_element("options") unless @options
|
17
|
+
@options.add_element("version") unless @options.elements['version']
|
18
|
+
|
19
|
+
@options.elements['version'].text = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def version
|
23
|
+
return nil unless @options
|
24
|
+
version = @options.elements['version']
|
25
|
+
|
26
|
+
version.text if version
|
27
|
+
end
|
28
|
+
|
29
|
+
def lang=(value)
|
30
|
+
@options = @login.add_element("options") unless @options
|
31
|
+
@options.add_element("lang") unless @options.elements['lang']
|
32
|
+
|
33
|
+
@options.elements['lang'].text = value
|
34
|
+
end
|
35
|
+
|
36
|
+
def lang
|
37
|
+
return nil unless @options
|
38
|
+
lang = @options.elements['lang']
|
39
|
+
|
40
|
+
lang.text if lang
|
41
|
+
end
|
42
|
+
|
43
|
+
def new_password=(value)
|
44
|
+
newpw = @login.add_element("newPW")
|
45
|
+
newpw.text = value
|
46
|
+
end
|
47
|
+
|
48
|
+
def services=(services)
|
49
|
+
svcs = @login.add_element("svcs") unless @login.elements['svcs']
|
50
|
+
services.each { |service| svcs.add_element("objURI").text = service }
|
51
|
+
end
|
52
|
+
|
53
|
+
def services
|
54
|
+
svcs = @login.elements['svcs']
|
55
|
+
|
56
|
+
res = []
|
57
|
+
svcs.elements.each("objURI") { |obj| res << obj.text } if svcs
|
58
|
+
|
59
|
+
return res
|
60
|
+
end
|
61
|
+
|
62
|
+
def extensions=(extensions)
|
63
|
+
svcs = @login.elements['svcs']
|
64
|
+
|
65
|
+
svcs = @login.add_element("svcs") unless svcs
|
66
|
+
|
67
|
+
# Include schema extensions for registrars which require it
|
68
|
+
extensions_container = svcs.add_element("svcExtension") unless extensions.empty?
|
69
|
+
|
70
|
+
for uri in extensions
|
71
|
+
extensions_container.add_element("extURI").text = uri
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def extensions
|
76
|
+
svcs_extension = @login.elements['svcs/svcExtension']
|
77
|
+
|
78
|
+
res = []
|
79
|
+
svcs_extension.elements.each("extURI") { |obj| res << obj.text } if svcs_extension
|
80
|
+
|
81
|
+
res
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class Logout < Command
|
3
|
+
def initialize(id = nil, password = nil)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
command.add_element("logout")
|
8
|
+
|
9
|
+
command.add_element("clTRID").text = "ABC-12345"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class Poll < Command
|
3
|
+
def initialize(op = :req)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
poll = command.add_element("poll")
|
8
|
+
|
9
|
+
poll.add_attribute("op", op.to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
def ack_id=(id)
|
13
|
+
poll = root.elements['command/poll']
|
14
|
+
|
15
|
+
poll.add_attribute("msgID", id)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module KonoEppClient::Commands
|
2
|
+
class TransferDomain < Command
|
3
|
+
def initialize(name, authinfo, op, extension: nil)
|
4
|
+
super(nil, nil)
|
5
|
+
|
6
|
+
command = root.elements['command']
|
7
|
+
transfer = command.add_element("transfer", {"op" => op})
|
8
|
+
# FIXME dovremmo controllare che le possibili opzioni di OP sono 'request', 'cancel', 'approve', 'reject', 'query'
|
9
|
+
|
10
|
+
domain_transfer = transfer.add_element("domain:transfer", {"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
|
+
domain_name = domain_transfer.add_element "domain:name"
|
14
|
+
domain_name.text = name
|
15
|
+
|
16
|
+
domain_authinfo = domain_transfer.add_element "domain:authInfo"
|
17
|
+
domain_pw = domain_authinfo.add_element "domain:pw"
|
18
|
+
|
19
|
+
domain_pw.text = authinfo
|
20
|
+
|
21
|
+
## Questa estensione è per Modifica del Registrar con contestuale modifica del Registrante
|
22
|
+
if extension
|
23
|
+
|
24
|
+
ext_elm = command.add_element "extension"
|
25
|
+
ext_trade = ext_elm.add_element "extdom:trade", {"xmlns:extdom" => "http://www.nic.it/ITNIC-EPP/extdom-2.0",
|
26
|
+
"xsi:schemaLocation" => "http://www.nic.it/ITNIC-EPP/extdom-2.0 extdom-2.0.xsd"}
|
27
|
+
|
28
|
+
transfer_trade = ext_trade.add_element "extdom:transferTrade"
|
29
|
+
transfer_trade.add_element("extdom:newRegistrant").text = extension[:new_registrant] if extension[:new_registrant]
|
30
|
+
if extension[:new_auth_info]
|
31
|
+
transfer_trade.add_element("extdom:newAuthInfo").add_element("extdom:pw").tap { |x| x.text = extension[:new_auth_info] }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|