5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/jemquarie/parser/balance.rb', line 5
def parse_balance_response(response)
result = generic_request_response(response)
return result if result[:error]
balances = []
return balances unless result["XMLExtract"] && result["XMLExtract"]["yourclientsBalances"] && result["XMLExtract"]["yourclientsBalances"]["yourclientsBalance"]
xml_balances = if result["XMLExtract"]["yourclientsBalances"]["yourclientsBalance"].is_a?(Hash)
[result["XMLExtract"]["yourclientsBalances"]["yourclientsBalance"]]
else
result["XMLExtract"]["yourclientsBalances"]["yourclientsBalance"]
end
xml_balances.each do |balance|
balances << parse_single_balance(balance)
end
balances
end
|