def get_association(self, parent_id, resource_id): association = self.service.get(parent_id, resource_id) response = self.converter.encode(association) location = url_for('.get_association', parent_id=parent_id, resource_id=resource_id) return build_response(response, location=location)
def associate_collection(self, parent_id): association = self.converter.decode(request) created_association = self.service.associate(association) response = self.converter.encode(created_association) location = url_for('.get_association', parent_id=parent_id, resource_id=created_association.agent_id) return build_response(response, 201, location)
def get(self): info = self.dao.get() response = self.converter.encode(info) return build_response(response)
def search_by_view(self, args): search_result = self.service.search(**args) converter = self.find_converter(args.get('view')) response = converter.encode_list(search_result.items, search_result.total) return build_response(response)
def search_by_fullname(self, fullname): items = self.service.find_all_by_fullname(fullname) response = self.converter.encode_list(items) return build_response(response)
def get(self): resource = self.service.get() response = self.converter.encode(resource) return build_response(response)
def list_associations_by_child(self, voicemail_id): self.service.validate_resource(voicemail_id) associations = self.service.list_by_child(voicemail_id) response = self.converter.encode_list(associations) return build_response(response)
def get_by_extension(self, extension_id): association = self.service.get_by_extension_id(extension_id) response = self.converter.encode(association) location = url_for('.get_by_extension', extension_id=extension_id) return build_response(response, location=location)