epp-client-afnic 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +4 -5
- data/epp-client-afnic.gemspec +9 -7
- data/lib/epp-client/afnic.rb +198 -212
- data/vendor/afnic/frnic-1.0.xsd +393 -393
- data/vendor/afnic/frnic-1.1.xsd +406 -406
- data/vendor/afnic/frnic-1.3.xsd +563 -0
- data/vendor/afnic/frnic-1.4.xsd +580 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: fd3aca9088bc17f87cf82a39c60447b07a768a4b
|
4
|
-
data.tar.gz: 340f2fbd7eeb4df5aab35ad9da6577c565d3d08c
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46632d82cdedaa8f5741f2188aaa8f59e9c77d6e31179997253cac9c773cf58926e1f431a07eb0da9cb1ad86ea70246dfedc9df5050cf69530f4ea80a553a65d
|
4
|
+
data.tar.gz: c2abc4895ec08a6ce2706f409c964224927079e3ddace1197643d3d6a11c9c96487d132958018b316e5421a62c451911b93b3d8df21f4fc4e1fcf037e5885b98
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 8f2c6f33f1787eeb6d0fe4acf073ffbd46100269
|
7
|
+
data.tar.gz: 3ded489d87400522ec64bc8deea3ab4ed0c4122c
|
data/Rakefile
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
require 'rake'
|
3
3
|
require 'rdoc/task'
|
4
4
|
require 'rubygems/package_task'
|
5
|
-
require
|
5
|
+
require 'bundler/gem_helper'
|
6
6
|
|
7
|
-
MY_GEMS = Dir['*.gemspec'].map {|g| g.sub(/.*-(.*)\.gemspec/, '\1')}
|
7
|
+
MY_GEMS = Dir['*.gemspec'].map { |g| g.sub(/.*-(.*)\.gemspec/, '\1') }
|
8
8
|
|
9
9
|
MY_GEMS.each do |g|
|
10
10
|
namespace g do
|
@@ -26,10 +26,10 @@ task :build => 'all:build'
|
|
26
26
|
task :install => 'all:install'
|
27
27
|
task :push => 'all:push'
|
28
28
|
|
29
|
-
desc
|
29
|
+
desc 'Generate documentation for the Rails framework'
|
30
30
|
Rake::RDocTask.new do |rdoc|
|
31
31
|
rdoc.rdoc_dir = 'doc/rdoc'
|
32
|
-
rdoc.title =
|
32
|
+
rdoc.title = 'Documentation'
|
33
33
|
|
34
34
|
rdoc.options << '--line-numbers' << '--inline-source'
|
35
35
|
rdoc.options << '--charset' << 'utf-8'
|
@@ -38,4 +38,3 @@ Rake::RDocTask.new do |rdoc|
|
|
38
38
|
rdoc.rdoc_files.include('ChangeLog')
|
39
39
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
40
40
|
end
|
41
|
-
|
data/epp-client-afnic.gemspec
CHANGED
@@ -8,12 +8,12 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.email = ['m@absolight.fr']
|
9
9
|
gem.description = 'AFNIC EPP client library.'
|
10
10
|
gem.summary = 'AFNIC EPP client library'
|
11
|
-
gem.homepage
|
11
|
+
gem.homepage = 'https://github.com/Absolight/epp-client'
|
12
12
|
|
13
13
|
gem.required_ruby_version = '>= 1.8.7'
|
14
|
-
gem.required_rubygems_version =
|
14
|
+
gem.required_rubygems_version = '>= 1.3.6'
|
15
15
|
|
16
|
-
gem.files
|
16
|
+
gem.files = [
|
17
17
|
'ChangeLog',
|
18
18
|
'EXAMPLE.AFNIC',
|
19
19
|
'Gemfile',
|
@@ -25,15 +25,17 @@ Gem::Specification.new do |gem|
|
|
25
25
|
'vendor/afnic/frnic-1.0.xsd',
|
26
26
|
'vendor/afnic/frnic-1.1.xsd',
|
27
27
|
'vendor/afnic/frnic-1.2.xsd',
|
28
|
+
'vendor/afnic/frnic-1.3.xsd',
|
29
|
+
'vendor/afnic/frnic-1.4.xsd',
|
28
30
|
]
|
29
31
|
|
30
32
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
31
33
|
gem.require_paths = ['lib']
|
32
34
|
|
33
|
-
gem.add_development_dependency
|
35
|
+
gem.add_development_dependency 'bundler', '>= 1.0.0'
|
34
36
|
gem.add_dependency('nokogiri', '~> 1.4')
|
35
37
|
gem.add_dependency('builder', '>= 2.1.2')
|
36
|
-
gem.add_dependency('epp-client-base',
|
37
|
-
gem.add_dependency('epp-client-rgp',
|
38
|
-
gem.add_dependency('epp-client-secdns',
|
38
|
+
gem.add_dependency('epp-client-base', EPPClient::VERSION.to_s)
|
39
|
+
gem.add_dependency('epp-client-rgp', EPPClient::VERSION.to_s)
|
40
|
+
gem.add_dependency('epp-client-secdns', EPPClient::VERSION.to_s)
|
39
41
|
end
|
data/lib/epp-client/afnic.rb
CHANGED
@@ -3,13 +3,16 @@ require 'epp-client/rgp'
|
|
3
3
|
require 'epp-client/secdns'
|
4
4
|
|
5
5
|
module EPPClient
|
6
|
+
# This handles the AFNIC specificities.
|
7
|
+
#
|
8
|
+
# See http://www.afnic.fr/doc/interface/epp
|
6
9
|
class AFNIC < Base
|
7
|
-
SCHEMAS_AFNIC = %w
|
8
|
-
frnic-1.
|
9
|
-
|
10
|
+
SCHEMAS_AFNIC = %w(
|
11
|
+
frnic-1.4
|
12
|
+
).freeze
|
10
13
|
|
11
|
-
EPPClient::SCHEMAS_URL.merge!(SCHEMAS_AFNIC.inject({}) do |a,s|
|
12
|
-
a[s.sub(/-1\.
|
14
|
+
EPPClient::SCHEMAS_URL.merge!(SCHEMAS_AFNIC.inject({}) do |a, s|
|
15
|
+
a[s.sub(/-1\.4$/, '')] = "http://www.afnic.fr/xml/epp/#{s}" if s =~ /-1\.4$/
|
13
16
|
a[s] = "http://www.afnic.fr/xml/epp/#{s}"
|
14
17
|
a
|
15
18
|
end)
|
@@ -21,11 +24,11 @@ module EPPClient
|
|
21
24
|
# ==== Optional Attributes
|
22
25
|
# [<tt>:test</tt>] sets the server to be the test server.
|
23
26
|
def initialize(args)
|
24
|
-
if args.delete(:test) == true
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
args[:server] ||= if args.delete(:test) == true
|
28
|
+
'epp.sandbox.nic.fr'
|
29
|
+
else
|
30
|
+
'epp.nic.fr'
|
31
|
+
end
|
29
32
|
@services = EPPClient::SCHEMAS_URL.values_at('domain', 'contact')
|
30
33
|
args[:port] ||= 700
|
31
34
|
super(args)
|
@@ -46,18 +49,18 @@ module EPPClient
|
|
46
49
|
def domain_check_process(xml) # :nodoc:
|
47
50
|
ret = super
|
48
51
|
xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:chkData/frnic:domain/frnic:cd', EPPClient::SCHEMAS_URL).each do |dom|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
name = dom.xpath('frnic:name', EPPClient::SCHEMAS_URL)
|
53
|
+
hash = ret.find { |d| d[:name] == name.text }
|
54
|
+
hash[:reserved] = name.attr('reserved').value == '1'
|
55
|
+
unless (reason = dom.xpath('frnic:rsvReason', EPPClient::SCHEMAS_URL).text).empty?
|
56
|
+
hash[:rsvReason] = reason
|
57
|
+
end
|
58
|
+
hash[:forbidden] = name.attr('forbidden').value == '1'
|
59
|
+
unless (reason = dom.xpath('frnic:fbdReason', EPPClient::SCHEMAS_URL).text).empty?
|
60
|
+
hash[:fbdReason] = reason
|
61
|
+
end
|
59
62
|
end
|
60
|
-
|
63
|
+
ret
|
61
64
|
end
|
62
65
|
|
63
66
|
# Extends the EPPClient::Domain#domain_info so that the specific AFNIC
|
@@ -69,8 +72,8 @@ module EPPClient
|
|
69
72
|
def domain_info_process(xml) #:nodoc:
|
70
73
|
ret = super
|
71
74
|
if (frnic_status = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:infData/frnic:domain/frnic:status', EPPClient::SCHEMAS_URL)).size > 0
|
72
|
-
|
73
|
-
|
75
|
+
ret[:status] ||= [] # The status is optional, there may be none at this point.
|
76
|
+
ret[:status] += frnic_status.map { |s| s.attr('s') }
|
74
77
|
end
|
75
78
|
ret
|
76
79
|
end
|
@@ -79,33 +82,33 @@ module EPPClient
|
|
79
82
|
def legalEntityInfos(leI) #:nodoc:
|
80
83
|
ret = {}
|
81
84
|
ret[:legalStatus] = leI.xpath('frnic:legalStatus', EPPClient::SCHEMAS_URL).attr('s').value
|
82
|
-
if (r = leI.xpath(
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
if (r = leI.xpath('frnic:idStatus', EPPClient::SCHEMAS_URL)).size > 0
|
86
|
+
ret[:idStatus] = { :value => r.text }
|
87
|
+
ret[:idStatus][:when] = r.attr('when').value if r.attr('when')
|
88
|
+
ret[:idStatus][:source] = r.attr('source').value if r.attr('source')
|
86
89
|
end
|
87
90
|
%w(siren VAT trademark DUNS local).each do |val|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
if (r = leI.xpath("frnic:#{val}", EPPClient::SCHEMAS_URL)).size > 0
|
92
|
+
ret[val.to_sym] = r.text
|
93
|
+
end
|
91
94
|
end
|
92
|
-
if (asso = leI.xpath(
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
95
|
+
if (asso = leI.xpath('frnic:asso', EPPClient::SCHEMAS_URL)).size > 0
|
96
|
+
ret[:asso] = {}
|
97
|
+
if (r = asso.xpath('frnic:waldec', EPPClient::SCHEMAS_URL)).size > 0
|
98
|
+
ret[:asso][:waldec] = r.text
|
99
|
+
else
|
100
|
+
if (decl = asso.xpath('frnic:decl', EPPClient::SCHEMAS_URL)).size > 0
|
101
|
+
ret[:asso][:decl] = Date.parse(decl.text)
|
102
|
+
end
|
103
|
+
publ = asso.xpath('frnic:publ', EPPClient::SCHEMAS_URL)
|
104
|
+
ret[:asso][:publ] = {
|
105
|
+
:date => Date.parse(publ.text),
|
106
|
+
:page => publ.attr('page').value,
|
107
|
+
}
|
108
|
+
if (announce = publ.attr('announce')) && announce.value != '0'
|
109
|
+
ret[:asso][:publ][:announce] = announce.value
|
110
|
+
end
|
111
|
+
end
|
109
112
|
end
|
110
113
|
ret
|
111
114
|
end
|
@@ -180,51 +183,51 @@ module EPPClient
|
|
180
183
|
def contact_info_process(xml) #:nodoc:
|
181
184
|
ret = super
|
182
185
|
if (contact = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:infData/frnic:contact', EPPClient::SCHEMAS_URL)).size > 0
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
186
|
+
if (list = contact.xpath('frnic:list', EPPClient::SCHEMAS_URL)).size > 0
|
187
|
+
ret[:list] = list.map(&:text)
|
188
|
+
end
|
189
|
+
if (firstName = contact.xpath('frnic:firstName', EPPClient::SCHEMAS_URL)).size > 0
|
190
|
+
ret[:firstName] = firstName.text
|
191
|
+
end
|
192
|
+
if (iI = contact.xpath('frnic:individualInfos', EPPClient::SCHEMAS_URL)).size > 0
|
193
|
+
ret[:individualInfos] = {}
|
194
|
+
ret[:individualInfos][:birthDate] = Date.parse(iI.xpath('frnic:birthDate', EPPClient::SCHEMAS_URL).text)
|
195
|
+
if (r = iI.xpath('frnic:idStatus', EPPClient::SCHEMAS_URL)).size > 0
|
196
|
+
ret[:individualInfos][:idStatus] = { :value => r.text }
|
197
|
+
ret[:individualInfos][:idStatus][:when] = r.attr('when').value if r.attr('when')
|
198
|
+
ret[:individualInfos][:idStatus][:source] = r.attr('source').value if r.attr('source')
|
199
|
+
end
|
200
|
+
%w(birthCity birthPc birthCc).each do |val|
|
201
|
+
if (r = iI.xpath("frnic:#{val}", EPPClient::SCHEMAS_URL)).size > 0
|
202
|
+
ret[:individualInfos][val.to_sym] = r.text
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
if (leI = contact.xpath('frnic:legalEntityInfos', EPPClient::SCHEMAS_URL)).size > 0
|
207
|
+
ret[:legalEntityInfos] = legalEntityInfos(leI)
|
208
|
+
end
|
209
|
+
if (obsoleted = contact.xpath('frnic:obsoleted', EPPClient::SCHEMAS_URL)).size > 0
|
210
|
+
if obsoleted.text != '0'
|
211
|
+
ret[:obsoleted] = {}
|
212
|
+
if (v_when = obsoleted.attr('when'))
|
213
|
+
ret[:obsoleted][:when] = DateTime.parse(v_when.value)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
if (reachable = contact.xpath('frnic:reachable', EPPClient::SCHEMAS_URL)).size > 0
|
218
|
+
if reachable.text != '0'
|
219
|
+
ret[:reachable] = {}
|
220
|
+
if (v_when = reachable.attr('when'))
|
221
|
+
ret[:reachable][:when] = DateTime.parse(v_when.value)
|
222
|
+
end
|
223
|
+
if (media = reachable.attr('media'))
|
224
|
+
ret[:reachable][:media] = media.value
|
225
|
+
end
|
226
|
+
if (source = reachable.attr('source'))
|
227
|
+
ret[:reachable][:source] = source.value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
228
231
|
end
|
229
232
|
ret
|
230
233
|
end
|
@@ -233,65 +236,55 @@ module EPPClient
|
|
233
236
|
ret = super
|
234
237
|
|
235
238
|
ext = extension do |xml|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
if contact.key?(:reachable)
|
286
|
-
if Hash === (reachable = contact[:reachable])
|
287
|
-
xml.reachable(reachable, 1)
|
288
|
-
else
|
289
|
-
raise ArgumentError, "reachable has to be a Hash"
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
end
|
239
|
+
xml.ext(:xmlns => EPPClient::SCHEMAS_URL['frnic']) do
|
240
|
+
xml.create do
|
241
|
+
xml.contact do
|
242
|
+
if contact.key?(:legalEntityInfos)
|
243
|
+
lEI = contact[:legalEntityInfos]
|
244
|
+
xml.legalEntityInfos do
|
245
|
+
xml.idStatus(lEI[:idStatus]) if lEI.key?(:idStatus)
|
246
|
+
xml.legalStatus(:s => lEI[:legalStatus])
|
247
|
+
[:siren, :VAT, :trademark, :DUNS, :local].each do |val|
|
248
|
+
xml.__send__(val, lEI[val]) if lEI.key?(val)
|
249
|
+
end
|
250
|
+
if lEI.key?(:asso)
|
251
|
+
asso = lEI[:asso]
|
252
|
+
xml.asso do
|
253
|
+
if asso.key?(:waldec)
|
254
|
+
xml.waldec(asso[:waldec])
|
255
|
+
else
|
256
|
+
xml.decl(asso[:decl]) if asso.key?(:decl)
|
257
|
+
attrs = { :page => asso[:publ][:page] }
|
258
|
+
attrs[:announce] = asso[:publ][:announce] if asso[:publ].key?(:announce)
|
259
|
+
xml.publ(attrs, asso[:publ][:date])
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
else
|
265
|
+
xml.list(contact[:list]) if contact.key?(:list)
|
266
|
+
if contact.key?(:individualInfos)
|
267
|
+
iI = contact[:individualInfos]
|
268
|
+
xml.individualInfos do
|
269
|
+
xml.idStatus(iI[:idStatus]) if iI.key?(:idStatus)
|
270
|
+
xml.birthDate(iI[:birthDate])
|
271
|
+
xml.birthCity(iI[:birthCity]) if iI.key?(:birthCity)
|
272
|
+
xml.birthPc(iI[:birthPc]) if iI.key?(:birthPc)
|
273
|
+
xml.birthCc(iI[:birthCc])
|
274
|
+
end
|
275
|
+
end
|
276
|
+
xml.firstName(contact[:firstName]) if contact.key?(:firstName)
|
277
|
+
end
|
278
|
+
if contact.key?(:reachable)
|
279
|
+
reachable = contact[:reachable]
|
280
|
+
|
281
|
+
fail ArgumentError, 'reachable has to be a Hash' unless reachable.is_a?(Hash)
|
282
|
+
|
283
|
+
xml.reachable(reachable, 1)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
295
288
|
end
|
296
289
|
|
297
290
|
insert_extension(ret, ext)
|
@@ -370,8 +363,8 @@ module EPPClient
|
|
370
363
|
def contact_create_process(xml) #:nodoc:
|
371
364
|
ret = super
|
372
365
|
if (creData = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:creData', EPPClient::SCHEMAS_URL)).size > 0
|
373
|
-
|
374
|
-
|
366
|
+
ret[:nhStatus] = creData.xpath('frnic:nhStatus', EPPClient::SCHEMAS_URL).attr('new').value == '1'
|
367
|
+
ret[:idStatus] = creData.xpath('frnic:idStatus', EPPClient::SCHEMAS_URL).text
|
375
368
|
end
|
376
369
|
ret
|
377
370
|
end
|
@@ -380,52 +373,45 @@ module EPPClient
|
|
380
373
|
# <tt>:ns</tt>, <tt>:dsData</tt> or <tt>:keyData</tt> records, AFNIC's
|
381
374
|
# servers sends quite a strange error when there is.
|
382
375
|
def domain_create(args)
|
383
|
-
|
384
|
-
|
376
|
+
fail ArgumentError, "You can't create a domain with ns records, you must do an update afterwards" if args.key?(:ns)
|
377
|
+
fail ArgumentError, "You can't create a domain with ds or key records, you must do an update afterwards" if args.key?(:dsData) || args.key?(:keyData)
|
385
378
|
super
|
386
379
|
end
|
387
380
|
|
388
381
|
# Raises an exception, as contacts are deleted with a garbage collector.
|
389
|
-
def contact_delete(
|
390
|
-
|
382
|
+
def contact_delete(_args)
|
383
|
+
fail NotImplementedError, 'Contacts are deleted with a garbage collector'
|
391
384
|
end
|
392
385
|
|
393
386
|
def contact_update_xml(args) #:nodoc:
|
394
387
|
ret = super
|
395
388
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
end
|
420
|
-
end
|
421
|
-
end
|
422
|
-
end
|
423
|
-
end
|
424
|
-
|
425
|
-
return insert_extension(ret, ext)
|
426
|
-
else
|
427
|
-
return ret
|
389
|
+
return ret unless [:add, :rem].any? { |c| args.key?(c) && [:list, :reachable, :idStatus].any? { |k| args[c].key?(k) } }
|
390
|
+
|
391
|
+
ext = extension do |xml|
|
392
|
+
xml.ext(:xmlns => EPPClient::SCHEMAS_URL['frnic']) do
|
393
|
+
xml.update do
|
394
|
+
xml.contact do
|
395
|
+
[:add, :rem].each do |c|
|
396
|
+
next unless args.key?(c) && [:list, :reachable, :idStatus].any? { |k| args[c].key?(k) }
|
397
|
+
xml.__send__(c) do
|
398
|
+
xml.list(args[c][:list]) if args[c].key?(:list)
|
399
|
+
xml.idStatus(args[c][:idStatus]) if args[c].key?(:idStatus)
|
400
|
+
if args[c].key?(:reachable)
|
401
|
+
reachable = args[c][:reachable]
|
402
|
+
|
403
|
+
fail ArgumentError, 'reachable has to be a Hash' unless reachable.is_a?(Hash)
|
404
|
+
|
405
|
+
xml.reachable(reachable, 1)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
428
412
|
end
|
413
|
+
|
414
|
+
insert_extension(ret, ext)
|
429
415
|
end
|
430
416
|
|
431
417
|
# Extends the EPPClient::Contact#contact_update so that the specific AFNIC
|
@@ -455,18 +441,18 @@ module EPPClient
|
|
455
441
|
# * update status & authInfo
|
456
442
|
def domain_update(args)
|
457
443
|
if args.key?(:chg) && args[:chg].key?(:registrant)
|
458
|
-
|
444
|
+
fail ArgumentError, 'You need to do a trade or recover operation to change the registrant'
|
459
445
|
end
|
460
446
|
has_contacts = args.key?(:add) && args[:add].key?(:contacts) || args.key?(:add) && args[:add].key?(:contacts)
|
461
447
|
has_ns = args.key?(:add) && args[:add].key?(:ns) || args.key?(:add) && args[:add].key?(:ns)
|
462
448
|
has_other = args.key?(:add) && args[:add].key?(:status) || args.key?(:add) && args[:add].key?(:status) || args.key?(:chg) && args[:chg].key?(:authInfo)
|
463
|
-
if [has_contacts, has_ns, has_other].
|
464
|
-
|
449
|
+
if [has_contacts, has_ns, has_other].count { |v| v } > 1
|
450
|
+
fail ArgumentError, "You can't update all that at one time"
|
465
451
|
end
|
466
452
|
[:add, :rem].each do |ar|
|
467
|
-
|
468
|
-
|
469
|
-
|
453
|
+
if args.key?(ar) && args[ar].key?(:ns) && args[ar][:ns].first.is_a?(String)
|
454
|
+
args[ar][:ns] = args[ar][:ns].map { |ns| { :hostName => ns } }
|
455
|
+
end
|
470
456
|
end
|
471
457
|
super
|
472
458
|
end
|
@@ -481,20 +467,20 @@ module EPPClient
|
|
481
467
|
|
482
468
|
def contact_afnic_qualification(xml) #:nodoc:
|
483
469
|
contact = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:quaData/frnic:contact', EPPClient::SCHEMAS_URL)
|
484
|
-
ret = {:id => contact.xpath('frnic:id', EPPClient::SCHEMAS_URL).text}
|
470
|
+
ret = { :id => contact.xpath('frnic:id', EPPClient::SCHEMAS_URL).text }
|
485
471
|
qP = contact.xpath('frnic:qualificationProcess', EPPClient::SCHEMAS_URL)
|
486
|
-
ret[:qualificationProcess] = {:s => qP.attr('s').value}
|
472
|
+
ret[:qualificationProcess] = { :s => qP.attr('s').value }
|
487
473
|
ret[:qualificationProcess][:lang] = qP.attr('lang').value if qP.attr('lang')
|
488
474
|
if (leI = contact.xpath('frnic:legalEntityInfos', EPPClient::SCHEMAS_URL)).size > 0
|
489
|
-
|
475
|
+
ret[:legalEntityInfos] = legalEntityInfos(leI)
|
490
476
|
end
|
491
477
|
reach = contact.xpath('frnic:reachability', EPPClient::SCHEMAS_URL)
|
492
|
-
ret[:reachability] = {:reStatus => reach.xpath('frnic:reStatus', EPPClient::SCHEMAS_URL).text}
|
478
|
+
ret[:reachability] = { :reStatus => reach.xpath('frnic:reStatus', EPPClient::SCHEMAS_URL).text }
|
493
479
|
if (voice = reach.xpath('frnic:voice', EPPClient::SCHEMAS_URL)).size > 0
|
494
|
-
|
480
|
+
ret[:reachability][:voice] = voice.text
|
495
481
|
end
|
496
482
|
if (email = reach.xpath('frnic:email', EPPClient::SCHEMAS_URL)).size > 0
|
497
|
-
|
483
|
+
ret[:reachability][:email] = email.text
|
498
484
|
end
|
499
485
|
ret
|
500
486
|
end
|
@@ -504,23 +490,23 @@ module EPPClient
|
|
504
490
|
def domain_afnic_trade_response(xml) #:nodoc:
|
505
491
|
dom = xml.xpath('epp:extension/frnic:ext/frnic:resData/frnic:trdData/frnic:domain', EPPClient::SCHEMAS_URL)
|
506
492
|
ret = {
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
493
|
+
:name => dom.xpath('frnic:name', EPPClient::SCHEMAS_URL).text,
|
494
|
+
:trStatus => dom.xpath('frnic:trStatus', EPPClient::SCHEMAS_URL).text,
|
495
|
+
:reID => dom.xpath('frnic:reID', EPPClient::SCHEMAS_URL).text,
|
496
|
+
:reDate => DateTime.parse(dom.xpath('frnic:reDate', EPPClient::SCHEMAS_URL).text),
|
497
|
+
:acID => dom.xpath('frnic:acID', EPPClient::SCHEMAS_URL).text,
|
512
498
|
}
|
513
499
|
|
514
500
|
# FIXME: there are discrepencies between the 1.2 xmlschema, the documentation and the reality, I'm trying to stick to reality here.
|
515
501
|
%w(reHldID acHldID).each do |f|
|
516
|
-
|
517
|
-
|
518
|
-
|
502
|
+
if (field = dom.xpath("frnic:#{f}", EPPClient::SCHEMAS_URL)).size > 0
|
503
|
+
ret[f.to_sym] = field.text
|
504
|
+
end
|
519
505
|
end
|
520
506
|
%w(rhDate ahDate).each do |f|
|
521
|
-
|
522
|
-
|
523
|
-
|
507
|
+
if (field = dom.xpath("frnic:#{f}", EPPClient::SCHEMAS_URL)).size > 0
|
508
|
+
ret[f.to_sym] = DateTime.parse(field.text)
|
509
|
+
end
|
524
510
|
end
|
525
511
|
ret
|
526
512
|
end
|