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.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/remit/common.rb', line 52 def initialize(xml) super # TODO: How to differentiate between Error and Service Error properly? - pboling # TODO: Is this ServiceError still relevant? - pboling if is?(:Response) and has?(:Errors) @errors = elements('errors/error').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.
46 47 48 |
# File 'lib/remit/common.rb', line 46 def errors @errors end |
#status ⇒ Object
Returns the value of attribute status.
45 46 47 |
# File 'lib/remit/common.rb', line 45 def status @status end |
Instance Method Details
#node_name(name, namespace = nil) ⇒ Object
73 74 75 76 77 |
# File 'lib/remit/common.rb', line 73 def node_name(name, namespace=nil) super(name.to_s.split('/').collect{ |tag| tag.gsub(/(^|_)(.)/) { $2.upcase } }.join('/'), namespace) end |
#request_id ⇒ Object
48 49 50 |
# File 'lib/remit/common.rb', line 48 def request_id self..respond_to?(:request_id) ? self..request_id : nil end |
#successful? ⇒ Boolean
69 70 71 |
# File 'lib/remit/common.rb', line 69 def successful? @status == ResponseStatus::SUCCESS end |