masstack-python-client 0.1.0__tar.gz → 0.1.2__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.
- {masstack_python_client-0.1.0/src/masstack_python_client.egg-info → masstack_python_client-0.1.2}/PKG-INFO +11 -1
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/README.md +11 -1
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/pyproject.toml +7 -1
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/__init__.py +1 -1
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/catalogue.py +9 -17
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/customers.py +2 -2
- masstack_python_client-0.1.2/src/masstack_python_client/resources/enums/donor_line_type.py +6 -0
- masstack_python_client-0.1.2/src/masstack_python_client/resources/enums/operation_type.py +6 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/bundled.py +3 -2
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/products.py +29 -6
- masstack_python_client-0.1.2/src/masstack_python_client/resources/utils/normalize.py +27 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2/src/masstack_python_client.egg-info}/PKG-INFO +11 -1
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client.egg-info/SOURCES.txt +3 -1
- masstack_python_client-0.1.0/src/masstack_python_client/resources/utils/serialize.py +0 -7
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/LICENSE +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/MANIFEST.in +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/setup.cfg +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/auth/__init__.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/auth/token.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/auth/token_manager.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/auth/token_store.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/client.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/data/data_utils.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/data/province_translation.csv +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/data/street_type_translation.csv +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/data/unit_translation.csv +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/exceptions.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/__init__.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/base.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/__init__.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/bundled_product_category.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/commercial_segment_name.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/customer_segment_name.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/customer_type_name.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/document_type_search.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/sale_type_name.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/technology.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/enums/technology_name.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/feasibility.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/address.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/client_address.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/client_attribute.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/client_payment.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/fixed_phone.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/portability.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/signup.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/models/user.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/resources/provision.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client.egg-info/dependency_links.txt +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client.egg-info/requires.txt +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client.egg-info/top_level.txt +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/tests/test_client.py +0 -0
- {masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/tests/test_exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: masstack-python-client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: This Python API client provides access to masmovil core API domains
|
|
5
5
|
Author-email: Borja Gimeno <borja.gimeno@somconnexio.coop>
|
|
6
6
|
License: GPL-3.0-only
|
|
@@ -112,6 +112,7 @@ curl https://pyenv.run | bash
|
|
|
112
112
|
2. Build the Python version
|
|
113
113
|
```sh
|
|
114
114
|
pyenv install 3.11.9
|
|
115
|
+
pyenv install 3.8.6
|
|
115
116
|
```
|
|
116
117
|
3. Create a virtualenv
|
|
117
118
|
```sh
|
|
@@ -128,3 +129,12 @@ pyenv exec pip install -r requirements-dev.txt
|
|
|
128
129
|
6. Install pre-commit hooks
|
|
129
130
|
```sh
|
|
130
131
|
pyenv exec pre-commit install
|
|
132
|
+
```
|
|
133
|
+
7. To execute tests in local
|
|
134
|
+
```sh
|
|
135
|
+
pyenv local 3.11.9 3.8.6
|
|
136
|
+
```
|
|
137
|
+
8. Execute tests with Tox
|
|
138
|
+
```sh
|
|
139
|
+
pyenv exec tox
|
|
140
|
+
```
|
|
@@ -95,6 +95,7 @@ curl https://pyenv.run | bash
|
|
|
95
95
|
2. Build the Python version
|
|
96
96
|
```sh
|
|
97
97
|
pyenv install 3.11.9
|
|
98
|
+
pyenv install 3.8.6
|
|
98
99
|
```
|
|
99
100
|
3. Create a virtualenv
|
|
100
101
|
```sh
|
|
@@ -110,4 +111,13 @@ pyenv exec pip install -r requirements-dev.txt
|
|
|
110
111
|
```
|
|
111
112
|
6. Install pre-commit hooks
|
|
112
113
|
```sh
|
|
113
|
-
pyenv exec pre-commit install
|
|
114
|
+
pyenv exec pre-commit install
|
|
115
|
+
```
|
|
116
|
+
7. To execute tests in local
|
|
117
|
+
```sh
|
|
118
|
+
pyenv local 3.11.9 3.8.6
|
|
119
|
+
```
|
|
120
|
+
8. Execute tests with Tox
|
|
121
|
+
```sh
|
|
122
|
+
pyenv exec tox
|
|
123
|
+
```
|
|
@@ -74,6 +74,7 @@ requires = ["tox>=4.20"]
|
|
|
74
74
|
env_list = [
|
|
75
75
|
"style",
|
|
76
76
|
"py3119",
|
|
77
|
+
"py38",
|
|
77
78
|
"pep8"
|
|
78
79
|
]
|
|
79
80
|
|
|
@@ -94,6 +95,11 @@ commands = [
|
|
|
94
95
|
["pytest", "--cov=masstack_python_client", "--cov-report=term:skip-covered", "--cov-report=html", "--cov-report=term-missing"],
|
|
95
96
|
]
|
|
96
97
|
|
|
98
|
+
[tool.tox.env.py38]
|
|
99
|
+
commands = [
|
|
100
|
+
["pytest"],
|
|
101
|
+
]
|
|
102
|
+
|
|
97
103
|
[tool.tox.env.pep8]
|
|
98
104
|
deps = ["flake8"]
|
|
99
105
|
commands = [
|
|
@@ -103,4 +109,4 @@ commands = [
|
|
|
103
109
|
[tool.tox.env.coverage]
|
|
104
110
|
commands = [
|
|
105
111
|
["pytest", "--cov=masstack_python_client", "--cov-report=term-missing", "--cov-fail-under=95"],
|
|
106
|
-
]
|
|
112
|
+
]
|
|
@@ -13,7 +13,7 @@ from masstack_python_client.resources.enums.commercial_segment_name import (
|
|
|
13
13
|
from masstack_python_client.resources.enums.customer_segment_name import (
|
|
14
14
|
CustomerSegmentName,
|
|
15
15
|
)
|
|
16
|
-
from masstack_python_client.resources.utils.
|
|
16
|
+
from masstack_python_client.resources.utils.normalize import normalize
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class CatalogueResource(BaseResource):
|
|
@@ -61,28 +61,20 @@ class Sellable(BundledProducts):
|
|
|
61
61
|
sale_type_name(SaleTypeName): sale type name
|
|
62
62
|
|
|
63
63
|
Returns:
|
|
64
|
-
BundledProduct
|
|
64
|
+
List[BundledProduct]
|
|
65
65
|
|
|
66
66
|
"""
|
|
67
67
|
params = {
|
|
68
68
|
"commercial_profile_name": commercial_profile_name,
|
|
69
|
-
"technology_name": technology_name
|
|
69
|
+
"technology_name": technology_name,
|
|
70
70
|
"territory_owner_id": territory_owner_id,
|
|
71
|
-
"category": category
|
|
72
|
-
"customer_segment_name":
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
commercial_segment_name.value if commercial_segment_name else None
|
|
77
|
-
),
|
|
78
|
-
"customer_type_name": (
|
|
79
|
-
customer_type_name.value if customer_type_name else None
|
|
80
|
-
),
|
|
81
|
-
"sale_type_name": sale_type_name.value if sale_type_name else None,
|
|
71
|
+
"category": category,
|
|
72
|
+
"customer_segment_name": customer_segment_name,
|
|
73
|
+
"commercial_segment_name": commercial_segment_name,
|
|
74
|
+
"customer_type_name": customer_type_name,
|
|
75
|
+
"sale_type_name": sale_type_name,
|
|
82
76
|
}
|
|
83
|
-
sellable_bundled_products = cls._request(
|
|
84
|
-
method="get", params=remove_none(params)
|
|
85
|
-
)
|
|
77
|
+
sellable_bundled_products = cls._request(method="get", params=normalize(params))
|
|
86
78
|
return [
|
|
87
79
|
BundledProduct.from_dict(**sellable_bundled_product)
|
|
88
80
|
for sellable_bundled_product in sellable_bundled_products
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import asdict
|
|
2
2
|
from masstack_python_client.resources.base import BaseResource
|
|
3
3
|
from masstack_python_client.resources.models.user import UserData
|
|
4
|
-
from masstack_python_client.resources.utils.
|
|
4
|
+
from masstack_python_client.resources.utils.normalize import normalize
|
|
5
5
|
from masstack_python_client.resources.enums.document_type_search import (
|
|
6
6
|
DocumentTypeSearch,
|
|
7
7
|
)
|
|
@@ -35,7 +35,7 @@ class SignupsResource(CustomersResource):
|
|
|
35
35
|
Returns:
|
|
36
36
|
SignupsResponseData
|
|
37
37
|
"""
|
|
38
|
-
payload =
|
|
38
|
+
payload = normalize(asdict(customer_data))
|
|
39
39
|
result = cls._request(
|
|
40
40
|
method="post",
|
|
41
41
|
data=payload,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
@dataclass(frozen=True)
|
|
@@ -21,7 +22,7 @@ class ComercialProduct:
|
|
|
21
22
|
@dataclass(frozen=True)
|
|
22
23
|
class BundledProductSubtype:
|
|
23
24
|
id: str
|
|
24
|
-
bundled_commercial_products:
|
|
25
|
+
bundled_commercial_products: List[ComercialProduct]
|
|
25
26
|
subs_type: SubsType
|
|
26
27
|
|
|
27
28
|
@classmethod
|
|
@@ -42,7 +43,7 @@ class BundledProductSubtype:
|
|
|
42
43
|
class BundledProduct:
|
|
43
44
|
id: str
|
|
44
45
|
name: str
|
|
45
|
-
bundled_product_subs_types:
|
|
46
|
+
bundled_product_subs_types: List[BundledProductSubtype]
|
|
46
47
|
|
|
47
48
|
@classmethod
|
|
48
49
|
def from_dict(
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from typing import List, Dict, Any
|
|
2
|
+
from typing import Optional, List, Dict, Any
|
|
3
|
+
|
|
4
|
+
from masstack_python_client.resources.enums.donor_line_type import DonorLineType
|
|
5
|
+
from masstack_python_client.resources.enums.operation_type import OperationType
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
@dataclass(frozen=True)
|
|
@@ -43,13 +46,33 @@ class Info:
|
|
|
43
46
|
)
|
|
44
47
|
|
|
45
48
|
|
|
49
|
+
@dataclass(frozen=True)
|
|
50
|
+
class PortabilityInfo:
|
|
51
|
+
operator_id: str
|
|
52
|
+
internal_portability: bool
|
|
53
|
+
installation_required: bool
|
|
54
|
+
operation_type: Optional[OperationType] = OperationType.INSTANT
|
|
55
|
+
donor_line_type: Optional[DonorLineType] = DonorLineType.POSTPAID
|
|
56
|
+
|
|
57
|
+
|
|
46
58
|
@dataclass(frozen=True)
|
|
47
59
|
class Landline:
|
|
48
60
|
product_id: int
|
|
49
61
|
number: str
|
|
62
|
+
portability_info: Optional[PortabilityInfo] = None
|
|
50
63
|
services: List = field(default_factory=list)
|
|
51
64
|
wants_communications: bool = False
|
|
52
|
-
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls, product_id, number, portability_info=None, **data) -> "Landline":
|
|
68
|
+
return cls(
|
|
69
|
+
product_id,
|
|
70
|
+
number,
|
|
71
|
+
portability_info=(
|
|
72
|
+
PortabilityInfo(**portability_info) if portability_info else None
|
|
73
|
+
),
|
|
74
|
+
**data,
|
|
75
|
+
)
|
|
53
76
|
|
|
54
77
|
|
|
55
78
|
@dataclass(frozen=True)
|
|
@@ -58,9 +81,9 @@ class Ftth:
|
|
|
58
81
|
connection_type: str = ""
|
|
59
82
|
installer: str = "MM"
|
|
60
83
|
wants_communications: bool = False
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
84
|
+
access_reuse: str = None
|
|
85
|
+
access_reuse_choice: bool = False
|
|
86
|
+
iua: str = None
|
|
64
87
|
|
|
65
88
|
|
|
66
89
|
@dataclass(frozen=True)
|
|
@@ -85,6 +108,6 @@ class Bundle:
|
|
|
85
108
|
territory_owner,
|
|
86
109
|
installation_info=info,
|
|
87
110
|
delivery_info=info,
|
|
88
|
-
landline=Landline(**data["land_line"]),
|
|
111
|
+
landline=Landline.from_dict(**data["land_line"]),
|
|
89
112
|
ftth=Ftth(**data["ftth"]),
|
|
90
113
|
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def normalize(obj):
|
|
5
|
+
"""Recursively prepare an object for API serialization.
|
|
6
|
+
|
|
7
|
+
Traverses dicts and lists removing None values and converting
|
|
8
|
+
Enum members to their primitive values.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
obj: The object to normalize. Supported types:
|
|
12
|
+
- dict: filters out None values and recurses on remaining values.
|
|
13
|
+
- list: filters out None items and recurses on remaining items.
|
|
14
|
+
- Enum: returns its primitive value.
|
|
15
|
+
- Any other type: returned as-is.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
The serialized object, ready to be sent as an API payload.
|
|
19
|
+
"""
|
|
20
|
+
if isinstance(obj, dict):
|
|
21
|
+
return {k: normalize(v) for k, v in obj.items() if v is not None}
|
|
22
|
+
elif isinstance(obj, list):
|
|
23
|
+
return [normalize(v) for v in obj if v is not None]
|
|
24
|
+
elif isinstance(obj, Enum):
|
|
25
|
+
return obj.value
|
|
26
|
+
else:
|
|
27
|
+
return obj
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: masstack-python-client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: This Python API client provides access to masmovil core API domains
|
|
5
5
|
Author-email: Borja Gimeno <borja.gimeno@somconnexio.coop>
|
|
6
6
|
License: GPL-3.0-only
|
|
@@ -112,6 +112,7 @@ curl https://pyenv.run | bash
|
|
|
112
112
|
2. Build the Python version
|
|
113
113
|
```sh
|
|
114
114
|
pyenv install 3.11.9
|
|
115
|
+
pyenv install 3.8.6
|
|
115
116
|
```
|
|
116
117
|
3. Create a virtualenv
|
|
117
118
|
```sh
|
|
@@ -128,3 +129,12 @@ pyenv exec pip install -r requirements-dev.txt
|
|
|
128
129
|
6. Install pre-commit hooks
|
|
129
130
|
```sh
|
|
130
131
|
pyenv exec pre-commit install
|
|
132
|
+
```
|
|
133
|
+
7. To execute tests in local
|
|
134
|
+
```sh
|
|
135
|
+
pyenv local 3.11.9 3.8.6
|
|
136
|
+
```
|
|
137
|
+
8. Execute tests with Tox
|
|
138
|
+
```sh
|
|
139
|
+
pyenv exec tox
|
|
140
|
+
```
|
|
@@ -30,6 +30,8 @@ src/masstack_python_client/resources/enums/commercial_segment_name.py
|
|
|
30
30
|
src/masstack_python_client/resources/enums/customer_segment_name.py
|
|
31
31
|
src/masstack_python_client/resources/enums/customer_type_name.py
|
|
32
32
|
src/masstack_python_client/resources/enums/document_type_search.py
|
|
33
|
+
src/masstack_python_client/resources/enums/donor_line_type.py
|
|
34
|
+
src/masstack_python_client/resources/enums/operation_type.py
|
|
33
35
|
src/masstack_python_client/resources/enums/sale_type_name.py
|
|
34
36
|
src/masstack_python_client/resources/enums/technology.py
|
|
35
37
|
src/masstack_python_client/resources/enums/technology_name.py
|
|
@@ -43,6 +45,6 @@ src/masstack_python_client/resources/models/portability.py
|
|
|
43
45
|
src/masstack_python_client/resources/models/products.py
|
|
44
46
|
src/masstack_python_client/resources/models/signup.py
|
|
45
47
|
src/masstack_python_client/resources/models/user.py
|
|
46
|
-
src/masstack_python_client/resources/utils/
|
|
48
|
+
src/masstack_python_client/resources/utils/normalize.py
|
|
47
49
|
tests/test_client.py
|
|
48
50
|
tests/test_exceptions.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{masstack_python_client-0.1.0 → masstack_python_client-0.1.2}/src/masstack_python_client/client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|