def read(self, userID): '''Return an User instance given an ID. ''' response = self.driver.get(userID) user = User() if response: user.from_dictionary(response) return user
def read_multiple(self, userIDs, asDictionary=True): '''Return dictionary (default) or list of User instances. Use dictionary for easier indexing. Use list for order preservation. ''' response = self.driver.get_multiple(userIDs, asDictionary) if asDictionary: output = {} for x in response: output[x] = User() output[x].from_dictionary(response[x]) else: output = [] for x in response: user = User() user.from_dictionary() output.append(user) return output
def read_by_field(self, field, id): response = self.driver.get_by_field(field, id) user = User() if response: user.from_dictionary(response) return user
def get_protected_fields(self): user = User() return user.get_protected_fields()
def get_empty_user(self): return User()