epp-client-hostmaster 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -25,6 +25,67 @@ module EPPClient
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def contact_info_process(xml) #:nodoc:
|
29
|
+
contact = xml.xpath('epp:resData/contact:infData', EPPClient::SCHEMAS_URL)
|
30
|
+
ret = {
|
31
|
+
:id => contact.xpath('contact:id', EPPClient::SCHEMAS_URL).text,
|
32
|
+
:roid => contact.xpath('contact:roid', EPPClient::SCHEMAS_URL).text,
|
33
|
+
}
|
34
|
+
if (status = contact.xpath('contact:status', EPPClient::SCHEMAS_URL)).size > 0
|
35
|
+
ret[:status] = status.map {|s| s.attr('s')}
|
36
|
+
end
|
37
|
+
|
38
|
+
if (postalInfo = contact.xpath('contact:postalInfo', EPPClient::SCHEMAS_URL)).size > 0
|
39
|
+
ret[:postalInfo] = postalInfo.inject({}) do |acc, p|
|
40
|
+
type = p.attr('type').to_sym
|
41
|
+
acc[type] = { :name => p.xpath('contact:name', EPPClient::SCHEMAS_URL).text, :addr => {} }
|
42
|
+
if (org = p.xpath('contact:org', EPPClient::SCHEMAS_URL)).size > 0
|
43
|
+
acc[type][:org] = org.text
|
44
|
+
end
|
45
|
+
addr = p.xpath('contact:addr', EPPClient::SCHEMAS_URL)
|
46
|
+
|
47
|
+
acc[type][:addr][:street] = addr.xpath('contact:street', EPPClient::SCHEMAS_URL).map {|s| s.text}
|
48
|
+
%w(city cc).each do |val|
|
49
|
+
acc[type][:addr][val.to_sym] = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL).text
|
50
|
+
end
|
51
|
+
%w(sp pc).each do |val|
|
52
|
+
if (r = addr.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
|
53
|
+
acc[type][:addr][val.to_sym] = r.text
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
acc
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
%w(voice fax email clID crID upID).each do |val|
|
62
|
+
if (value = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
|
63
|
+
ret[val.to_sym] = value.text
|
64
|
+
end
|
65
|
+
end
|
66
|
+
%w(crDate upDate trDate).each do |val|
|
67
|
+
if (date = contact.xpath("contact:#{val}", EPPClient::SCHEMAS_URL)).size > 0
|
68
|
+
ret[val.to_sym] = DateTime.parse(date.text)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
if (authInfo = contact.xpath('contact:authInfo', EPPClient::SCHEMAS_URL)).size > 0
|
72
|
+
ret[:authInfo] = authInfo.xpath('contact:pw', EPPClient::SCHEMAS_URL).text
|
73
|
+
end
|
74
|
+
# TODO
|
75
|
+
#if (disclose = contact.xpath('contact:disclose', EPPClient::SCHEMAS_URL)).size > 0
|
76
|
+
# ret[:disclose] = { :flag => disclose.attr('flag').value == '1', :elements => [] }
|
77
|
+
# disclose.children.each do |c|
|
78
|
+
# r = { :name => c.name }
|
79
|
+
# unless (type = c.attr('type').value).nil?
|
80
|
+
# r[:type] == type
|
81
|
+
# end
|
82
|
+
# ret[:disclose][:elements] << r
|
83
|
+
# end
|
84
|
+
#end
|
85
|
+
ret
|
86
|
+
end
|
87
|
+
|
88
|
+
|
28
89
|
def contact_disclose_xml(xml, disclose)
|
29
90
|
[:show, :hide].each do |operation|
|
30
91
|
next unless disclose.key? operation
|
@@ -97,10 +97,10 @@ module EPPClient
|
|
97
97
|
ret[:status] = status.map {|s| s.attr('s')}
|
98
98
|
end
|
99
99
|
|
100
|
-
if (value = host.xpath('host:addr', EPPClient::SCHEMAS_URL
|
100
|
+
if (value = host.xpath('host:addr[@ip="v4"]', EPPClient::SCHEMAS_URL)).size > 0
|
101
101
|
ret[:addrv4] = value.map {|ip| IPAddr.new(ip.text)}
|
102
102
|
end
|
103
|
-
if (value = host.xpath('host:addr', EPPClient::SCHEMAS_URL
|
103
|
+
if (value = host.xpath('host:addr[@ip="v6"]', EPPClient::SCHEMAS_URL)).size > 0
|
104
104
|
ret[:addrv6] = value.map {|ip| IPAddr.new(ip.text)}
|
105
105
|
end
|
106
106
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require "epp-client/base"
|
2
|
-
require "
|
3
|
-
require "
|
4
|
-
require "
|
5
|
-
require "
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
require "
|
2
|
+
require "#{File.dirname(__FILE__)}/hostmaster-xml"
|
3
|
+
require "#{File.dirname(__FILE__)}/hostmaster-connection"
|
4
|
+
require "#{File.dirname(__FILE__)}/hostmaster-domain"
|
5
|
+
require "#{File.dirname(__FILE__)}/hostmaster-contact"
|
6
|
+
require "#{File.dirname(__FILE__)}/hostmaster-host"
|
7
|
+
require "#{File.dirname(__FILE__)}/hostmaster-rgp"
|
8
|
+
require "#{File.dirname(__FILE__)}/hostmaster-transfer"
|
9
9
|
|
10
10
|
module EPPClient
|
11
11
|
class Hostmaster < Base
|
12
|
-
VERSION = '0.2.
|
12
|
+
VERSION = '0.2.3'
|
13
13
|
|
14
14
|
SCHEMAS = %w(domain-1.1 host-1.1 contact-1.1 rgp-1.1)
|
15
15
|
|
data/lib/epp-client.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "epp-client/hostmaster"
|
1
|
+
require "#{File.dirname(__FILE__)}/epp-client/hostmaster"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epp-client-hostmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|