Class: AccountBalanceResponse

Inherits:
BasicResponse show all
Defined in:
lib/quota_service/account_balance_response.rb

Instance Attribute Summary collapse

Attributes inherited from BasicResponse

#error_code, #error_message

Instance Method Summary collapse

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.build_from_xml()        
       <<         
    end
  else
    raise "Unexpected response format."
  end

  raise_on_error(response_xml) if raise_exception_on_error
end

Instance Attribute Details

#account_balancesObject

Returns the value of attribute account_balances.



2
3
4
# File 'lib/quota_service/account_balance_response.rb', line 2

def 
  @account_balances
end