Class: NominetEPP::Contact::InfoResponse
Instance Method Summary
collapse
#method, #respond_to?, #respond_to_missing?
Constructor Details
Returns a new instance of InfoResponse.
4
5
6
7
8
9
10
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 4
def initialize(response)
raise ArgumentError, "must be an EPP::Response" unless response.kind_of?(EPP::Response)
super EPP::Contact::InfoResponse.new(response)
parse_truncated
ext_inf_data
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
43
44
45
46
47
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 43
def method_missing(method, *args, &block)
return super unless @response.respond_to?(method)
return @truncated[method.to_s] if @truncated.has_key?(method.to_s) @response.send(method, *args, &block)
end
|
Instance Method Details
#client_id ⇒ Object
33
34
35
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 33
def client_id
@truncated['clID'] || @response.client_id
end
|
#co_no ⇒ Object
26
27
28
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 26
def co_no
@contact_infData['co_no']
end
|
#creator_id ⇒ Object
36
37
38
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 36
def creator_id
@truncated['crID'] || @response.creator_id
end
|
#ext_inf_data ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 55
def ext_inf_data
@contact_infData = {}
[@response.extension].flatten.compact.each do |node|
next unless node.name == 'infData'
node.find('//contact-ext:infData', namespaces).each do |infData|
infData.children.each do |child|
next if child.empty?
key = child.name.gsub('-', '_')
case key
when 'opt_out'
@contact_infData['opt_out'] = child.content.strip == 'Y'
else
@contact_infData[key] = child.content.strip
end
end
end
end
end
|
#id ⇒ Object
12
13
14
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 12
def id
@response.id
end
|
#name ⇒ Object
16
17
18
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 16
def name
@response.id
end
|
#namespaces ⇒ Object
49
50
51
52
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 49
def namespaces
{ 'warning' => 'http://www.nominet.org.uk/epp/xml/std-warning-1.1',
'contact-ext' => 'http://www.nominet.org.uk/epp/xml/contact-nom-ext-1.0' }
end
|
#opt_out ⇒ Object
29
30
31
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 29
def opt_out
@contact_infData['opt_out']
end
|
#parse_truncated ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 74
def parse_truncated
@truncated = {}
[@response.extension].flatten.compact.each do |node|
next unless node.name == 'truncated-field'
fieldName = node.attributes["field-name"]
ns, field = fieldName.split(":", 2)
content = node.content.strip
content =~ /Full entry is '([^']*)'/
content = $1
@truncated[field.gsub('-','_')] = content
end
end
|
#trad_name ⇒ Object
23
24
25
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 23
def trad_name
@contact_infData['trad_name']
end
|
#type ⇒ Object
20
21
22
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 20
def type
@contact_infData['type']
end
|
#updator_id ⇒ Object
39
40
41
|
# File 'lib/nominet-epp/responses/contact/info_response.rb', line 39
def updator_id
@truncated['upID'] || @response.updator_id
end
|