Class: IPay::Response
- Inherits:
-
Object
- Object
- IPay::Response
- Defined in:
- lib/ipay/response.rb
Constant Summary collapse
- PARSER_OPT =
XML::Parser::Options::NOBLANKS | XML::Parser::Options::NOERROR | XML::Parser::Options::RECOVER | XML::Parser::Options::NOWARNING
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#raw_xml ⇒ Object
readonly
Returns the value of attribute raw_xml.
-
#server_time ⇒ Object
readonly
Returns the value of attribute server_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(xml) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
12 13 14 15 16 17 18 19 |
# File 'lib/ipay/response.rb', line 12 def initialize(xml) if IPay::config.dry_run @status = {:arc => '00', :mrc => '00', :description => 'Dry Run, no response processed'} else @raw_xml = xml parse_response @raw_xml end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/ipay/response.rb', line 10 def data @data end |
#raw_xml ⇒ Object (readonly)
Returns the value of attribute raw_xml.
10 11 12 |
# File 'lib/ipay/response.rb', line 10 def raw_xml @raw_xml end |
#server_time ⇒ Object (readonly)
Returns the value of attribute server_time.
10 11 12 |
# File 'lib/ipay/response.rb', line 10 def server_time @server_time end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/ipay/response.rb', line 10 def status @status end |
Instance Method Details
#error? ⇒ Boolean
25 26 27 |
# File 'lib/ipay/response.rb', line 25 def error? not success? end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/ipay/response.rb', line 21 def success? @status[:arc] == '00' && @status[:mrc] == '00' end |