class PayWithAmazon::Response

This class provides helpers to parse the response

Public Class Methods

new(response) click to toggle source
# File lib/pay_with_amazon/response.rb, line 8
def initialize(response)
  @response = response
end

Public Instance Methods

body() click to toggle source
# File lib/pay_with_amazon/response.rb, line 12
def body
  @response.body
end
code() click to toggle source
# File lib/pay_with_amazon/response.rb, line 28
def code
  @response.code
end
get_element(xpath, xml_element) click to toggle source
# File lib/pay_with_amazon/response.rb, line 20
def get_element(xpath, xml_element)
  xml = self.to_xml
  xml.elements.each(xpath) do |element|
    @value = element.elements[xml_element].text
  end
  return @value
end
success() click to toggle source
# File lib/pay_with_amazon/response.rb, line 32
def success
 if @response.code.eql? '200'
    return true
 else
    return false
 end
end
to_xml() click to toggle source
# File lib/pay_with_amazon/response.rb, line 16
def to_xml
  REXML::Document.new(body)
end