Class: WirecardMapper::Response
- Inherits:
-
Object
- Object
- WirecardMapper::Response
show all
- Defined in:
- lib/wirecardmapper/response.rb
Instance Method Summary
collapse
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
4
5
6
7
8
9
|
# File 'lib/wirecardmapper/response.rb', line 4
def initialize(xml)
@doc = Nokogiri::XML(xml)
if @doc.at_css('issuer-response').nil?
raise WirecardMapper::Exception, "No valid wirecard issuer-response"
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/wirecardmapper/response.rb', line 37
def method_missing(method, *args)
node_name = method.to_s.gsub(/_/, '-')
node = @doc.at_css(node_name)
unless node.nil?
parse(@doc.at_css(node_name).content)
else
super
end
end
|
Instance Method Details
#account_number ⇒ Object
31
32
33
|
# File 'lib/wirecardmapper/response.rb', line 31
def account_number
@doc.at_css('account-number').content
end
|
#bank_code ⇒ Object
27
28
29
|
# File 'lib/wirecardmapper/response.rb', line 27
def bank_code
@doc.at_css('bank-code').content
end
|
#card_number ⇒ Object
23
24
25
|
# File 'lib/wirecardmapper/response.rb', line 23
def card_number
@doc.at_css('card-number').content
end
|
#card_security_code ⇒ Object
19
20
21
|
# File 'lib/wirecardmapper/response.rb', line 19
def card_security_code
@doc.at_css('card-security-code').content
end
|
#ok? ⇒ Boolean
15
16
17
|
# File 'lib/wirecardmapper/response.rb', line 15
def ok?
return_code.to_i.eql?(0) || return_code.to_i.eql?(21)
end
|
#to_s ⇒ Object
11
12
13
|
# File 'lib/wirecardmapper/response.rb', line 11
def to_s
@doc.to_s
end
|