Class: Remit::Response
- Inherits:
-
BaseResponse
- Object
- Relax::Response
- BaseResponse
- Remit::Response
- Defined in:
- lib/remit/common.rb
Direct Known Subclasses
Cancel::Response, CancelSubscriptionAndRefund::Response, CancelToken::Response, FundPrepaid::Response, GetAccountActivity::Response, GetAccountBalance::Response, GetAllCreditInstruments::Response, GetAllPrepaidInstruments::Response, GetDebtBalance::Response, GetOutstandingDebtBalance::Response, GetPaymentInstruction::Response, GetPrepaidBalance::Response, GetRecipientVerificationStatus::Response, GetTokenByCaller::Response, GetTokenUsage::Response, GetTokens::Response, GetTotalPrepaidLiability::Response, GetTransaction::Response, GetTransactionStatus::Response, InstallPaymentInstruction::Response, Pay::Response, Remit::Refund::Response, Remit::Reserve::Response, Settle::Response, SettleDebt::Response, SubscribeForCallerNotification::Response, UnsubscribeForCallerNotification::Response, VerifySignature::Response, WriteOffDebt::Response
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(xml) ⇒ Response
constructor
A new instance of Response.
- #node_name(name, namespace = nil) ⇒ Object
- #request_id ⇒ Object
- #successful? ⇒ Boolean
Methods inherited from Relax::Response
alias_for_parameter, parameter
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/remit/common.rb', line 49 def initialize(xml) super #TODO: How to differentiate between Error and Service Error if is?(:Response) and has?(:Errors) @errors = elements(:Errors).collect do |error| Error.new(error) end else @status = text_value(element(:Status)) @errors = elements('errors/errors').collect do |error| ServiceError.new(error) end if not successful? end end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
43 44 45 |
# File 'lib/remit/common.rb', line 43 def errors @errors end |
#status ⇒ Object
Returns the value of attribute status.
42 43 44 |
# File 'lib/remit/common.rb', line 42 def status @status end |
Instance Method Details
#node_name(name, namespace = nil) ⇒ Object
69 70 71 72 73 |
# File 'lib/remit/common.rb', line 69 def node_name(name, namespace=nil) super(name.to_s.split('/').collect{ |tag| tag.gsub(/(^|_)(.)/) { $2.upcase } }.join('/'), namespace) end |
#request_id ⇒ Object
45 46 47 |
# File 'lib/remit/common.rb', line 45 def request_id self..respond_to?(:request_id) ? self..request_id : nil end |
#successful? ⇒ Boolean
65 66 67 |
# File 'lib/remit/common.rb', line 65 def successful? @status == ResponseStatus::SUCCESS end |