nominet-epp 0.0.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +14 -0
- data/.yardopts +8 -2
- data/Gemfile +22 -0
- data/Gemfile.lock +64 -0
- data/HISTORY.md +78 -0
- data/LICENSE +1 -1
- data/README.md +23 -0
- data/Rakefile +2 -37
- data/gemfiles/Gemfile.ruby18 +13 -0
- data/lib/nominet-epp/client.rb +364 -0
- data/lib/nominet-epp/notification.rb +346 -0
- data/lib/nominet-epp/operations.rb +2 -7
- data/lib/nominet-epp/request.rb +165 -0
- data/lib/nominet-epp/requests/contact/check.rb +9 -0
- data/lib/nominet-epp/requests/contact/create.rb +60 -0
- data/lib/nominet-epp/requests/contact/delete.rb +9 -0
- data/lib/nominet-epp/requests/contact/info.rb +9 -0
- data/lib/nominet-epp/requests/contact/release.rb +33 -0
- data/lib/nominet-epp/requests/contact/update.rb +63 -0
- data/lib/nominet-epp/requests/custom/handshake.rb +36 -0
- data/lib/nominet-epp/requests/custom/list.rb +38 -0
- data/lib/nominet-epp/requests/custom/tag_list.rb +25 -0
- data/lib/nominet-epp/requests/domain/check.rb +98 -0
- data/lib/nominet-epp/requests/domain/create.rb +97 -0
- data/lib/nominet-epp/requests/domain/delete.rb +9 -0
- data/lib/nominet-epp/requests/domain/info.rb +9 -0
- data/lib/nominet-epp/requests/domain/release.rb +33 -0
- data/lib/nominet-epp/requests/domain/renew.rb +9 -0
- data/lib/nominet-epp/requests/domain/unrenew.rb +33 -0
- data/lib/nominet-epp/requests/domain/update.rb +134 -0
- data/lib/nominet-epp/requests/host/check.rb +9 -0
- data/lib/nominet-epp/requests/host/create.rb +9 -0
- data/lib/nominet-epp/requests/host/delete.rb +9 -0
- data/lib/nominet-epp/requests/host/info.rb +9 -0
- data/lib/nominet-epp/requests/host/update.rb +9 -0
- data/lib/nominet-epp/responses/contact/check_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/create_response.rb +14 -0
- data/lib/nominet-epp/responses/contact/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/info_response.rb +89 -0
- data/lib/nominet-epp/responses/contact/release_response.rb +10 -0
- data/lib/nominet-epp/responses/contact/update_response.rb +10 -0
- data/lib/nominet-epp/responses/custom/handshake_response.rb +33 -0
- data/lib/nominet-epp/responses/custom/list_response.rb +29 -0
- data/lib/nominet-epp/responses/custom/tag_list_response.rb +37 -0
- data/lib/nominet-epp/responses/domain/check_response.rb +40 -0
- data/lib/nominet-epp/responses/domain/create_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/info_response.rb +128 -0
- data/lib/nominet-epp/responses/domain/release_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/renew_response.rb +10 -0
- data/lib/nominet-epp/responses/domain/unrenew_response.rb +26 -0
- data/lib/nominet-epp/responses/domain/update_response.rb +10 -0
- data/lib/nominet-epp/responses/host/check_response.rb +10 -0
- data/lib/nominet-epp/responses/host/create_response.rb +14 -0
- data/lib/nominet-epp/responses/host/delete_response.rb +10 -0
- data/lib/nominet-epp/responses/host/info_response.rb +14 -0
- data/lib/nominet-epp/responses/host/update_response.rb +10 -0
- data/lib/nominet-epp/responses/response.rb +27 -0
- data/lib/nominet-epp/version.rb +4 -0
- data/lib/nominet-epp.rb +60 -161
- data/nominet-epp.gemspec +15 -65
- data/test/helper.rb +57 -0
- data/test/notifications/test_contact_deleted_notification.rb +23 -0
- data/test/notifications/test_domain_cancelled_notification.rb +23 -0
- data/test/notifications/test_domains_released_notification.rb +34 -0
- data/test/notifications/test_domains_suspended_notification.rb +30 -0
- data/test/notifications/test_handshake_rejected_notification.rb +34 -0
- data/test/notifications/test_registrant_transfer_notification.rb +78 -0
- data/test/notifications/test_registrar_change_notification.rb +119 -0
- data/test/requests/contact/test_contact_check_request.rb +25 -0
- data/test/requests/contact/test_contact_create_request.rb +104 -0
- data/test/requests/contact/test_contact_delete_request.rb +20 -0
- data/test/requests/contact/test_contact_info_request.rb +20 -0
- data/test/requests/contact/test_contact_release_request.rb +29 -0
- data/test/requests/contact/test_contact_update_request.rb +111 -0
- data/test/requests/custom/test_custom_handshake_request.rb +42 -0
- data/test/requests/custom/test_custom_list_request.rb +44 -0
- data/test/requests/custom/test_custom_tag_list_request.rb +21 -0
- data/test/requests/domain/test_domain_check_request.rb +140 -0
- data/test/requests/domain/test_domain_create_request.rb +136 -0
- data/test/requests/domain/test_domain_delete_request.rb +20 -0
- data/test/requests/domain/test_domain_info_request.rb +20 -0
- data/test/requests/domain/test_domain_release_request.rb +29 -0
- data/test/requests/domain/test_domain_renew_request.rb +15 -0
- data/test/requests/domain/test_domain_unrenew_request.rb +32 -0
- data/test/requests/domain/test_domain_update_request.rb +163 -0
- data/test/requests/host/test_host_check_request.rb +25 -0
- data/test/requests/host/test_host_create_request.rb +33 -0
- data/test/requests/host/test_host_delete_request.rb +20 -0
- data/test/requests/host/test_host_info_request.rb +20 -0
- data/test/requests/host/test_host_update_request.rb +55 -0
- data/test/responses/contact/test_contact_check_response.rb +28 -0
- data/test/responses/contact/test_contact_create_response.rb +28 -0
- data/test/responses/contact/test_contact_delete_response.rb +18 -0
- data/test/responses/contact/test_contact_info_response.rb +79 -0
- data/test/responses/contact/test_contact_release_response.rb +18 -0
- data/test/responses/contact/test_contact_update_response.rb +18 -0
- data/test/responses/custom/test_custom_handshake_response.rb +27 -0
- data/test/responses/custom/test_custom_list_response.rb +44 -0
- data/test/responses/custom/test_custom_tag_list_response.rb +43 -0
- data/test/responses/domain/test_domain_check_response.rb +56 -0
- data/test/responses/domain/test_domain_create_response.rb +34 -0
- data/test/responses/domain/test_domain_delete_response.rb +18 -0
- data/test/responses/domain/test_domain_info_response.rb +76 -0
- data/test/responses/domain/test_domain_release_response.rb +18 -0
- data/test/responses/domain/test_domain_renew_response.rb +27 -0
- data/test/responses/domain/test_domain_unrenew_response.rb +32 -0
- data/test/responses/domain/test_domain_update_response.rb +18 -0
- data/test/responses/host/test_host_check_response.rb +28 -0
- data/test/responses/host/test_host_create_response.rb +28 -0
- data/test/responses/host/test_host_delete_response.rb +18 -0
- data/test/responses/host/test_host_info_response.rb +28 -0
- data/test/responses/host/test_host_update_response.rb +18 -0
- data/test/support/responses/contact/check.xml +23 -0
- data/test/support/responses/contact/create.xml +23 -0
- data/test/support/responses/contact/delete.xml +12 -0
- data/test/support/responses/contact/info.xml +46 -0
- data/test/support/responses/contact/release.xml +12 -0
- data/test/support/responses/contact/update.xml +12 -0
- data/test/support/responses/custom/handshake.xml +24 -0
- data/test/support/responses/custom/list.xml +28 -0
- data/test/support/responses/custom/list_empty.xml +21 -0
- data/test/support/responses/custom/tag_list.xml +28 -0
- data/test/support/responses/domain/check-direct-rights.xml +1 -0
- data/test/support/responses/domain/check.xml +25 -0
- data/test/support/responses/domain/create.xml +24 -0
- data/test/support/responses/domain/delete.xml +12 -0
- data/test/support/responses/domain/info.xml +45 -0
- data/test/support/responses/domain/release.xml +12 -0
- data/test/support/responses/domain/renew.xml +24 -0
- data/test/support/responses/domain/unrenew.xml +26 -0
- data/test/support/responses/domain/update.xml +12 -0
- data/test/support/responses/host/check.xml +23 -0
- data/test/support/responses/host/create.xml +18 -0
- data/test/support/responses/host/delete.xml +12 -0
- data/test/support/responses/host/info.xml +25 -0
- data/test/support/responses/host/update.xml +12 -0
- data/test/support/responses/notifications/abuse-feed.xml +31 -0
- data/test/support/responses/notifications/account-change.xml +39 -0
- data/test/support/responses/notifications/contact-deleted.xml +22 -0
- data/test/support/responses/notifications/data-quality.xml +53 -0
- data/test/support/responses/notifications/domain-cancelled.xml +22 -0
- data/test/support/responses/notifications/domains-released.xml +31 -0
- data/test/support/responses/notifications/domains-suspended.xml +26 -0
- data/test/support/responses/notifications/handshake-rejected.xml +31 -0
- data/test/support/responses/notifications/handshake-request.xml +65 -0
- data/test/support/responses/notifications/hosts-cancelled.xml +28 -0
- data/test/support/responses/notifications/referral-accepted.xml +23 -0
- data/test/support/responses/notifications/referral-rejected.xml +22 -0
- data/test/support/responses/notifications/registrant-transfer.xml +54 -0
- data/test/support/responses/notifications/registrar-change.xml +67 -0
- data/test/support/schemas/README +12 -0
- data/test/support/schemas/RELEASENOTES +54 -0
- data/test/support/schemas/contact-1.0.xsd +387 -0
- data/test/support/schemas/contact-nom-ext-1.0.xsd +144 -0
- data/test/support/schemas/domain-1.0.xsd +432 -0
- data/test/support/schemas/domain-nom-ext-1.2.xsd +215 -0
- data/test/support/schemas/epp-1.0.xsd +403 -0
- data/test/support/schemas/eppcom-1.0.xsd +93 -0
- data/test/support/schemas/host-1.0.xsd +240 -0
- data/test/support/schemas/nom-abuse-feed-1.0.xsd +46 -0
- data/test/support/schemas/nom-direct-rights-1.0.xsd +48 -0
- data/test/support/schemas/nom-root-std-1.0.7.xsd +47 -0
- data/test/support/schemas/nom-root-tag-1.0.xsd +31 -0
- data/test/support/schemas/nom-tag-1.0.xsd +71 -0
- data/test/support/schemas/secDNS-1.1.xsd +127 -0
- data/test/support/schemas/std-contact-id-1.0.xsd +35 -0
- data/test/support/schemas/std-fork-1.0.xsd +31 -0
- data/test/support/schemas/std-handshake-1.0.xsd +61 -0
- data/test/support/schemas/std-list-1.0.xsd +55 -0
- data/test/support/schemas/std-locks-1.0.xsd +53 -0
- data/test/support/schemas/std-notifications-1.2.xsd +197 -0
- data/test/support/schemas/std-release-1.0.xsd +39 -0
- data/test/support/schemas/std-unrenew-1.0.xsd +26 -0
- data/test/support/schemas/std-warning-1.1.xsd +145 -0
- data/test/test_nominet-epp.rb +3 -3
- metadata +324 -104
- data/History.rdoc +0 -78
- data/README.rdoc +0 -23
- data/VERSION +0 -1
- data/lib/nominet-epp/operations/check.rb +0 -39
- data/lib/nominet-epp/operations/create.rb +0 -138
- data/lib/nominet-epp/operations/delete.rb +0 -20
- data/lib/nominet-epp/operations/fork.rb +0 -53
- data/lib/nominet-epp/operations/hello.rb +0 -11
- data/lib/nominet-epp/operations/info.rb +0 -93
- data/lib/nominet-epp/operations/list.rb +0 -83
- data/lib/nominet-epp/operations/lock.rb +0 -56
- data/lib/nominet-epp/operations/merge.rb +0 -41
- data/lib/nominet-epp/operations/poll.rb +0 -64
- data/lib/nominet-epp/operations/renew.rb +0 -40
- data/lib/nominet-epp/operations/transfer.rb +0 -84
- data/lib/nominet-epp/operations/unlock.rb +0 -56
- data/lib/nominet-epp/operations/unrenew.rb +0 -36
- data/lib/nominet-epp/operations/update.rb +0 -176
@@ -1,138 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Create Operation
|
4
|
-
module Create
|
5
|
-
# Register a domain name with Nominet.
|
6
|
-
#
|
7
|
-
# The returned hash has the following keys
|
8
|
-
# - (String) +:name+ -- Domain name registered
|
9
|
-
# - (Time) +:crDate+ -- Domain creation date
|
10
|
-
# - (Time) +:exDate+ -- Domain expiration date
|
11
|
-
# - (Hash) +:account+ -- Created account data (if returned)
|
12
|
-
#
|
13
|
-
# The +:account+ hash contains the following keys
|
14
|
-
# - (String) +:roid+ -- Account ID
|
15
|
-
# - (String) +:name+ -- Account Name
|
16
|
-
# - (Array) +:contacts+ -- Account contacts
|
17
|
-
#
|
18
|
-
# The +:contacts+ array contains hashes of the following keys
|
19
|
-
# - (String) +:roid+ -- Contact ID
|
20
|
-
# - (String) +:name+ -- Contact Name
|
21
|
-
# - (String) +:type+ -- Contact type if set
|
22
|
-
# - (Integer) +:order+ -- Contacts order in the list of contacts
|
23
|
-
#
|
24
|
-
# @param [String] name Domain name to register
|
25
|
-
# @param [String, Hash] acct
|
26
|
-
# @param [String, Array] nameservers Nameservers to set for the domain
|
27
|
-
# @param [Hash] options Registration options
|
28
|
-
# @option options [String] :period
|
29
|
-
# @option options [String] :first_bill
|
30
|
-
# @option options [String] :recur_bill
|
31
|
-
# @option options [String] :auto_bill
|
32
|
-
# @option options [String] :next_bill
|
33
|
-
# @option options [String] :notes
|
34
|
-
# @raise [ArgumentError] invalid option keys
|
35
|
-
# @return [false] registration failed
|
36
|
-
# @return [Hash] Domain creation data
|
37
|
-
def create(name, acct, nameservers, options = {})
|
38
|
-
raise ArgumentError, "options allowed keys are period, first_bill, recur_bill, auto_bill, next_bill, notes" unless (options.keys - [:period, :first_bill, :recur_bill, :auto_bill, :next_bill, :notes]).empty?
|
39
|
-
|
40
|
-
@resp = @client.create do
|
41
|
-
domain('create') do |node, ns|
|
42
|
-
node << XML::Node.new('name', name, ns)
|
43
|
-
|
44
|
-
if period = options.delete(:period)
|
45
|
-
unit = period[-1..1]
|
46
|
-
num = period.to_i.to_s
|
47
|
-
p = XML::Node.new('period', num, ns);
|
48
|
-
p['unit'] = unit
|
49
|
-
node << p
|
50
|
-
end
|
51
|
-
|
52
|
-
# node << XML::Node.new('auto-period', '', ns) # placeholder
|
53
|
-
|
54
|
-
node << XML::Node.new('account', nil, ns).tap do |acct_xml|
|
55
|
-
acct_xml << create_account(acct, ns)
|
56
|
-
end
|
57
|
-
|
58
|
-
node << domain_ns_xml(nameservers, ns)
|
59
|
-
|
60
|
-
# Enforce correct sequencing of option fields
|
61
|
-
[:first_bill, :recur_bill, :auto_bill, :next_bill, :notes].each do |key|
|
62
|
-
next if options[key].nil? || options[key] == ''
|
63
|
-
node << XML::Node.new(key.to_s.gsub('_', '-'), options[key], ns)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
unless @resp.success?
|
69
|
-
@error_info = {
|
70
|
-
:name => node_value(@resp.data, '//domain:failData/domain:name/node()'),
|
71
|
-
:reason => node_value(@resp.data, '//domain:failData/domain:reason/node()') }
|
72
|
-
return false
|
73
|
-
end
|
74
|
-
|
75
|
-
creData = @resp.data.find('//domain:creData', namespaces).first
|
76
|
-
h = { :name => node_value(creData, 'domain:name'),
|
77
|
-
:crDate => Time.parse(node_value(creData, 'domain:crDate')),
|
78
|
-
:exDate => Time.parse(node_value(creData, 'domain:exDate')) }
|
79
|
-
unless creData.find('domain:account').first.nil?
|
80
|
-
h[:account] = created_account(creData.find('domain:account/account:creData', namespaces).first)
|
81
|
-
end
|
82
|
-
h
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
86
|
-
# Create the account payload
|
87
|
-
#
|
88
|
-
# @param [String, Hash] acct Account ID or New account fields
|
89
|
-
# @param [XML::Namespace] domain_ns +:domain+ namespace
|
90
|
-
# @raise [ArgumentError] acct must be a String or a Hash of account fields
|
91
|
-
# @return [XML::Node]
|
92
|
-
def create_account(acct, domain_ns)
|
93
|
-
if acct.kind_of?(String)
|
94
|
-
XML::Node.new('account-id', acct, domain_ns)
|
95
|
-
elsif acct.kind_of?(Hash)
|
96
|
-
account('create') do |node, ns|
|
97
|
-
node << XML::Node.new('name', acct[:name], ns)
|
98
|
-
account_fields_xml(acct, node, ns)
|
99
|
-
end
|
100
|
-
else
|
101
|
-
raise ArgumentError, "acct must be String or Hash"
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# Collects created account information
|
106
|
-
#
|
107
|
-
# @param [XML::Node] creData XML
|
108
|
-
# @return [Hash]
|
109
|
-
def created_account(creData)
|
110
|
-
{ :roid => node_value(creData, 'account:roid'),
|
111
|
-
:name => node_value(creData, 'account:name'),
|
112
|
-
:contacts => created_contacts(creData.find(
|
113
|
-
'account:contact', namespaces)) }
|
114
|
-
end
|
115
|
-
|
116
|
-
# Collects created account contacts
|
117
|
-
#
|
118
|
-
# @param [XML::Node] account_contacts Account contacts
|
119
|
-
# @return [Hash]
|
120
|
-
def created_contacts(account_contacts)
|
121
|
-
account_contacts.map do |cont|
|
122
|
-
{ :type => cont['type'],
|
123
|
-
:order => cont['order'] }.merge(
|
124
|
-
created_contact(cont.find('contact:creData', namespaces).first))
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
# Collects create contact information
|
129
|
-
#
|
130
|
-
# @param [XML::Node] creData XML
|
131
|
-
# @return [Hash]
|
132
|
-
def created_contact(creData)
|
133
|
-
{ :roid => node_value(creData, 'contact:roid'),
|
134
|
-
:name => node_value(creData, 'contact:name') }
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Delete Operation
|
4
|
-
module Delete
|
5
|
-
# Delete a domain from the registry
|
6
|
-
#
|
7
|
-
# @param [String] name Domain name
|
8
|
-
# @return [Boolean] success status
|
9
|
-
def delete(name)
|
10
|
-
@resp = @client.delete do
|
11
|
-
domain('delete') do |node, ns|
|
12
|
-
node << XML::Node.new('name', name, ns)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
@resp.success?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Fork Operation
|
4
|
-
module Fork
|
5
|
-
# Splits a selection of domains from one account into another.
|
6
|
-
#
|
7
|
-
# The returned hash contains the following keys
|
8
|
-
# - (String) +:roid+ -- New account ID
|
9
|
-
# - (String) +:name+ -- New account name
|
10
|
-
# - (String) +:crDate+ -- Date the account was created
|
11
|
-
# - (Hash) +:contact+ -- Contact details
|
12
|
-
#
|
13
|
-
# The +:contact+ hash contains the following keys
|
14
|
-
# - (String) +:roid+ -- Contact ID
|
15
|
-
# - (String) +:name+ -- Contact Name
|
16
|
-
# - (String) +:type+ -- Contact Type
|
17
|
-
# - (Integer) +:order+ -- Contact Order
|
18
|
-
#
|
19
|
-
# @param [String] account_num Account Number
|
20
|
-
# @param [String, ...] *names Domain names to fork from the account
|
21
|
-
# @return [false] fork failed
|
22
|
-
# @return [Hash] new account details
|
23
|
-
def fork(account_num, *names)
|
24
|
-
@resp = @client.update do
|
25
|
-
account('fork') do |node, ns|
|
26
|
-
node << XML::Node.new('roid', account_num, ns)
|
27
|
-
names.each do |name|
|
28
|
-
node << XML::Node.new('domain-name', name, ns)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
return false unless @resp.success?
|
34
|
-
|
35
|
-
hash = {
|
36
|
-
:roid => node_value(@resp.data, '//account:creData/account:roid'),
|
37
|
-
:name => node_value(@resp.data, '//account:creData/account:name'),
|
38
|
-
:crDate => node_value(@resp.data, '//account:creData/account:crDate'),
|
39
|
-
:contact => {
|
40
|
-
:roid => node_value(@resp.data, '//account:creData/account:contact/contact:creData/contact:roid'),
|
41
|
-
:name => node_value(@resp.data, '//account:creData/account:contact/contact:creData/contact:name')
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
contact = @resp.data.find('//account:creData/account:contact', namespaces).first
|
46
|
-
hash[:contact][:type] = contact['type']
|
47
|
-
hash[:contact][:order] = contact['order']
|
48
|
-
|
49
|
-
hash
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Info Operation
|
4
|
-
module Info
|
5
|
-
# @param [Symbol] entity Type of entity to get information about
|
6
|
-
# @param [String] id Identifier of the entity
|
7
|
-
# @return [false] failed
|
8
|
-
# @return [Hash]
|
9
|
-
def info(entity, id)
|
10
|
-
raise ArgumentError, "entity must be :domain, :contact or :account" unless [:domain, :contact, :account].include?(entity)
|
11
|
-
|
12
|
-
@resp = @client.info do
|
13
|
-
case entity
|
14
|
-
when :domain
|
15
|
-
domain('info') { |node, ns| node << XML::Node.new('name', id, ns) }
|
16
|
-
when :account
|
17
|
-
account('info') { |node, ns| node << XML::Node.new('roid', id, ns) }
|
18
|
-
when :contact
|
19
|
-
contact('info') { |node, ns| node << XML::Node.new('roid', id, ns) }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
return false unless @resp.success?
|
24
|
-
self.send(:"info_#{entity}", @resp.data)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
# @param [XML::Node] data Domain data
|
29
|
-
# @return [Hash]
|
30
|
-
def info_domain(data)
|
31
|
-
hash = {}
|
32
|
-
data.find('//domain:infData', namespaces).first.children.reject{|n| n.empty?}.each do |node|
|
33
|
-
key = node.name.gsub('-', '_').to_sym
|
34
|
-
case node.name
|
35
|
-
when 'account'
|
36
|
-
hash[:account] = info_account(node)
|
37
|
-
when 'ns'
|
38
|
-
hash[:ns] = node.find('domain:host', namespaces).map do |hostnode|
|
39
|
-
{ :name => node_value(hostnode, 'domain:hostName'),
|
40
|
-
:v4 => node_value(hostnode, 'domain:hostAddr[@ip="v4"]'),
|
41
|
-
:v6 => node_value(hostnode, 'domain:hostAddr[@ip="v6"]') }.reject{|k,v| v.nil?}
|
42
|
-
end
|
43
|
-
when /date/i
|
44
|
-
hash[key] = Time.parse(node.content.strip)
|
45
|
-
else
|
46
|
-
hash[key] = node.content.strip
|
47
|
-
end
|
48
|
-
end
|
49
|
-
hash
|
50
|
-
end
|
51
|
-
|
52
|
-
# @param [XML::Node] data Account data
|
53
|
-
# @return [Hash]
|
54
|
-
def info_account(data)
|
55
|
-
hash = {}
|
56
|
-
data.find('//account:infData', namespaces).first.children.reject{|n| n.empty?}.each do |node|
|
57
|
-
key = node.name.gsub('-', '_').to_sym
|
58
|
-
case node.name
|
59
|
-
when 'addr'
|
60
|
-
hash[:addr] = {}
|
61
|
-
node.children.reject{|n| n.empty?}.each do |n|
|
62
|
-
hash[:addr][n.name.to_sym] = n.content.strip
|
63
|
-
end
|
64
|
-
when 'contact'
|
65
|
-
hash[:contacts] ||= Array.new
|
66
|
-
hash[:contacts] << info_contact(node)
|
67
|
-
hash[:contacts].last[:type] = node['type']
|
68
|
-
hash[:contacts].last[:order] = node['order']
|
69
|
-
when /date/i
|
70
|
-
hash[key] = Time.parse(node.content.strip)
|
71
|
-
else
|
72
|
-
hash[key] = node.content.strip
|
73
|
-
end
|
74
|
-
end
|
75
|
-
hash
|
76
|
-
end
|
77
|
-
|
78
|
-
# @param [XML::Node] data Contact data
|
79
|
-
# @return [Hash]
|
80
|
-
def info_contact(data)
|
81
|
-
hash = {}
|
82
|
-
data.find('//contact:infData', namespaces).first.children.reject{|n| n.empty?}.each do |node|
|
83
|
-
if node.name =~ /date/i
|
84
|
-
hash[node.name.to_sym] = Time.parse(node.content.strip)
|
85
|
-
else
|
86
|
-
hash[node.name.to_sym] = node.content.strip
|
87
|
-
end
|
88
|
-
end
|
89
|
-
hash
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP List Operatons
|
4
|
-
module List
|
5
|
-
# Obtain a list of domains, and optionally their details, which either
|
6
|
-
# expire or were registered in the month given.
|
7
|
-
#
|
8
|
-
# @param [Symbol] type Listing type, either +:expiry+ or +:month+
|
9
|
-
# @param [String, #strftime] date Date of either expiry or registration to list
|
10
|
-
# @param [String] fields Verbosity of the response, either 'none' or 'all'
|
11
|
-
# @raise [ArgumentError] type must be +:expiry+ or +:month+
|
12
|
-
# @return [nil] list failed
|
13
|
-
# @return [Array<String>] list of domains
|
14
|
-
# @return [Array<Hash>] list of domains with details
|
15
|
-
def list(type, date, fields = 'none')
|
16
|
-
raise ArgumentError, "type must be :expiry or :month" unless [:expiry, :month].include?(type)
|
17
|
-
|
18
|
-
date = date.strftime("%Y-%m") if date.respond_to?(:strftime)
|
19
|
-
@resp = @client.info do
|
20
|
-
domain('list') do |node, ns|
|
21
|
-
node << XML::Node.new(type, date, ns)
|
22
|
-
node << XML::Node.new('fields', fields, ns)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
return nil unless @resp.success?
|
27
|
-
|
28
|
-
if fields == 'none'
|
29
|
-
@resp.data.find('//domain:name', namespaces).map do |node|
|
30
|
-
node.content.strip
|
31
|
-
end
|
32
|
-
else
|
33
|
-
@resp.data.find('//domain:infData', namespaces).map do |infData|
|
34
|
-
hash = {}
|
35
|
-
infData.children.reject{|n| n.empty?}.each do |node|
|
36
|
-
key = node.name.gsub('-', '_').to_sym
|
37
|
-
case node.name
|
38
|
-
when 'account'
|
39
|
-
hash[:account] = info_account(node)
|
40
|
-
when 'ns'
|
41
|
-
hash[:ns] = node.find('domain:host', namespaces).map do |hostnode|
|
42
|
-
{ :name => node_value(hostnode, 'domain:hostName'),
|
43
|
-
:v4 => node_value(hostnode, 'domain:hostAddr[@ip="v4"]'),
|
44
|
-
:v6 => node_value(hostnode, 'domain:hostAddr[@ip="v6"]') }.reject{|k,v| v.nil?}
|
45
|
-
end
|
46
|
-
when /date/i
|
47
|
-
hash[key] = Time.parse(node.content.strip)
|
48
|
-
else
|
49
|
-
hash[key] = node.content.strip
|
50
|
-
end
|
51
|
-
end
|
52
|
-
hash
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# list of all tags that accept tag changes along with their handshake settings
|
58
|
-
#
|
59
|
-
# The returned array of hashes contain the following keys
|
60
|
-
# - (String) +:registrar_tag+ -- TAG name
|
61
|
-
# - (String) +:name+ -- Name of the TAG owner
|
62
|
-
# - (String) +:trad_name+ -- TAG trading name
|
63
|
-
# - (BOOL) +:handshake+ -- Whether the TAG accepts handshakes
|
64
|
-
#
|
65
|
-
# @return [false] failure
|
66
|
-
# @return [Array<Hash>] tag details
|
67
|
-
def tag_list
|
68
|
-
resp = @client.info do
|
69
|
-
tag('list')
|
70
|
-
end
|
71
|
-
|
72
|
-
return false unless resp.success?
|
73
|
-
|
74
|
-
resp.data.find('//tag:infData', namespaces).map do |node|
|
75
|
-
{ :registrar_tag => node_value(node, 'tag:registrar-tag'),
|
76
|
-
:name => node_value(node, 'tag:name'),
|
77
|
-
:trad_name => node_value(node, 'tag:trad-name'),
|
78
|
-
:handshake => node_value(node, 'tag:handshake') == 'Y' }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Lock Operation
|
4
|
-
module Lock
|
5
|
-
# Lock domain or account 'investigation' or 'opt-out'
|
6
|
-
#
|
7
|
-
# @param [Symbol] entity Entity to lock
|
8
|
-
# @param [String] type Type of lock to set
|
9
|
-
# @param [String] id Domain name or account ID
|
10
|
-
# @raise [ArgumentError] entity is not +:domain+ or +:account+
|
11
|
-
# @raise [ArgumentError] type is not 'investigation' or 'opt-out'
|
12
|
-
# @return [Boolean] locking successful
|
13
|
-
def lock(entity, type, id)
|
14
|
-
raise ArgumentError, "entity must be :domain or :account" unless [:domain, :account].include?(entity)
|
15
|
-
raise ArgumentError, "type must be 'investigation' or 'opt-out'" unless %w(investigation opt-out).include?(type)
|
16
|
-
|
17
|
-
@resp = @client.update do
|
18
|
-
case type
|
19
|
-
when 'investigation'
|
20
|
-
lock_investigation(entity, id)
|
21
|
-
when 'opt-out'
|
22
|
-
lock_opt_out(entity, id)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
return @resp.success?
|
27
|
-
end
|
28
|
-
private
|
29
|
-
# Create +account:lock+ XML element for opt-out lock
|
30
|
-
# @param [Symbol] entity Entity to set opt out lock on
|
31
|
-
# @param [String] id Domain name or Account ID to lock
|
32
|
-
# @return [XML::Node] +account:lock+ element
|
33
|
-
def lock_opt_out(entity, id)
|
34
|
-
account('lock') do |node, ns|
|
35
|
-
node['type'] = 'opt-out'
|
36
|
-
node << XML::Node.new((entity == :domain ? 'domain-name' : 'roid'), id, ns)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Create +lock+ XML element for investigation lock
|
41
|
-
#
|
42
|
-
# We don't support 'investigation' on account:domain-name as this ability
|
43
|
-
# is already provided via domain:name
|
44
|
-
#
|
45
|
-
# @param [Symbol] entity Entity to set investigation lock on
|
46
|
-
# @param [String] id Domain name or account ID to set lock on
|
47
|
-
# @return [XML::Node] +lock+ element
|
48
|
-
def lock_investigation(entity, id)
|
49
|
-
self.send(entity, 'lock') do |node, ns|
|
50
|
-
node['type'] = 'investigation'
|
51
|
-
node << XML::Node.new((entity == :domain ? 'name' : 'roid'), id, ns)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Merge Operation
|
4
|
-
module Merge
|
5
|
-
# Merge accounts or domains into an Account
|
6
|
-
#
|
7
|
-
# @param [String] target Account ID to merge into
|
8
|
-
# @param [Hash] sources Account IDs to merge into the target
|
9
|
-
# @option sources [Array] :accounts Account numbers to merge
|
10
|
-
# @option sources [Array] :names Account names to merge
|
11
|
-
# @option sources [Array] :domains Domain names to merge
|
12
|
-
# @return [false] merge failed
|
13
|
-
# @return [Response] merge succeded
|
14
|
-
def merge(target, sources = {})
|
15
|
-
@resp = @client.update do
|
16
|
-
account('merge') do |node, ns|
|
17
|
-
node << XML::Node.new('roid', target, ns)
|
18
|
-
|
19
|
-
(sources[:accounts] || []).each do |acct|
|
20
|
-
n = XML::Node.new('roid', acct, ns)
|
21
|
-
n['source'] = 'y'
|
22
|
-
node << n
|
23
|
-
end
|
24
|
-
|
25
|
-
(sources[:names] || []).each do |name|
|
26
|
-
node << XML::Node.new('name', name, ns)
|
27
|
-
end
|
28
|
-
|
29
|
-
(sources[:domains] || []).each do |domain|
|
30
|
-
node << XML::Node.new('domain-name', domain, ns)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
return false unless @resp.success?
|
36
|
-
|
37
|
-
@resp # Need to test this to see what gets returned
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Poll Operation
|
4
|
-
module Poll
|
5
|
-
# Error for indicating a failed poll ack response
|
6
|
-
class AckError < RuntimeError; end
|
7
|
-
|
8
|
-
# Poll the EPP server for events.
|
9
|
-
#
|
10
|
-
# If a block is given then it will be invoked once for
|
11
|
-
# each pending event. If no block is given the only the
|
12
|
-
# first received event will be returned along with the
|
13
|
-
# message ID of the event to allow the message to be
|
14
|
-
# ack'd. nil is returned if there is an error in the
|
15
|
-
# response or if there are not further messages to process.
|
16
|
-
#
|
17
|
-
# @example Without a block
|
18
|
-
# msgID, xml = client.poll
|
19
|
-
# ... process xml ...
|
20
|
-
# client.ack(msgID)
|
21
|
-
#
|
22
|
-
# @example With a block
|
23
|
-
# client.poll do |xml|
|
24
|
-
# ... process xml ...
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# @yield [data] process data if messages to poll
|
28
|
-
# @yieldparam [XML::Node] data Response data
|
29
|
-
# @return [nil] no messages to handle
|
30
|
-
# @return [Array<String,XML::Node>] message ID and response xml data
|
31
|
-
# @raise [AckError] ack of event notification failed
|
32
|
-
# @see ack
|
33
|
-
def poll
|
34
|
-
while resp = poll_req
|
35
|
-
return if resp.code != 1301 || resp.msgQ['count'] == '0'
|
36
|
-
return [resp.msgQ['id'], resp.data] unless block_given?
|
37
|
-
|
38
|
-
yield resp.data
|
39
|
-
raise AckError, "failed to acknowledge message #{resp.msgQ['id']}" unless ack(resp.msgQ['id'])
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Acknowledges a polled message ID
|
44
|
-
#
|
45
|
-
# @param [String] msgID Message ID to acknowledge
|
46
|
-
# @return [Boolean] ack successful
|
47
|
-
def ack(msgID)
|
48
|
-
resp = @client.poll do |poll|
|
49
|
-
poll['op'] = 'ack'
|
50
|
-
poll['msgID'] = msgID
|
51
|
-
end
|
52
|
-
|
53
|
-
return resp.success?
|
54
|
-
end
|
55
|
-
|
56
|
-
protected
|
57
|
-
def poll_req
|
58
|
-
@client.poll do |poll|
|
59
|
-
poll['op'] = 'req'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module NominetEPP
|
2
|
-
module Operations
|
3
|
-
# EPP Renew Operation
|
4
|
-
module Renew
|
5
|
-
# Renew a domain name
|
6
|
-
#
|
7
|
-
# @param [String] name Domain name to renew
|
8
|
-
# @param [String] period Length of time to renew for. Currently has to be '2y'.
|
9
|
-
# @raise [ArgumentError] invalid period specified
|
10
|
-
# @raise [RuntimeError] renewed domain name does not match +name+
|
11
|
-
# @return [false] renewal failed
|
12
|
-
# @return [Time] domain expiration date
|
13
|
-
def renew(name, period = '2y')
|
14
|
-
period = '2y' # reset period to 2 years as nominet don't currently support other options
|
15
|
-
|
16
|
-
unit = period[-1..1]
|
17
|
-
num = period.to_i.to_s
|
18
|
-
|
19
|
-
raise ArgumentError, "period suffix must either be 'm' or 'y'" unless %w(m y).include?(unit)
|
20
|
-
|
21
|
-
@resp = @client.renew do
|
22
|
-
domain('renew') do |node, ns|
|
23
|
-
node << XML::Node.new('name', name, ns)
|
24
|
-
p = XML::Node.new('period', num, ns);
|
25
|
-
p['unit'] = unit
|
26
|
-
node << p
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
return false unless @resp.success?
|
31
|
-
|
32
|
-
renName = node_value(@resp.data, '//domain:renData/domain:name')
|
33
|
-
renExp = node_value(@resp.data, '//domain:renData/domain:exDate')
|
34
|
-
|
35
|
-
raise "Renewed name #{renName} does not match #{name}" if renName != name
|
36
|
-
return Time.parse(renExp)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|