def save_bank_transaction(bank_transaction)
      request_xml = bank_transaction.to_xml
      response_xml = nil
      create_or_save = nil

      if bank_transaction.bank_transaction_id.nil?
        # Create new bank transaction record.
        response_xml = http_put(@client, "#{@xero_url}/BankTransactions", request_xml, {})
        create_or_save = :create
      else
        # Update existing bank transaction record.
        response_xml = http_post(@client, "#{@xero_url}/BankTransactions", request_xml, {})
        create_or_save = :save
      end

      response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => "#{create_or_save == :create ? 'PUT' : 'POST'}/BankTransactions"})

      # Xero returns bank transactions inside an <BankTransactions> tag, even though there's only ever
      # one for this request
      response.response_item = response.bank_transactions.first

      if response.success? && response.bank_transaction && response.bank_transaction.bank_transaction_id
        bank_transaction.bank_transaction_id = response.bank_transaction.bank_transaction_id
      end

      response
    end
def save_bank_transaction(bank_transaction)
      request_xml = bank_transaction.to_xml
      response_xml = nil
      create_or_save = nil

      if bank_transaction.bank_transaction_id.nil?
        # Create new bank transaction record.
        response_xml = http_put(@client, "#{@xero_url}/BankTransactions", request_xml, {})
        create_or_save = :create
      else
        # Update existing bank transaction record.
        response_xml = http_post(@client, "#{@xero_url}/BankTransactions", request_xml, {})
        create_or_save = :save
      end

      response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => "#{create_or_save == :create ? 'PUT' : 'POST'}/BankTransactions"})

      # Xero returns bank transactions inside an <BankTransactions> tag, even though there's only ever
      # one for this request
      response.response_item = response.bank_transactions.first

      if response.success? && response.bank_transaction && response.bank_transaction.bank_transaction_id
        bank_transaction.bank_transaction_id = response.bank_transaction.bank_transaction_id
      end

      response
    end
Create or update a bank transaction record based on if it has an bank_transaction_id.