def get_comments(self, response): """This method parses the given response and returns comments list object. Args: response(dict): Response containing json object for comments list. Returns: instance: Comments list object. """ comments = response['comments'] comments_list = CommentList() for value in comments: comment = Comment() comment.set_comment_id(value['comment_id']) comment.set_estimate_id(value['estimate_id']) comment.set_description(value['description']) comment.set_commented_by_id(value['commented_by_id']) comment.set_commented_by(value['commented_by']) comment.set_comment_type(value['comment_type']) comment.set_date(value['date']) comment.set_date_description(value['date_description']) comment.set_time(value['time']) comment.set_operation_type(value['operation_type']) comment.set_transaction_id(value['transaction_id']) comment.set_transaction_type(value['transaction_type']) comments_list.set_comments(comment) return comments_list
def get_comment(self, response): """This method parses the given response and returns comments object. Args: response(dict): Response containing json object for comments object. Returns: instance: Comments object. """ comment = response['comment'] comment_object = Comment() comment_object.set_comment_id(comment['comment_id']) comment_object.set_estimate_id(comment['estimate_id']) comment_object.set_description(comment['description']) comment_object.set_commented_by_id(comment['commented_by_id']) comment_object.set_commented_by(comment['commented_by']) comment_object.set_date(comment['date']) comment_object.set_date_description(comment['date_description']) comment_object.set_time(comment['time']) comment_object.set_comment_type(comment['comment_type']) return comment_object