4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/simple_qs/responce/failure_builder.rb', line 4
def self.build responce
responce.instance_eval do
def sender_error?
@xml_data[root_element]['Error']['Type'] == 'Sender'
end
def receiver_error?
@xml_data[root_element]['Error']['Type'] == 'Receiver'
end
def request_id
@xml_data[root_element]['RequestId']
end
def error_code
@xml_data[root_element]['Error']['Code'].gsub(/\./, '')
end
def error_message
@xml_data[root_element]['Error']['Message']
end
def to_error
self.class.const_get(error_code =~ /Error$/ ? error_code : "#{error_code}Error").new error_message
end
end
end
|