5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/jemquarie/parser/cash_transactions.rb', line 5
def parse_cash_transactions_response(response)
result = generic_request_response(response)
return result if result[:error]
transactions = []
return transactions unless result["XMLExtract"] && result["XMLExtract"]["yourclientsTransactions"] && result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"]
xml_transactions = if result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"].is_a?(Hash)
[result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"]]
else
result["XMLExtract"]["yourclientsTransactions"]["yourclientsTransaction"]
end
xml_transactions.each do |transaction|
transactions << parse_single_transaction(transaction)
end
transactions
end
|