python-terminusgps 1.5.9__tar.gz → 1.5.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/PKG-INFO +1 -1
  2. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/pyproject.toml +1 -1
  3. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/utils.py +27 -3
  4. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/.gitignore +0 -0
  5. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/COPYING +0 -0
  6. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/README.md +0 -0
  7. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/requirements.txt +0 -0
  8. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/__init__.py +0 -0
  9. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/authorizenet/__init__.py +0 -0
  10. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/authorizenet/auth.py +0 -0
  11. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/aws/__init__.py +0 -0
  12. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/aws/secrets.py +0 -0
  13. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/settings.py +0 -0
  14. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/__init__.py +0 -0
  15. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/constants.py +0 -0
  16. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/errors.py +0 -0
  17. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/flags.py +0 -0
  18. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/__init__.py +0 -0
  19. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/base.py +0 -0
  20. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/resource.py +0 -0
  21. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/retranslator.py +0 -0
  22. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/route.py +0 -0
  23. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/unit.py +0 -0
  24. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/unit_group.py +0 -0
  25. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/items/user.py +0 -0
  26. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/terminusgps/wialon/session.py +0 -0
  27. {python_terminusgps-1.5.9 → python_terminusgps-1.5.10}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 1.5.9
3
+ Version: 1.5.10
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "1.5.9"
3
+ version = "1.5.10"
4
4
  description = "Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more."
5
5
  readme = "README.md"
6
6
  authors = [ {name = "Blake Nall", email = "blake@terminusgps.com" } ]
@@ -1,9 +1,33 @@
1
1
  import secrets
2
2
  import string
3
3
 
4
+ from typing import Any
4
5
  from .session import WialonSession
5
6
  from .flags import DATAFLAG_UNIT_BASE
6
7
 
8
+ from terminusgps.wialon.items import (
9
+ WialonUser,
10
+ WialonUnit,
11
+ WialonUnitGroup,
12
+ WialonResource,
13
+ )
14
+
15
+
16
+ def get_wialon_cls(items_type: str) -> Any:
17
+ """Returns a Wialon object class based on items_type."""
18
+ match items_type:
19
+ case "user":
20
+ wialon_cls = WialonUser
21
+ case "avl_unit":
22
+ wialon_cls = WialonUnit
23
+ case "avl_unit_group":
24
+ wialon_cls = WialonUnitGroup
25
+ case "avl_resource":
26
+ wialon_cls = WialonResource
27
+ case _:
28
+ raise ValueError(f"Invalid items_type '{items_type}'")
29
+ return wialon_cls
30
+
7
31
 
8
32
  def is_unique(value: str, session: WialonSession, items_type: str = "avl_unit") -> bool:
9
33
  """Determines if the value is unique among Wialon objects of type 'items_type'."""
@@ -50,9 +74,9 @@ def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
50
74
  "to": 0,
51
75
  }
52
76
  )
53
- if response.get("totalItemsCount", 0) != 1:
54
- return None
55
- return response["items"][0].get("id")
77
+
78
+ if response.get("totalItemsCount", 0) == 1:
79
+ return response["items"][0].get("id")
56
80
 
57
81
 
58
82
  def main() -> None: