epp-client-base 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA512:
3
- metadata.gz: 77ee35cbe7938f4361e9f66716814012f9c1f30c93f0a514bd1316ee7a33dd82fd266609b7fa6cac31ebe9ab43d9251465f6cee240ca9214800ec9d05e14d8b6
4
- data.tar.gz: f619b6f39bd0d9828ea288b9d7b3cd2ca05f9bca0cd7e6883c0471662b612fc750ce56aa03a2b64b84f2c396c0a3e660f6f471d0b717d388843c158fac6aee8e
5
2
  SHA1:
6
- metadata.gz: 1c6900dbf010bf125e1b3214cd193abed46fbfb3
7
- data.tar.gz: 3006a9a6ac7b05d6fe556cc02d92c93316a81e35
3
+ metadata.gz: f49097239ee4ebb706ad276429827cf648d8b046
4
+ data.tar.gz: 2d2827164f086591d6c46d5293313d4f7a11df1e
5
+ SHA512:
6
+ metadata.gz: 01e2016614a1fee29f2742aa5dabc964d39aaea655d9ac38bd5ab068c690747ad352d7140be457cb67e04ed67c01a52ccab8834988f241ee96fee3a7c1784aeb
7
+ data.tar.gz: 020cf0e3e96fa096c1d4ea620b520813f2ab82863bfa4cafdcd0fba774c221ee62144c7c14c88ec0f1a512460cad8eb71e6dd9e1083777935246a39d0ed395dd
data/Rakefile CHANGED
@@ -2,9 +2,9 @@
2
2
  require 'rake'
3
3
  require 'rdoc/task'
4
4
  require 'rubygems/package_task'
5
- require "bundler/gem_helper"
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 "Generate documentation for the Rails framework"
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 = "Documentation"
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
-
@@ -8,12 +8,12 @@ Gem::Specification.new do |gem|
8
8
  gem.email = ['m@absolight.fr']
9
9
  gem.description = 'An extensible EPP client library.'
10
10
  gem.summary = 'An extensible EPP client library'
11
- gem.homepage = "https://github.com/Absolight/epp-client"
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 = ">= 1.3.6"
14
+ gem.required_rubygems_version = '>= 1.3.6'
15
15
 
16
- gem.files = [
16
+ gem.files = [
17
17
  'ChangeLog',
18
18
  'Gemfile',
19
19
  'MIT-LICENSE',
@@ -47,7 +47,7 @@ Gem::Specification.new do |gem|
47
47
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
48
48
  gem.require_paths = ['lib']
49
49
 
50
- gem.add_development_dependency "bundler", ">= 1.0.0"
50
+ gem.add_development_dependency 'bundler', '>= 1.0.0'
51
51
  gem.add_dependency('nokogiri', '~> 1.4')
52
52
  gem.add_dependency('builder', '>= 2.1.2')
53
53
  end
@@ -3,7 +3,8 @@ require 'socket'
3
3
  require 'nokogiri'
4
4
  require 'builder'
5
5
  require 'date'
6
- require "epp-client/version"
6
+ require 'English'
7
+ require 'epp-client/version'
7
8
  require 'epp-client/xml'
8
9
  require 'epp-client/session'
9
10
  require 'epp-client/connection'
@@ -14,23 +15,26 @@ require 'epp-client/domain'
14
15
  require 'epp-client/contact'
15
16
 
16
17
  module EPPClient
18
+ # This is the base class.
19
+ #
20
+ # It can be used directly to talk to EPP servers that have no specific
21
+ # requirements.
17
22
  class Base
18
-
19
- SCHEMAS = %w[
23
+ SCHEMAS = %w(
20
24
  epp-1.0
21
25
  domain-1.0
22
26
  host-1.0
23
27
  contact-1.0
24
- ]
25
- SCHEMAS_EXT_IETF = %w[
28
+ )
29
+ SCHEMAS_EXT_IETF = %w(
26
30
  rgp-1.0
27
- ]
31
+ )
28
32
 
29
- EPPClient::SCHEMAS_URL = SCHEMAS.inject({}) do |a,s|
33
+ EPPClient::SCHEMAS_URL = SCHEMAS.inject({}) do |a, s|
30
34
  a[s.sub(/-1\.0$/, '')] = "urn:ietf:params:xml:ns:#{s}" if s =~ /-1\.0$/
31
35
  a[s] = "urn:ietf:params:xml:ns:#{s}"
32
36
  a
33
- end.merge!(SCHEMAS_EXT_IETF.inject({}) do |a,s|
37
+ end.merge!(SCHEMAS_EXT_IETF.inject({}) do |a, s|
34
38
  a[s.sub(/-1\.0$/, '')] = "urn:ietf:params:xml:ns:#{s}" if s =~ /-1\.0$/
35
39
  a[s] = "urn:ietf:params:xml:ns:#{s}"
36
40
  a
@@ -77,23 +81,23 @@ module EPPClient
77
81
  # [<tt>:ssl_key</tt>] The file containing the key of the certificate.
78
82
  def initialize(attrs)
79
83
  unless attrs.key?(:server) && attrs.key?(:client_id) && attrs.key?(:password)
80
- raise ArgumentError, "server, client_id and password are required"
84
+ fail ArgumentError, 'server, client_id and password are required'
81
85
  end
82
86
 
83
- attrs.each do |k,v|
84
- begin
85
- self.send("#{k}=", v)
86
- rescue NoMethodError
87
- raise ArgumentError, "there is no #{k} argument"
88
- end
87
+ attrs.each do |k, v|
88
+ begin
89
+ send("#{k}=", v)
90
+ rescue NoMethodError
91
+ raise ArgumentError, "there is no #{k} argument"
92
+ end
89
93
  end
90
94
 
91
95
  @port ||= 700
92
- @lang ||= "en"
96
+ @lang ||= 'en'
93
97
  @services ||= EPPClient::SCHEMAS_URL.values_at('domain', 'contact', 'host')
94
98
  @extensions ||= []
95
- @version ||= "1.0"
96
- @clTRID ||= "test-#{$$}-#{rand(1000)}"
99
+ @version ||= '1.0'
100
+ @clTRID ||= "test-#{$PROCESS_ID}-#{rand(1000)}"
97
101
  @clTRID_index = 0
98
102
 
99
103
  @context ||= OpenSSL::SSL::SSLContext.new
@@ -1,6 +1,6 @@
1
1
  module EPPClient
2
+ # This handles all the basic I/O for the connection.
2
3
  module Connection
3
-
4
4
  attr_reader :sent_frame, :recv_frame, :srv_version, :srv_lang, :srv_ns, :srv_ext
5
5
 
6
6
  # Establishes the connection to the server, if successful, will return the
@@ -16,63 +16,55 @@ module EPPClient
16
16
  @socket.connect
17
17
 
18
18
  # Get the initial greeting frame
19
- greeting_process(get_frame)
19
+ greeting_process(one_frame)
20
20
  end
21
21
 
22
22
  def greeting_process(xml) #:nodoc:
23
- @srv_version = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:version', EPPClient::SCHEMAS_URL).map {|n| n.text}
24
- @srv_lang = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:lang', EPPClient::SCHEMAS_URL).map {|n| n.text}
25
- @srv_ns = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:objURI', EPPClient::SCHEMAS_URL).map {|n| n.text}
23
+ @srv_version = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:version', EPPClient::SCHEMAS_URL).map(&:text)
24
+ @srv_lang = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:lang', EPPClient::SCHEMAS_URL).map(&:text)
25
+ @srv_ns = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:objURI', EPPClient::SCHEMAS_URL).map(&:text)
26
26
  if (ext = xml.xpath('epp:epp/epp:greeting/epp:svcMenu/epp:svcExtension/epp:extURI', EPPClient::SCHEMAS_URL)).size > 0
27
- @srv_ext = ext.map {|n| n.text}
27
+ @srv_ext = ext.map(&:text)
28
28
  end
29
29
 
30
- return xml
30
+ xml
31
31
  end
32
32
 
33
33
  # Gracefully close the connection
34
34
  def close_connection
35
- if defined?(@socket) and @socket.is_a?(OpenSSL::SSL::SSLSocket)
36
- @socket.close
37
- @socket = nil
35
+ if defined?(@socket) && @socket.is_a?(OpenSSL::SSL::SSLSocket)
36
+ @socket.close
37
+ @socket = nil
38
38
  end
39
39
 
40
- if defined?(@tcpserver) and @tcpserver.is_a?(TCPSocket)
41
- @tcpserver.close
42
- @tcpserver = nil
40
+ if defined?(@tcpserver) && @tcpserver.is_a?(TCPSocket)
41
+ @tcpserver.close
42
+ @tcpserver = nil
43
43
  end
44
44
 
45
- return true if @tcpserver.nil? and @socket.nil?
45
+ return true if @tcpserver.nil? && @socket.nil?
46
46
  end
47
47
 
48
48
  # Sends a frame and returns the server's answer
49
49
  def send_request(xml)
50
50
  send_frame(xml)
51
- get_frame
51
+ one_frame
52
52
  end
53
53
 
54
54
  # sends a frame
55
55
  def send_frame(xml)
56
56
  @sent_frame = xml
57
- @socket.write([xml.size + 4].pack("N") + xml)
57
+ @socket.write([xml.size + 4].pack('N') + xml)
58
58
  sent_frame_to_xml
59
- return
60
59
  end
61
60
 
62
61
  # gets a frame from the socket and returns the parsed response.
63
- def get_frame
62
+ def one_frame
64
63
  size = @socket.read(4)
65
- if size.nil?
66
- if @socket.eof?
67
- raise SocketError, "Connection closed by remote server"
68
- else
69
- raise SocketError, "Error reading frame from remote server"
70
- end
71
- else
72
- size = size.unpack('N')[0]
73
- @recv_frame = @socket.read(size - 4)
74
- recv_frame_to_xml
75
- end
64
+ fail SocketError, @socket.eof? ? 'Connection closed by remote server' : 'Error reading frame from remote server' if size.nil?
65
+ size = size.unpack('N')[0]
66
+ @recv_frame = @socket.read(size - 4)
67
+ recv_frame_to_xml
76
68
  end
77
69
  end
78
70
  end
@@ -1,16 +1,19 @@
1
1
  module EPPClient
2
+ # This module handles all the contact interactions.
3
+ #
4
+ # See RFC 5733 for more informations.
2
5
  module Contact
3
6
  EPPClient::Poll::PARSERS['contact:infData'] = :contact_info_process
4
7
 
5
8
  def contact_check_xml(*contacts) #:nodoc:
6
9
  command do |xml|
7
- xml.check do
8
- xml.check('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
9
- contacts.each do |c|
10
- xml.id(c)
11
- end
12
- end
13
- end
10
+ xml.check do
11
+ xml.check('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
12
+ contacts.each do |c|
13
+ xml.id(c)
14
+ end
15
+ end
16
+ end
14
17
  end
15
18
  end
16
19
 
@@ -34,29 +37,29 @@ module EPPClient
34
37
 
35
38
  def contact_check_process(xml) #:nodoc:
36
39
  xml.xpath('epp:resData/contact:chkData/contact:cd', EPPClient::SCHEMAS_URL).map do |dom|
37
- ret = {
38
- :name => dom.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
39
- :avail => dom.xpath('contact:id', EPPClient::SCHEMAS_URL).attr('avail').value == '1',
40
- }
41
- unless (reason = dom.xpath('contact:reason', EPPClient::SCHEMAS_URL).text).empty?
42
- ret[:reason] = reason
43
- end
44
- ret
40
+ ret = {
41
+ :name => dom.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
42
+ :avail => dom.xpath('contact:id', EPPClient::SCHEMAS_URL).attr('avail').value == '1',
43
+ }
44
+ unless (reason = dom.xpath('contact:reason', EPPClient::SCHEMAS_URL).text).empty?
45
+ ret[:reason] = reason
46
+ end
47
+ ret
45
48
  end
46
49
  end
47
50
 
48
51
  def contact_info_xml(args) #:nodoc:
49
52
  command do |xml|
50
- xml.info do
51
- xml.info('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
52
- xml.id(args[:id])
53
- if args.key?(:authInfo)
54
- xml.authInfo do
55
- xml.pw(args[:authInfo])
56
- end
57
- end
58
- end
59
- end
53
+ xml.info do
54
+ xml.info('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
55
+ xml.id(args[:id])
56
+ if args.key?(:authInfo)
57
+ xml.authInfo do
58
+ xml.pw(args[:authInfo])
59
+ end
60
+ end
61
+ end
62
+ end
60
63
  end
61
64
  end
62
65
 
@@ -114,13 +117,10 @@ module EPPClient
114
117
  # [<tt>:disclose</tt>]
115
118
  # an optional array that identifies elements that require exceptional
116
119
  # server-operator handling to allow or restrict disclosure to third
117
- # parties. See
118
- # section 2.9[http://tools.ietf.org/html/rfc5733#section-2.9] of RFC 5733
119
- # for details.
120
+ # parties. See {section 2.9 of RFC
121
+ # 5733}[http://tools.ietf.org/html/rfc5733#section-2.9] for details.
120
122
  def contact_info(args)
121
- if String === args
122
- args = {:id => args}
123
- end
123
+ args = { :id => args } if args.is_a?(String)
124
124
  response = send_request(contact_info_xml(args))
125
125
 
126
126
  get_result(:xml => response, :callback => :contact_info_process)
@@ -129,107 +129,107 @@ module EPPClient
129
129
  def contact_info_process(xml) #:nodoc:
130
130
  contact = xml.xpath('epp:resData/contact:infData', EPPClient::SCHEMAS_URL)
131
131
  ret = {
132
- :id => contact.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
133
- :roid => contact.xpath('contact:roid', EPPClient::SCHEMAS_URL).text,
132
+ :id => contact.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
133
+ :roid => contact.xpath('contact:roid', EPPClient::SCHEMAS_URL).text,
134
134
  }
135
135
  if (status = contact.xpath('contact:status', EPPClient::SCHEMAS_URL)).size > 0
136
- ret[:status] = status.map {|s| s.attr('s')}
136
+ ret[:status] = status.map { |s| s.attr('s') }
137
137
  end
138
138
 
139
139
  if (postalInfo = contact.xpath('contact:postalInfo', EPPClient::SCHEMAS_URL)).size > 0
140
- ret[:postalInfo] = postalInfo.inject({}) do |acc, p|
141
- type = p.attr('type').to_sym
142
- acc[type] = { :name => p.xpath('contact:name', EPPClient::SCHEMAS_URL).text, :addr => {} }
143
- if (org = p.xpath('contact:org', EPPClient::SCHEMAS_URL)).size > 0
144
- acc[type][:org] = org.text
145
- end
146
- addr = p.xpath('contact:addr', EPPClient::SCHEMAS_URL)
140
+ ret[:postalInfo] = postalInfo.inject({}) do |acc, p|
141
+ type = p.attr('type').to_sym
142
+ acc[type] = { :name => p.xpath('contact:name', EPPClient::SCHEMAS_URL).text, :addr => {} }
143
+ if (org = p.xpath('contact:org', EPPClient::SCHEMAS_URL)).size > 0
144
+ acc[type][:org] = org.text
145
+ end
146
+ addr = p.xpath('contact:addr', EPPClient::SCHEMAS_URL)
147
147
 
148
- acc[type][:addr][:street] = addr.xpath('contact:street', EPPClient::SCHEMAS_URL).map {|s| s.text}
149
- %w(city cc).each do |val|
150
- acc[type][:addr][val.to_sym] = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL).text
151
- end
152
- %w(sp pc).each do |val|
153
- if (r = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
154
- acc[type][:addr][val.to_sym] = r.text
155
- end
156
- end
148
+ acc[type][:addr][:street] = addr.xpath('contact:street', EPPClient::SCHEMAS_URL).map(&:text)
149
+ %w(city cc).each do |val|
150
+ acc[type][:addr][val.to_sym] = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL).text
151
+ end
152
+ %w(sp pc).each do |val|
153
+ if (r = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
154
+ acc[type][:addr][val.to_sym] = r.text
155
+ end
156
+ end
157
157
 
158
- acc
159
- end
158
+ acc
159
+ end
160
160
  end
161
161
 
162
162
  %w(voice fax email clID crID upID).each do |val|
163
- if (value = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
164
- ret[val.to_sym] = value.text
165
- end
163
+ if (value = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
164
+ ret[val.to_sym] = value.text
165
+ end
166
166
  end
167
167
  %w(crDate upDate trDate).each do |val|
168
- if (date = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
169
- ret[val.to_sym] = DateTime.parse(date.text)
170
- end
168
+ if (date = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
169
+ ret[val.to_sym] = DateTime.parse(date.text)
170
+ end
171
171
  end
172
172
  if (authInfo = contact.xpath('contact:authInfo', EPPClient::SCHEMAS_URL)).size > 0
173
- ret[:authInfo] = authInfo.xpath('contact:pw', EPPClient::SCHEMAS_URL).text
173
+ ret[:authInfo] = authInfo.xpath('contact:pw', EPPClient::SCHEMAS_URL).text
174
174
  end
175
175
  if (disclose = contact.xpath('contact:disclose', EPPClient::SCHEMAS_URL)).size > 0
176
- ret[:disclose] = { :flag => disclose.attr('flag').value == '1', :elements => [] }
177
- disclose.children.each do |c|
178
- r = { :name => c.name }
179
- unless (type = c.attr('type').value).nil?
180
- r[:type] == type
181
- end
182
- ret[:disclose][:elements] << r
183
- end
176
+ ret[:disclose] = { :flag => disclose.attr('flag').value == '1', :elements => [] }
177
+ disclose.children.each do |c|
178
+ r = { :name => c.name }
179
+ unless (type = c.attr('type').value).nil?
180
+ r[:type] == type
181
+ end
182
+ ret[:disclose][:elements] << r
183
+ end
184
184
  end
185
185
  ret
186
186
  end
187
187
 
188
188
  def contact_create_xml(contact) #:nodoc:
189
189
  command do |xml|
190
- xml.create do
191
- xml.create('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
192
- if contact.key?(:id)
193
- xml.id(contact[:id])
194
- else
195
- xml.id('invalid')
196
- end
197
- contact[:postalInfo].each do |type,infos|
198
- xml.postalInfo :type => type do
199
- xml.name(infos[:name])
200
- xml.org(infos[:org]) if infos.key?(:org)
201
- xml.addr do
202
- infos[:addr][:street].each do |street|
203
- xml.street(street)
204
- end
205
- xml.city(infos[:addr][:city])
206
- [:sp, :pc].each do |val|
207
- xml.__send__(val, infos[:addr][val]) if infos[:addr].key?(val)
208
- end
209
- xml.cc(infos[:addr][:cc])
210
- end
211
- end
212
- end
213
- [:voice, :fax].each do |val|
214
- xml.__send__(val, contact[val]) if contact.key?(val)
215
- end
216
- xml.email(contact[:email])
217
- xml.authInfo do
218
- xml.pw(contact[:authInfo])
219
- end
220
- if contact.key?(:disclose)
221
- xml.disclose do
222
- contact[:disclose].each do |disc|
223
- if disc.key?(:type)
224
- xml.__send__(disc[:name], :type => disc[:type])
225
- else
226
- xml.__send__(disc[:name])
227
- end
228
- end
229
- end
230
- end
231
- end
232
- end
190
+ xml.create do
191
+ xml.create('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
192
+ if contact.key?(:id)
193
+ xml.id(contact[:id])
194
+ else
195
+ xml.id('invalid')
196
+ end
197
+ contact[:postalInfo].each do |type, infos|
198
+ xml.postalInfo :type => type do
199
+ xml.name(infos[:name])
200
+ xml.org(infos[:org]) if infos.key?(:org)
201
+ xml.addr do
202
+ infos[:addr][:street].each do |street|
203
+ xml.street(street)
204
+ end
205
+ xml.city(infos[:addr][:city])
206
+ [:sp, :pc].each do |val|
207
+ xml.__send__(val, infos[:addr][val]) if infos[:addr].key?(val)
208
+ end
209
+ xml.cc(infos[:addr][:cc])
210
+ end
211
+ end
212
+ end
213
+ [:voice, :fax].each do |val|
214
+ xml.__send__(val, contact[val]) if contact.key?(val)
215
+ end
216
+ xml.email(contact[:email])
217
+ xml.authInfo do
218
+ xml.pw(contact[:authInfo])
219
+ end
220
+ if contact.key?(:disclose)
221
+ xml.disclose do
222
+ contact[:disclose].each do |disc|
223
+ if disc.key?(:type)
224
+ xml.__send__(disc[:name], :type => disc[:type])
225
+ else
226
+ xml.__send__(disc[:name])
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
233
  end
234
234
  end
235
235
 
@@ -264,9 +264,8 @@ module EPPClient
264
264
  # [<tt>:disclose</tt>]
265
265
  # an optional array that identifies elements that require exceptional
266
266
  # server-operator handling to allow or restrict disclosure to third
267
- # parties. See
268
- # section 2.9[http://tools.ietf.org/html/rfc5733#section-2.9] of RFC 5733
269
- # for details.
267
+ # parties. See {section 2.9 of RFC
268
+ # 5733}[http://tools.ietf.org/html/rfc5733#section-2.9] for details.
270
269
  #
271
270
  # Returns a hash with the following keys :
272
271
  #
@@ -281,18 +280,18 @@ module EPPClient
281
280
  def contact_create_process(xml) #:nodoc:
282
281
  contact = xml.xpath('epp:resData/contact:creData', EPPClient::SCHEMAS_URL)
283
282
  {
284
- :id => contact.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
285
- :crDate => DateTime.parse(contact.xpath('contact:crDate', EPPClient::SCHEMAS_URL).text),
283
+ :id => contact.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
284
+ :crDate => DateTime.parse(contact.xpath('contact:crDate', EPPClient::SCHEMAS_URL).text),
286
285
  }
287
286
  end
288
287
 
289
288
  def contact_delete_xml(contact) #:nodoc:
290
289
  command do |xml|
291
- xml.delete do
292
- xml.delete('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
293
- xml.id(contact)
294
- end
295
- end
290
+ xml.delete do
291
+ xml.delete('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
292
+ xml.id(contact)
293
+ end
294
+ end
296
295
  end
297
296
  end
298
297
 
@@ -309,67 +308,67 @@ module EPPClient
309
308
 
310
309
  def contact_update_xml(args) #:nodoc:
311
310
  command do |xml|
312
- xml.update do
313
- xml.update('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
314
- xml.id args[:id]
315
- if args.key?(:add) && args[:add].key?(:status)
316
- xml.add do
317
- args[:add][:status].each do |s|
318
- xml.status :s => s
319
- end
320
- end
321
- end
322
- if args.key?(:rem) && args[:rem].key?(:status)
323
- xml.rem do
324
- args[:rem][:status].each do |s|
325
- xml.status :s => s
326
- end
327
- end
328
- end
329
- if args.key?(:chg)
330
- contact = args[:chg]
331
- xml.chg do
332
- if contact.key?(:postalInfo)
333
- contact[:postalInfo].each do |type,infos|
334
- xml.postalInfo :type => type do
335
- xml.name(infos[:name])
336
- xml.org(infos[:org]) if infos.key?(:org)
337
- xml.addr do
338
- infos[:addr][:street].each do |street|
339
- xml.street(street)
340
- end
341
- xml.city(infos[:addr][:city])
342
- [:sp, :pc].each do |val|
343
- xml.__send__(val, infos[:addr][val]) if infos[:addr].key?(val)
344
- end
345
- xml.cc(infos[:addr][:cc])
346
- end
347
- end
348
- end
349
- end
350
- [:voice, :fax, :email].each do |val|
351
- xml.__send__(val, contact[val]) if contact.key?(val)
352
- end
353
- if contact.key?(:authInfo)
354
- xml.authInfo do
355
- xml.pw(contact[:authInfo])
356
- end
357
- end
358
- if contact.key?(:disclose)
359
- xml.disclose do
360
- contact[:disclose].each do |disc|
361
- if disc.key?(:type)
362
- xml.__send__(disc[:name], :type => disc[:type])
363
- else
364
- xml.__send__(disc[:name])
365
- end
366
- end
367
- end
368
- end
369
- end
370
- end
371
- end
372
- end
311
+ xml.update do
312
+ xml.update('xmlns' => EPPClient::SCHEMAS_URL['contact-1.0']) do
313
+ xml.id args[:id]
314
+ if args.key?(:add) && args[:add].key?(:status)
315
+ xml.add do
316
+ args[:add][:status].each do |s|
317
+ xml.status :s => s
318
+ end
319
+ end
320
+ end
321
+ if args.key?(:rem) && args[:rem].key?(:status)
322
+ xml.rem do
323
+ args[:rem][:status].each do |s|
324
+ xml.status :s => s
325
+ end
326
+ end
327
+ end
328
+ if args.key?(:chg)
329
+ contact = args[:chg]
330
+ xml.chg do
331
+ if contact.key?(:postalInfo)
332
+ contact[:postalInfo].each do |type, infos|
333
+ xml.postalInfo :type => type do
334
+ xml.name(infos[:name])
335
+ xml.org(infos[:org]) if infos.key?(:org)
336
+ xml.addr do
337
+ infos[:addr][:street].each do |street|
338
+ xml.street(street)
339
+ end
340
+ xml.city(infos[:addr][:city])
341
+ [:sp, :pc].each do |val|
342
+ xml.__send__(val, infos[:addr][val]) if infos[:addr].key?(val)
343
+ end
344
+ xml.cc(infos[:addr][:cc])
345
+ end
346
+ end
347
+ end
348
+ end
349
+ [:voice, :fax, :email].each do |val|
350
+ xml.__send__(val, contact[val]) if contact.key?(val)
351
+ end
352
+ if contact.key?(:authInfo)
353
+ xml.authInfo do
354
+ xml.pw(contact[:authInfo])
355
+ end
356
+ end
357
+ if contact.key?(:disclose)
358
+ xml.disclose do
359
+ contact[:disclose].each do |disc|
360
+ if disc.key?(:type)
361
+ xml.__send__(disc[:name], :type => disc[:type])
362
+ else
363
+ xml.__send__(disc[:name])
364
+ end
365
+ end
366
+ end
367
+ end
368
+ end
369
+ end
370
+ end
371
+ end
373
372
  end
374
373
  end
375
374