Class: PayXML::Message
- Inherits:
-
Object
- Object
- PayXML::Message
- Defined in:
- lib/payxml/message.rb
Overview
This class represents the base class for all XML message payloads used for the PayXML API.
Direct Known Subclasses
Constant Summary collapse
- PAYXML_VERSION_NUMBER =
'4.0'
Instance Attribute Summary collapse
-
#paygate_id ⇒ Object
Returns the value of attribute paygate_id.
-
#paygate_password ⇒ Object
Returns the value of attribute paygate_password.
Instance Method Summary collapse
-
#initialize(paygate_id, paygate_password) ⇒ Message
constructor
A new instance of Message.
- #parse(xml_string) ⇒ Object
- #xml_string ⇒ Object
Constructor Details
#initialize(paygate_id, paygate_password) ⇒ Message
Returns a new instance of Message.
13 14 15 16 |
# File 'lib/payxml/message.rb', line 13 def initialize( paygate_id, paygate_password ) self.paygate_id = paygate_id self.paygate_password = paygate_password end |
Instance Attribute Details
#paygate_id ⇒ Object
Returns the value of attribute paygate_id.
8 9 10 |
# File 'lib/payxml/message.rb', line 8 def paygate_id @paygate_id end |
#paygate_password ⇒ Object
Returns the value of attribute paygate_password.
9 10 11 |
# File 'lib/payxml/message.rb', line 9 def paygate_password @paygate_password end |
Instance Method Details
#parse(xml_string) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/payxml/message.rb', line 18 def parse(xml_string) doc = Nokogiri::XML(xml_string) protocol = doc.xpath("//protocol").first self.paygate_id = protocol['pgid'] self.paygate_password = protocol['pwd'] end |
#xml_string ⇒ Object
25 26 27 |
# File 'lib/payxml/message.rb', line 25 def xml_string xml_doc.to_s end |