Class: Remit::Response
- Inherits:
-
BaseResponse
- Object
- Relax::Response
- BaseResponse
- Remit::Response
- Defined in:
- lib/remit/common.rb
Direct Known Subclasses
CancelSubscriptionAndRefund::Response, CancelToken::Response, DiscardResults::Response, FundPrepaid::Response, GetAccountActivity::Response, GetAccountBalance::Response, GetAllCreditInstruments::Response, GetAllPrepaidInstruments::Response, GetDebtBalance::Response, GetOutstandingDebtBalance::Response, GetPaymentInstruction::Response, GetPrepaidBalance::Response, GetResults::Response, GetTokenByCaller::Response, GetTokenUsage::Response, GetTokens::Response, GetTotalPrepaidLiability::Response, GetTransaction::Response, InstallPaymentInstruction::Response, Pay::Response, Remit::Refund::Response, Remit::Reserve::Response, Remit::RetryTransaction::Response, Settle::Response, SettleDebt::Response, SubscribeForCallerNotification::Response, UnsubscribeForCallerNotification::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
- #successful? ⇒ Boolean
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/remit/common.rb', line 32 def initialize(xml) super if is?(:Response) && 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 unless successful? end end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
30 31 32 |
# File 'lib/remit/common.rb', line 30 def errors @errors end |
#status ⇒ Object
Returns the value of attribute status.
29 30 31 |
# File 'lib/remit/common.rb', line 29 def status @status end |
Instance Method Details
#node_name(name, namespace = nil) ⇒ Object
51 52 53 54 55 |
# File 'lib/remit/common.rb', line 51 def node_name(name, namespace=nil) super(name.to_s.split('/').collect{ |tag| tag.gsub(/(^|_)(.)/) { $2.upcase } }.join('/'), namespace) end |
#successful? ⇒ Boolean
47 48 49 |
# File 'lib/remit/common.rb', line 47 def successful? @status == ResponseStatus::SUCCESS end |