def get_comments(self, resp): """This method parses the given response and returns comments list object. Args: resp(dict): Response containing json object for comments list. Returns: list of instance: Comments list object. """ comments = CommentList() for value in resp['comments']: comment = Comment() comment.set_comment_id(value['comment_id']) comment.set_project_id(value['project_id']) comment.set_description(value['description']) comment.set_commented_by_id(value['commented_by_id']) comment.set_commented_by(value['commented_by']) comment.set_is_current_user(value['is_current_user']) comment.set_date(value['date']) comment.set_date_description(value['date_description']) comment.set_time(value['time']) comments.set_comments(comment) return comments
def get_comment(self, resp): """This method parses the given response and returns comment object. Args: resp(dict): Response containing json object for comment object. Returns: instance: Comment object. """ comment = resp['comment'] comment_obj = Comment() comment_obj.set_comment_id(comment['comment_id']) comment_obj.set_project_id(comment['project_id']) comment_obj.set_description(comment['description']) comment_obj.set_commented_by_id(comment['commented_by_id']) comment_obj.set_commented_by(comment['commented_by']) comment_obj.set_date(comment['date']) comment_obj.set_date_description(comment['date_description']) comment_obj.set_time(comment['time']) return comment_obj