Class: SecureTrading::Response
- Inherits:
-
Object
- Object
- SecureTrading::Response
- Defined in:
- lib/secure_trading/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #live? ⇒ Boolean
- #message ⇒ Object
- #operation_response ⇒ Object
- #raw_response ⇒ Object
- #result ⇒ Object
- #success? ⇒ Boolean
- #threed3secure_response ⇒ Object
- #transaction ⇒ Object
- #type ⇒ Object
- #xml ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/secure_trading/response.rb', line 6 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/secure_trading/response.rb', line 4 def response @response end |
Instance Method Details
#live? ⇒ Boolean
18 19 20 |
# File 'lib/secure_trading/response.rb', line 18 def live? self.xml["Live"] == "TRUE" end |
#message ⇒ Object
22 23 24 |
# File 'lib/secure_trading/response.rb', line 22 def self.operation_response['Message'] end |
#operation_response ⇒ Object
26 27 28 |
# File 'lib/secure_trading/response.rb', line 26 def operation_response Util.stringify_values(self.xml["Response"].first["OperationResponse"].first) end |
#raw_response ⇒ Object
46 47 48 |
# File 'lib/secure_trading/response.rb', line 46 def raw_response @response end |
#result ⇒ Object
34 35 36 |
# File 'lib/secure_trading/response.rb', line 34 def result operation_response['Result'].to_i end |
#success? ⇒ Boolean
38 39 40 |
# File 'lib/secure_trading/response.rb', line 38 def success? result == 1 end |
#threed3secure_response ⇒ Object
30 31 32 |
# File 'lib/secure_trading/response.rb', line 30 def threed3secure_response Util.stringify_values(self.xml["Response"].first["ThreeDSecure"].first) end |
#transaction ⇒ Object
42 43 44 |
# File 'lib/secure_trading/response.rb', line 42 def transaction Objects::Transaction.new(:verifier => self.operation_response['TransactionVerifier'], :reference => self.operation_response['TransactionReference']) end |
#type ⇒ Object
14 15 16 |
# File 'lib/secure_trading/response.rb', line 14 def type self.xml['Response'].first['Type'] end |
#xml ⇒ Object
10 11 12 |
# File 'lib/secure_trading/response.rb', line 10 def xml @xml ||= XmlSimple.xml_in(@response) end |