python-terminusgps 25.0.2__py3-none-any.whl → 25.1.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 25.0.2
3
+ Version: 25.1.0
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
@@ -16,6 +16,7 @@ terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,36
16
16
  terminusgps/aws/ses.py,sha256=sDca2GjMaZvUt3kUPtGCpcqHiOkij9lMV1ogZofgYUU,2372
17
17
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
18
18
  terminusgps/twilio/caller.py,sha256=TiQ4f0TDDC35he1M1iSsBM2vutdGriwtV4pc17T--6I,3552
19
+ terminusgps/twilio/validators.py,sha256=NVQKppG_kjjc-etjyeQoK_W-m_HSVWF-9Ouo3qBsQnU,894
19
20
  terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
21
  terminusgps/wialon/constants.py,sha256=n1ux68oWYWnzeZdN811Iw_Lk78KBM0YMJMoonn67uZY,1723
21
22
  terminusgps/wialon/flags.py,sha256=_NIL3mrEGhvI5YISVjimjYtUatdgOqhZPJX368MtKSU,13959
@@ -23,14 +24,14 @@ terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,
23
24
  terminusgps/wialon/session.py,sha256=t3d7trBQRxnXFnex73alSSD5n2LDTZQ9VAtzUKIERto,9670
24
25
  terminusgps/wialon/utils.py,sha256=Y7fo9a81w84b3N39h1AmVLS-AnC3aRT5R137hIsqCHU,6723
25
26
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
26
- terminusgps/wialon/items/base.py,sha256=nCh635XgF68YjlppbGYZeG2wah7Ic_aSc7RM2AKO4VU,7004
27
+ terminusgps/wialon/items/base.py,sha256=zINd7NWeq4EGQgRhq6bNfEymeyq3uojn8HD71HvhJaQ,6998
27
28
  terminusgps/wialon/items/resource.py,sha256=qmQKEakJa9LH5YkI9-iBDA0hsotc5ctcwdb7kZuXdfQ,14549
28
29
  terminusgps/wialon/items/retranslator.py,sha256=8q9EDc92w92MElnHIeEzH3Ra4kiPXrx4t9V5nPDZuRU,3728
29
30
  terminusgps/wialon/items/route.py,sha256=PTJx1gmT_PGz7nlSSUS2VzjYD-aAuvkEOIdIFneUSSQ,1148
30
31
  terminusgps/wialon/items/unit.py,sha256=uHQrauVkh2556kZp0Dh3WLZvQ6WJIWkibGgPYW1ljPE,9177
31
32
  terminusgps/wialon/items/unit_group.py,sha256=Stp-WfCGbOqcnxV6FU1AKtV7KIxIwCHa0NwhNJfgRoM,5032
32
33
  terminusgps/wialon/items/user.py,sha256=INwAibQVmjNNelepQXMfDevgJqMvIjHHgEjAMLRvhB0,7082
33
- python_terminusgps-25.0.2.dist-info/METADATA,sha256=V68lUH5lPEzK8IL-_PS1bndlepZG4I_Y58ivHXb20oc,946
34
- python_terminusgps-25.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- python_terminusgps-25.0.2.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- python_terminusgps-25.0.2.dist-info/RECORD,,
34
+ python_terminusgps-25.1.0.dist-info/METADATA,sha256=bv2UTsbtSyVsyWHrhD2LFs_iz1MID6Nyn_CrMLGJpw8,946
35
+ python_terminusgps-25.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
+ python_terminusgps-25.1.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
37
+ python_terminusgps-25.1.0.dist-info/RECORD,,
@@ -0,0 +1,25 @@
1
+ from django.core.exceptions import ValidationError
2
+ from django.utils.translation import gettext_lazy as _
3
+
4
+
5
+ def validate_phone_number(value: str) -> None:
6
+ min_length, max_length = 12, 19
7
+
8
+ if not value.startswith("+"):
9
+ raise ValidationError(
10
+ _("Phone number must begin with a '+', got '%(value)s'."),
11
+ code="invalid",
12
+ params={"value": value},
13
+ )
14
+ if len(value) < min_length:
15
+ raise ValidationError(
16
+ _("Phone number cannot be less than %(min)s characters, got %(len)s."),
17
+ code="invalid",
18
+ params={"min": min_length, "len": len(value)},
19
+ )
20
+ if len(value) > max_length:
21
+ raise ValidationError(
22
+ _("Phone number cannot be greater than %(max)s characters, got %(len)s."),
23
+ code="invalid",
24
+ params={"max": min_length, "len": len(value)},
25
+ )
@@ -217,24 +217,17 @@ class WialonBase:
217
217
  @property
218
218
  def cfields(self) -> dict:
219
219
  """Custom fields associated with the Wialon object."""
220
- fields = (
221
- self.session.wialon_api.core_search_item(
222
- **{"id": self.id, "flags": flags.DATAFLAG_UNIT_CUSTOM_FIELDS}
223
- )
224
- .get("item", {})
225
- .get("cfields")
220
+ response = self.session.wialon_api.core_search_item(
221
+ **{"id": self.id, "flags": flags.DATAFLAG_UNIT_CUSTOM_FIELDS}
226
222
  )
227
-
228
- return {field["n"]: field["v"] for _, field in fields.items()} if fields else {}
223
+ fields = response.get("item", {}).get("flds") if response is not None else {}
224
+ return {field["n"]: field["v"] for field in fields.values()} if fields else {}
229
225
 
230
226
  @property
231
227
  def afields(self) -> dict:
232
228
  """Admin fields associated with the Wialon object."""
233
- fields = (
234
- self.session.wialon_api.core_search_item(
235
- **{"id": self.id, "flags": flags.DATAFLAG_UNIT_ADMIN_FIELDS}
236
- )
237
- .get("item", {})
238
- .get("afields")
229
+ response = self.session.wialon_api.core_search_item(
230
+ **{"id": self.id, "flags": flags.DATAFLAG_UNIT_ADMIN_FIELDS}
239
231
  )
240
- return {field["n"]: field["v"] for _, field in fields.items()} if fields else {}
232
+ fields = response.get("item", {}).get("aflds") if response is not None else {}
233
+ return {field["n"]: field["v"] for field in fields.values()} if fields else {}