Sha256: aeafad682a4bc5beafab6bb4912052e6a2505807aaacfc01d08a174e44c6a134
Contents?: true
Size: 931 Bytes
Versions: 4
Compression:
Stored size: 931 Bytes
Contents
module Pxpay # The return notification from Payment Express class Notification attr_accessor :response # Create a new Notification from Payment Express' response def initialize(response) @response = response end # Return the xml response def to_xml response end # Return the response as a hash def to_hash require 'nokogiri' doc = ::Nokogiri::XML( self.response ) hash = {} doc.at_css("Response").element_children.each do |attribute| hash[attribute.name.underscore.to_sym] = attribute.inner_text end hash[:valid] = doc.at_css("Response")['valid'] hash end end end class String # A copy of Rails' ActiveSupport underscore method def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pxpay-0.1.8 | lib/pxpay/notification.rb |
pxpay-0.1.5 | lib/pxpay/notification.rb |
pxpay-0.1.3 | lib/pxpay/notification.rb |
pxpay-0.1.2 | lib/pxpay/notification.rb |