You never know what someone is going through. His or her interactions with you are a reflection of internal feelings in that person's life, not reactions to your actions.
I had to remember this last week when dealing with a very rude rental car saleswoman. Her attitude frustrated me so much! But I stepped back and took a look at her life - or work life at least. There was no air conditioning in the building (in Florida!), she had to check the returned rental cars herself, and there was only one shuttle bus making trips to the airport - forcing her to be with the angry customers while they waited for it to return.
Are these excuses for a bad attitude? No. But taking this perspective helped me to let go of my frustration and find compassion for her.
It can be tough, but take a step back when someone is upsetting you. Most of the time, you'll realize that person isn't acting this way to hurt you - but that he or she is hurting and dealing with something on their own.