Class: AccountBalanceResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- AccountBalanceResponse
- Defined in:
- lib/quota_service/account_balance_response.rb
Instance Attribute Summary collapse
-
#account_balances ⇒ Object
Returns the value of attribute account_balances.
Attributes inherited from BasicResponse
Instance Method Summary collapse
-
#initialize(response_xml, raise_exception_on_error = true) ⇒ AccountBalanceResponse
constructor
Constructor.
Methods inherited from BasicResponse
#inizialize, #raise_on_error, #to_s
Constructor Details
#initialize(response_xml, raise_exception_on_error = true) ⇒ AccountBalanceResponse
Constructor.
Parameters
response_xml
-
Xml as returned by a
call_status
-method call. raise_exception_on_error
-
Xml as returned by a
call_status
-method call.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/quota_service/account_balance_response.rb', line 8 def initialize(response_xml, raise_exception_on_error = true) doc = response_xml.document @error_code = doc.xpath("//errorCode").to_s @error_message = doc.xpath("//errorMessage").to_s @account_balances = [] # Get a list of all account sections accounts_xml = doc.xpath("//getAccountBalanceResponse/Account") # Create Account objects out of the xml response if accounts_xml.is_a?(Handsoap::XmlQueryFront::NodeSelection) then accounts_xml.each do |account_xml| account = Account.build_from_xml(account_xml) account_balances << account end else raise "Unexpected response format." end raise_on_error(response_xml) if raise_exception_on_error end |
Instance Attribute Details
#account_balances ⇒ Object
Returns the value of attribute account_balances.
2 3 4 |
# File 'lib/quota_service/account_balance_response.rb', line 2 def account_balances @account_balances end |