Class: AN::Response
- Inherits:
-
Object
- Object
- AN::Response
- Defined in:
- lib/an.rb
Constant Summary collapse
- OK =
"Ok"
Instance Method Summary collapse
- #[](key) ⇒ Object
- #authorization ⇒ Object
-
#initialize(xml) ⇒ Response
constructor
A new instance of Response.
- #payment_profile_id ⇒ Object
- #profile_id ⇒ Object
- #success? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
69 70 71 |
# File 'lib/an.rb', line 69 def initialize(xml) @data = XmlSimple.xml_in(xml, forcearray: false) end |
Instance Method Details
#[](key) ⇒ Object
73 74 75 |
# File 'lib/an.rb', line 73 def [](key) @data[key] end |
#authorization ⇒ Object
93 94 95 96 97 |
# File 'lib/an.rb', line 93 def response = @data["validationDirectResponse"] || @data["directResponse"] AuthorizationResponse.new(response) if response end |
#payment_profile_id ⇒ Object
89 90 91 |
# File 'lib/an.rb', line 89 def payment_profile_id @data["customerPaymentProfileId"] end |
#profile_id ⇒ Object
85 86 87 |
# File 'lib/an.rb', line 85 def profile_id @data["customerProfileId"] end |
#success? ⇒ Boolean
77 78 79 |
# File 'lib/an.rb', line 77 def success? @data["messages"]["resultCode"] == OK end |
#to_hash ⇒ Object
81 82 83 |
# File 'lib/an.rb', line 81 def to_hash @data end |