python-terminusgps 1.10.3__py3-none-any.whl → 1.12.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.
Potentially problematic release.
This version of python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-1.10.3.dist-info → python_terminusgps-1.12.0.dist-info}/METADATA +1 -1
- {python_terminusgps-1.10.3.dist-info → python_terminusgps-1.12.0.dist-info}/RECORD +6 -6
- terminusgps/wialon/items/resource.py +59 -1
- terminusgps/wialon/items/unit.py +9 -9
- {python_terminusgps-1.10.3.dist-info → python_terminusgps-1.12.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-1.10.3.dist-info → python_terminusgps-1.12.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 1.
|
|
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
|
|
@@ -21,13 +21,13 @@ terminusgps/wialon/utils.py,sha256=9xJq5eAWm-vu0nJVJ7eUcwhJhMCrGjS1p__4CIBXYm4,3
|
|
|
21
21
|
terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
|
|
22
22
|
terminusgps/wialon/items/base.py,sha256=sWM8Kg3eJ008M51q42OREHmeifOrFbV1JS9ELqE7coA,6878
|
|
23
23
|
terminusgps/wialon/items/notification.py,sha256=wC-KXxW4LhjSLJVzBGPfu5hz1vcIGKnYFMxQQ1JzX0g,1058
|
|
24
|
-
terminusgps/wialon/items/resource.py,sha256=
|
|
24
|
+
terminusgps/wialon/items/resource.py,sha256=7quzb_xvjyEZDTtLMweYOf37NsT9klYcCj4e6apGa5Q,8282
|
|
25
25
|
terminusgps/wialon/items/retranslator.py,sha256=zsQXqOhH1zFe5_e8DROPu60z3v6xPWOEPyMCi2IqJAo,3861
|
|
26
26
|
terminusgps/wialon/items/route.py,sha256=qOHPN_rejwiGqvwWzlwmUIAIyc3lKavCalf8ki66rx0,760
|
|
27
|
-
terminusgps/wialon/items/unit.py,sha256=
|
|
27
|
+
terminusgps/wialon/items/unit.py,sha256=3fp9HXxW8e7PvMXwRBurNUrDstEmGyLBVRu3Q9kNcAM,7275
|
|
28
28
|
terminusgps/wialon/items/unit_group.py,sha256=1yc7ldPIgGbtiTj0djRDWmt6Q9K_VT9sxOaioasbbLY,5212
|
|
29
29
|
terminusgps/wialon/items/user.py,sha256=p_NA4iXLappr44RKwt9EHv_v0jc1XOQU_mJWe61s_qI,6077
|
|
30
|
-
python_terminusgps-1.
|
|
31
|
-
python_terminusgps-1.
|
|
32
|
-
python_terminusgps-1.
|
|
33
|
-
python_terminusgps-1.
|
|
30
|
+
python_terminusgps-1.12.0.dist-info/METADATA,sha256=PCs6sRzEkIVWNdLK2lLtsUzVnSnR5r5DbnI-ih540Ms,912
|
|
31
|
+
python_terminusgps-1.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
python_terminusgps-1.12.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
python_terminusgps-1.12.0.dist-info/RECORD,,
|
|
@@ -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
|
|
terminusgps/wialon/items/unit.py
CHANGED
|
@@ -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.
|
|
File without changes
|
{python_terminusgps-1.10.3.dist-info → python_terminusgps-1.12.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|