diff --git a/src/webqueue2api/parser/queue.py b/src/webqueue2api/parser/queue.py index d9df107..cef366f 100644 --- a/src/webqueue2api/parser/queue.py +++ b/src/webqueue2api/parser/queue.py @@ -17,9 +17,10 @@ class Queue: >>> queue = Queue("ce") Attributes: - name: The name of the queue. - items: A list of Items in the queue. - jsonData: A JSON serializable representation of the Queue. + name (str): The name of the queue. + path: (pathlib.Path): The path of the queue directory. + items (list): A list of Items in the queue. + json_data (dict): A JSON serializable representation of the Queue. Raises: QueueDoesNotExistError: If a queue's directory does not exist on the filesystem. @@ -33,9 +34,8 @@ def __init__(self, name: str) -> None: self.items = self.get_items() - self.jsonData = { + self.json_data = { "name": self.name, - "length": len(self) } def get_items(self) -> list: @@ -56,7 +56,7 @@ def get_items(self) -> list: return items - def toJson(self) -> dict: + def to_json(self) -> dict: """Return JSON safe representation of the Queue The JSON representation of every item in the Queue is added to the @@ -68,9 +68,9 @@ def toJson(self) -> dict: items = [] for item in self.items: items.append(item.toJson()) - self.jsonData["items"] = items + self.json_data["items"] = items - return self.jsonData + return self.json_data def __len__(self) -> int: return len(self.items)