module PX::Response

Constants

URL

Endpoint for Request / Response related posts

XML

Public Class Methods

build(data) click to toggle source
# File lib/px.rb, line 140
def self.build(data)
  params = {
    uid: UID,
    key: KEY,

    # The only key we require for PX::Response
    # is `response` which is obtained after
    # a successful redirect with the `result`
    # query string parameter.
    #
    response: data.fetch(:response),

    this: Hache,
  }

  mote(XML, params)
end
parse(xml) click to toggle source
# File lib/px.rb, line 126
def self.parse(xml)
  dict = XmlSimple.xml_in(xml, forcearray: false)

  PX::Util.log(:info, self.name, dict.inspect)

  if dict["valid"] == "1" && dict["Success"] == "1"
    # Provide a more agnostic term so outside code
    # fetching it won't look too tied to PX.
    dict[:token] = dict["DpsBillingId"]

    return dict
  end
end