class AmazonPay::Response
This class provides helpers to parse the response
Public Class Methods
new(response)
click to toggle source
# File lib/amazon_pay/response.rb, line 6 def initialize(response) @response = response end
Public Instance Methods
body()
click to toggle source
# File lib/amazon_pay/response.rb, line 10 def body @response.body end
code()
click to toggle source
# File lib/amazon_pay/response.rb, line 27 def code @response.code end
get_element(xpath, xml_element)
click to toggle source
# File lib/amazon_pay/response.rb, line 18 def get_element(xpath, xml_element) xml = to_xml value = nil xml.elements.each(xpath) do |element| value = element.elements[xml_element].text end value end
success()
click to toggle source
# File lib/amazon_pay/response.rb, line 31 def success @response.code.eql? '200' end
to_xml()
click to toggle source
# File lib/amazon_pay/response.rb, line 14 def to_xml REXML::Document.new(body) end