python-terminusgps 1.10.3__tar.gz → 1.12.0__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.

Potentially problematic release.


This version of python-terminusgps might be problematic. Click here for more details.

Files changed (35) hide show
  1. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/PKG-INFO +1 -1
  2. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/pyproject.toml +1 -1
  3. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/resource.py +59 -1
  4. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/uv.lock +1 -1
  5. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/.gitignore +0 -0
  6. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/COPYING +0 -0
  7. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/README.md +0 -0
  8. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/__init__.py +0 -0
  9. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/__init__.py +0 -0
  10. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/auth.py +0 -0
  11. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/profiles/__init__.py +0 -0
  12. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/profiles/addresses.py +0 -0
  13. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/profiles/base.py +0 -0
  14. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/profiles/customers.py +0 -0
  15. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/authorizenet/profiles/payments.py +0 -0
  16. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/aws/__init__.py +0 -0
  17. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/aws/secrets.py +0 -0
  18. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/aws/ses.py +0 -0
  19. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/settings.py +0 -0
  20. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/twilio/__init__.py +0 -0
  21. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/twilio/caller.py +0 -0
  22. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/__init__.py +0 -0
  23. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/constants.py +0 -0
  24. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/errors.py +0 -0
  25. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/flags.py +0 -0
  26. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/__init__.py +0 -0
  27. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/base.py +0 -0
  28. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/notification.py +0 -0
  29. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/retranslator.py +0 -0
  30. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/route.py +0 -0
  31. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/unit.py +9 -9
  32. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/unit_group.py +0 -0
  33. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/items/user.py +0 -0
  34. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/session.py +0 -0
  35. {python_terminusgps-1.10.3 → python_terminusgps-1.12.0}/terminusgps/wialon/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 1.10.3
3
+ Version: 1.12.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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "1.10.3"
3
+ version = "1.12.0"
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" } ]
@@ -22,17 +22,59 @@ class WialonResource(WialonBase):
22
22
 
23
23
  @property
24
24
  def is_account(self) -> bool:
25
+ """
26
+ Whether or not the resource is an account.
27
+
28
+ :type: :py:obj:`bool`
29
+
30
+ """
25
31
  response = self.session.wialon_api.core_search_item(
26
32
  **{"id": self.id, "flags": flags.DATAFLAG_RESOURCE_BILLING_PROPERTIES}
27
33
  )
28
34
  return response.get("item", {}).get("bact") == self.id
29
35
 
36
+ def is_migrated(self, unit: WialonBase) -> bool:
37
+ """
38
+ Checks if a unit is migrated into the account.
39
+
40
+ :param unit: A Wialon object.
41
+ :type unit: :py:obj:`~terminusgps.wialon.items.base.WialonBase`
42
+ :returns: Whether or not the unit is migrated into the account.
43
+ :rtype: :py:obj:`bool`
44
+
45
+ """
46
+ assert self.is_account, "The resource is not an acccount"
47
+ response = self.session.wialon_api.account_list_change_accounts(
48
+ **{"units": [unit.id]}
49
+ )
50
+ results = [self.id == int(item.get("id")) for item in response]
51
+ return any(results)
52
+
53
+ def set_dealer_rights(self, enabled: bool = False) -> None:
54
+ """
55
+ Sets dealer rights on the account.
56
+
57
+ :param enabled: :py:obj:`True` to enable dealer rights, :py:obj:`False` to disable dealer rights. Default is :py:obj:`False`.
58
+ :type enabled: :py:obj:`bool`
59
+ :raises AssertionError: If the resource is not an account.
60
+ :raises WialonError: If something goes wrong with Wialon.
61
+ :returns: Nothing.
62
+ :rtype: :py:obj:`None`
63
+
64
+ """
65
+ assert self.is_account, "The resource is not an account"
66
+ self.session.wialon_api.account_update_dealer_rights(
67
+ **{"itemId": self.id, "enable": str(enabled).lower()}
68
+ )
69
+
30
70
  def migrate_unit(self, unit: WialonBase) -> None:
31
71
  """
32
72
  Migrates a :py:obj:`WialonUnit` into the account.
33
73
 
34
74
  :param unit: A Wialon object.
35
75
  :type unit: :py:obj:`~terminusgps.wialon.items.base.WialonBase`
76
+ :raises AssertionError: If the resource is not an account.
77
+ :raises WialonError: If something goes wrong with Wialon.
36
78
  :returns: Nothing.
37
79
  :rtype: :py:obj:`None`
38
80
 
@@ -48,6 +90,8 @@ class WialonResource(WialonBase):
48
90
 
49
91
  :param new_plan: The name of a billing plan.
50
92
  :type new_plan: :py:obj:`str`
93
+ :raises AssertionError: If the resource is not an account.
94
+ :raises WialonError: If something goes wrong with Wialon.
51
95
  :returns: Nothing.
52
96
  :rtype: :py:obj:`None`
53
97
 
@@ -63,11 +107,13 @@ class WialonResource(WialonBase):
63
107
 
64
108
  :param billing_plan: The name of a billing plan.
65
109
  :type billing_plan: :py:obj:`str`
110
+ :raises AssertionError: If the resource is already account.
111
+ :raises WialonError: If something goes wrong with Wialon.
66
112
  :returns: Nothing.
67
113
  :rtype: :py:obj:`None`
68
114
 
69
115
  """
70
- assert self.is_account, "The resource is already an account"
116
+ assert not self.is_account, "The resource is already an account"
71
117
  self.session.wialon_api.account_create_account(
72
118
  **{"itemId": self.id, "plan": billing_plan}
73
119
  )
@@ -76,6 +122,8 @@ class WialonResource(WialonBase):
76
122
  """
77
123
  Deletes the account if it exists, as well as any micro-objects and macro-objects it contains.
78
124
 
125
+ :raises AssertionError: If the resource is not an account.
126
+ :raises WialonError: If something goes wrong with Wialon.
79
127
  :returns: Nothing.
80
128
  :rtype: :py:obj:`None`
81
129
 
@@ -87,6 +135,8 @@ class WialonResource(WialonBase):
87
135
  """
88
136
  Enables the Wialon account.
89
137
 
138
+ :raises AssertionError: If the resource is not an account.
139
+ :raises WialonError: If something goes wrong with Wialon.
90
140
  :returns: Nothing.
91
141
  :rtype: :py:obj:`None`
92
142
 
@@ -100,6 +150,8 @@ class WialonResource(WialonBase):
100
150
  """
101
151
  Disables the Wialon account.
102
152
 
153
+ :raises AssertionError: If the resource is not an account.
154
+ :raises WialonError: If something goes wrong with Wialon.
103
155
  :returns: Nothing.
104
156
  :rtype: :py:obj:`None`
105
157
 
@@ -115,6 +167,8 @@ class WialonResource(WialonBase):
115
167
 
116
168
  :param days: Number of days to set the counter to. Default is ``0``.
117
169
  :type days: :py:obj:`int`
170
+ :raises AssertionError: If the resource is not an account.
171
+ :raises WialonError: If something goes wrong with Wialon.
118
172
  :returns: Nothing.
119
173
  :rtype: :py:obj:`None`
120
174
 
@@ -130,6 +184,8 @@ class WialonResource(WialonBase):
130
184
 
131
185
  :param days: Number of days to add to the account. Default is ``30``.
132
186
  :type days: :py:obj:`int`
187
+ :raises AssertionError: If the resource is not an account.
188
+ :raises WialonError: If something goes wrong with Wialon.
133
189
  :returns: Nothing.
134
190
  :rtype: :py:obj:`None`
135
191
 
@@ -159,6 +215,8 @@ class WialonResource(WialonBase):
159
215
  :type block_balance_val: :py:obj:`float`
160
216
  :param deny_balance_val: Minimum amount on the account's balance before denying the account.
161
217
  :type deny_balance_val: :py:obj:`float`
218
+ :raises AssertionError: If the resource is not an account.
219
+ :raises WialonError: If something goes wrong with Wialon.
162
220
  :returns: Nothing.
163
221
  :rtype: :py:obj:`None`
164
222
 
@@ -504,7 +504,7 @@ wheels = [
504
504
 
505
505
  [[package]]
506
506
  name = "python-terminusgps"
507
- version = "1.10.2"
507
+ version = "1.11.0"
508
508
  source = { editable = "." }
509
509
  dependencies = [
510
510
  { name = "argparse" },
@@ -133,15 +133,6 @@ class WialonUnit(WialonBase):
133
133
  **{"itemId": self.id, "phoneNumber": quote_plus(phone)}
134
134
  )
135
135
 
136
- def clean_phone_numbers(self, phones: list[str]) -> list[str]:
137
- cleaned_phones = []
138
- for num in phones:
139
- if "," in num:
140
- cleaned_phones.extend(num.split(","))
141
- else:
142
- cleaned_phones.append(num)
143
- return cleaned_phones
144
-
145
136
  def get_phone_numbers(self) -> list[str]:
146
137
  """
147
138
  Retrieves all phone numbers assigned to the unit.
@@ -167,6 +158,15 @@ class WialonUnit(WialonBase):
167
158
  phone_numbers.extend(phones_2)
168
159
  return list(dict.fromkeys(phone_numbers)) # Removes duplicate phone numbers
169
160
 
161
+ def clean_phone_numbers(self, phones: list[str]) -> list[str]:
162
+ cleaned_phones = []
163
+ for num in phones:
164
+ if "," in num:
165
+ cleaned_phones.extend(num.split(","))
166
+ else:
167
+ cleaned_phones.append(num)
168
+ return cleaned_phones
169
+
170
170
  def _get_afield_phone_numbers(self, key: str = "to_number") -> list[str] | None:
171
171
  """
172
172
  Retrives any phone numbers saved in an admin field by key.