'Takes parsed JSON response from \'user\' action on api, and updates relevant user information.
To avoid problems, only pass in user data from an API call that used this user\'s ID as an argument.'

def set_user_data(self, user_json_response):

    if (self.username and (self.username != user_json_response['username'])):
        raise InvalidUserException(("Tried    to    update    a    user's    information    from    a    'user'    API    call    with    a    different    username." + ('    Should    be    %s,    got    %s' % (self.username, user_json_response['username']))))
    self.username = user_json_response['username']
    self.avatar = user_json_response['avatar']
    self.is_friend = user_json_response['isFriend']
    self.profile_text = user_json_response['profileText']
    if self.stats:
        self.stats = dict((self.stats.items() + user_json_response['stats'].items()))
    else:
        self.stats = user_json_response['stats']
    self.ranks = user_json_response['ranks']
    self.personal = user_json_response['personal']
    self.community = user_json_response['community']
    self.stats['class'] = self.personal['class']
    self.passkey = self.personal['passkey']
